Enhance payload monitoring and analysis in protocol blocking service
This commit is contained in:
@@ -127,8 +127,10 @@ class ProtocolBlockingService {
|
||||
_continuousMonitor!.stderr
|
||||
.transform(utf8.decoder)
|
||||
.listen((error) {
|
||||
if (!error.contains('listening on')) {
|
||||
if (!error.contains('listening on') && !error.contains('data link type') && !error.contains('verbose output suppressed')) {
|
||||
print('❌ tcpdump error: $error');
|
||||
} else {
|
||||
print('ℹ️ tcpdump info: $error');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,17 +140,28 @@ class ProtocolBlockingService {
|
||||
}
|
||||
|
||||
static Future<void> _processCapturedPacket(String packetLine) async {
|
||||
// Skip timestamp/header lines, only process hex data lines
|
||||
if (!packetLine.contains('0x') || packetLine.trim().isEmpty) {
|
||||
return;
|
||||
// Print all packet lines to see what we're getting
|
||||
print('📋 RAW PACKET LINE: $packetLine');
|
||||
|
||||
// Check if it's from our monitored peers first
|
||||
bool isFromPeer = false;
|
||||
String? peerIP;
|
||||
|
||||
for (final ip in _activePeerIPs) {
|
||||
if (packetLine.contains(ip)) {
|
||||
isFromPeer = true;
|
||||
peerIP = ip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's from our monitored peers and analyze payload
|
||||
for (final peerIP in _activePeerIPs) {
|
||||
if (packetLine.contains(peerIP)) {
|
||||
print('🎯 PEER TRAFFIC FROM $peerIP - ANALYZING PAYLOAD');
|
||||
if (isFromPeer && peerIP != null) {
|
||||
print('🎯 PEER TRAFFIC FROM $peerIP');
|
||||
|
||||
// For hex data lines, do deep payload analysis
|
||||
if (packetLine.contains('0x')) {
|
||||
print('🔍 HEX DATA DETECTED - ANALYZING PAYLOAD');
|
||||
await _analyzeFullPayload(packetLine, peerIP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user