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