Gestione separata conf conntrack
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
proxy/conntrack.pl
|
||||
proxy/conntrack.conf
|
||||
core/config.php
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
$|=1;
|
||||
|
||||
use DBI;
|
||||
use FindBin qw($Bin);
|
||||
|
||||
my $proxy_IP = '192.168.1.3';
|
||||
my $proxy_PORT = 3128;
|
||||
my $param = shift @ARGV;
|
||||
|
||||
$verbose = 0;
|
||||
if ($param eq '-v') {
|
||||
$verbose = 1;
|
||||
}
|
||||
|
||||
require "$Bin/conntrack.conf";
|
||||
|
||||
`sysctl -w net.netfilter.nf_conntrack_acct=1`;
|
||||
|
||||
my $dbmysql = DBI->connect("DBI:mysql:;host=127.0.0.1", "pannello_proxy", "CuQlM1lfF4VZDCIP") or die ($DBI::errstr);
|
||||
$sts = $dbmysql->prepare("use pannello_vbc");
|
||||
my $dbmysql = DBI->connect("DBI:mysql:;host=$DBhost", $DBuser, $DBpass) or die ($DBI::errstr);
|
||||
$sts = $dbmysql->prepare("use $DBname");
|
||||
$sts->execute ();
|
||||
|
||||
|
||||
#/usr/sbin/conntrack -E -p tcp --dport 3128 -oextended,id,timestamp -eDESTROY
|
||||
|
||||
open CT, "/usr/sbin/conntrack -E -eNEW,DESTROY -otimestamp,id -p tcp --dport $proxy_PORT |" or die "non va\n";
|
||||
|
||||
while (<CT>) {
|
||||
@@ -41,7 +45,6 @@ while (<CT>) {
|
||||
# print "$riga";
|
||||
}
|
||||
|
||||
|
||||
if ( $riga =~ /^\s*\[(\d+)\.\d+\]\s+\[DESTROY\] tcp\s+\d+ src=(\S+) dst=(\S+) sport=\d+ dport=(\d+) packets=\d+ bytes=(\d+) src=\S+ dst=\S+ sport=\d+ dport=\d+ packets=\d+ bytes=(\d+) \[\w+\] id=(\d+)/) {
|
||||
# next if ($2 != $proxy_IP);
|
||||
# next if ($3 != $proxy_PORT);
|
||||
@@ -54,7 +57,7 @@ while (<CT>) {
|
||||
my $remote_RECEIVE = $6;
|
||||
my $thread_ID = $7;
|
||||
|
||||
print "IP: $remote_IP - ID: $thread_ID - Invati: $remote_SEND - Ricevuti: $remote_RECEIVE\n";
|
||||
print "IP: $remote_IP - ID: $thread_ID - Invati: $remote_SEND - Ricevuti: $remote_RECEIVE\n" if ($verbose);
|
||||
|
||||
my $query = " UPDATE
|
||||
proxy_dati
|
||||
|
||||
9
proxy/conntrack.sample.conf
Normal file
9
proxy/conntrack.sample.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
$proxy_IP = '';
|
||||
$proxy_PORT = 3128;
|
||||
|
||||
$DBhost = '';
|
||||
$DBname = '';
|
||||
$DBuser = '';
|
||||
$DBpass = '';
|
||||
|
||||
return 1;
|
||||
Reference in New Issue
Block a user