Aggiunta gestione IP

This commit is contained in:
cmaffio
2016-04-27 12:25:52 +02:00
parent 5becd28889
commit 1bbecd135e
4 changed files with 150 additions and 48 deletions

View File

@@ -102,11 +102,13 @@ sub conntrack {
my $proxy_IP = shift;
my $proxy_PORT = shift;
$SIG{INT} = \&end;
my $conta = 0;
print "Attivato agente $sess_id su $proxy_IP:$proxy_PORT\n" if ($verbose);
open CT, "/usr/sbin/conntrack -E -eNEW,DESTROY -otimestamp,id -p tcp -d $proxy_IP --dport $proxy_PORT |" or die "non va\n";
my $proc_id = open CT, "/usr/sbin/conntrack -E -eNEW,DESTROY -otimestamp,id -p tcp -d $proxy_IP --dport $proxy_PORT 2>/dev/null |" or die "non va\n";
while (<CT>) {
my $riga = $_;
@@ -173,9 +175,13 @@ sub conntrack {
$sem2->up();
print "Invio query UPDATE\n" if ($verbose > 1);
}
return if ($conta >= $limit_thread);
if ($conta >= $limit_thread) {
last;
# kill 9, $proc_id;
# return
}
}
close CT;
kill 9, $proc_id;
return;
}