diff --git a/lib/services/protocol_blocking_service.dart b/lib/services/protocol_blocking_service.dart index 2dc9596..0df5108 100644 --- a/lib/services/protocol_blocking_service.dart +++ b/lib/services/protocol_blocking_service.dart @@ -40,17 +40,18 @@ class ProtocolBlockingService { }); } + static int _scanCount = 0; + static Future _scanForNewConnections() async { - static int scanCount = 0; - scanCount++; + _scanCount++; try { // Monitor both TCP and UDP connections final tcpResult = await Process.run('ss', ['-tnp', 'state', 'syn-sent,established']); final udpResult = await Process.run('ss', ['-unp']); - if (scanCount % 100 == 0) { // Log every 10 seconds - print('🔍 Scan #$scanCount - TCP exit code: ${tcpResult.exitCode}, UDP exit code: ${udpResult.exitCode}'); + if (_scanCount % 100 == 0) { // Log every 10 seconds + print('🔍 Scan #$_scanCount - TCP exit code: ${tcpResult.exitCode}, UDP exit code: ${udpResult.exitCode}'); } if (tcpResult.exitCode != 0) { @@ -65,7 +66,7 @@ class ProtocolBlockingService { final tcpConnections = _parseConnections(tcpResult.stdout.toString(), 'tcp'); final udpConnections = _parseConnections(udpResult.stdout.toString(), 'udp'); - if (scanCount % 100 == 0) { + if (_scanCount % 100 == 0) { print('🔍 Found ${tcpConnections.length} TCP + ${udpConnections.length} UDP connections'); }