diff --git a/TODO b/TODO
new file mode 100644
index 0000000..f7653c5
--- /dev/null
+++ b/TODO
@@ -0,0 +1,7 @@
+# Moduli da implementare
+- Proxy
+- Firewall
+- DHCP
+- Routing
+
+
diff --git a/chk.php b/chk.php
new file mode 100644
index 0000000..fcce107
--- /dev/null
+++ b/chk.php
@@ -0,0 +1 @@
+
diff --git a/core/chkpasswd.php b/core/chkpasswd.php
index ce86bd5..a9ed4a2 100755
--- a/core/chkpasswd.php
+++ b/core/chkpasswd.php
@@ -1,10 +1,8 @@
-
+view_top();
-
-
+
diff --git a/core/conf.php b/core/conf.php
index 360a6ba..85a0a8f 100755
--- a/core/conf.php
+++ b/core/conf.php
@@ -3,7 +3,8 @@ include_once ("config.php");
$UTENTE = login();
isadmin();
-include_once ("top.php"); ?>
+view_top();
+?>
@@ -60,4 +61,4 @@ while ($dato = mysql_fetch_array ( $res )) {
-
+
diff --git a/core/config.php b/core/config.php
index 1e38638..a6339c7 100755
--- a/core/config.php
+++ b/core/config.php
@@ -7,5 +7,5 @@ $db_data_pwd = "Lx7w3e8dNPfwwc3z";
require_once ("function.php");
$DB_ID = db_data_connect ();
-carica_conf();
+$CONF = carica_conf();
?>
diff --git a/core/function.php b/core/function.php
index 215d6a7..c4b711c 100755
--- a/core/function.php
+++ b/core/function.php
@@ -98,13 +98,24 @@ function login () {
}
}
-function carica_conf () {
+function carica_conf ($modulo="") {
global $CONF, $DB_ID;
- $query = "SELECT variabile, valore FROM conf";
+
+ if ($modulo != "") {
+ $query = "SELECT prefisso FROM moduli WHERE nome = '$modulo'";
+ $res = mysql_query( $query, $DB_ID );
+ $dato = mysql_fetch_array ( $res );
+ $tabella = $dato['prefisso']."conf";
+ } else {
+ $tabella = "conf";
+ }
+
+ $query = "SELECT variabile, valore FROM $tabella";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
- $CONF[$dato[0]] = $dato[1];
+ $tmp[$dato[0]] = $dato[1];
}
+ return $tmp;
}
function isadmin () {
@@ -390,7 +401,7 @@ function lista_moduli () {
= $minimo) {
return $risposta;
} else {
header("location: ".$CONF['base_url']."/index.php");
@@ -443,4 +454,14 @@ function get_levels () {
return $livelli;
}
+
+function view_top () {
+ global $CONF, $UTENTE;
+ include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/top.php");
+}
+
+function view_footer () {
+ global $CONF, $UTENTE;
+ include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/footer.php");
+}
?>
diff --git a/core/main.php b/core/main.php
index eb88ea3..feb09a4 100755
--- a/core/main.php
+++ b/core/main.php
@@ -1,9 +1,8 @@
-
@@ -12,4 +11,4 @@ $UTENTE = login();
-
+
diff --git a/modconf.php b/core/modconf.php
similarity index 97%
rename from modconf.php
rename to core/modconf.php
index d289e71..d457128 100755
--- a/modconf.php
+++ b/core/modconf.php
@@ -1,11 +1,9 @@
-
+view_top();
-
-
+
diff --git a/core/userlogin.php b/core/userlogin.php
index 08c1036..f6eb101 100755
--- a/core/userlogin.php
+++ b/core/userlogin.php
@@ -1,4 +1,4 @@
-
+
-
+
diff --git a/firewall/index.php b/firewall/index.php
new file mode 100755
index 0000000..5771ac6
--- /dev/null
+++ b/firewall/index.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/mainuser.php b/mainuser.php
deleted file mode 100755
index 1d165f6..0000000
--- a/mainuser.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Attiva
- Nome regola
-
- Banda garantita
-
- Banda massima
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/paginavuota.php b/paginavuota.php
deleted file mode 100755
index da3a3f9..0000000
--- a/paginavuota.php
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/proxy/conntrack.pl b/proxy/conntrack.pl
new file mode 100755
index 0000000..3296fe6
--- /dev/null
+++ b/proxy/conntrack.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+$|=1;
+
+use DBI;
+
+my $proxy_IP = '192.168.1.3';
+my $proxy_PORT = 3128;
+
+`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");
+$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 () {
+ my $riga = $_;
+# print "$riga";
+
+ if ( $riga =~ /^\s*\[(\d+)\.\d+\]\s+\[NEW\] tcp\s+\d+ \d+ \S*\s*src=(\S+) dst=(\S+) sport=\d+ dport=(\d+)\s+\[\w+\] src=\S+ dst=\S+ sport=\d+ dport=\d+ id=(\d+)/ ) {
+ my $remote_START = $1;
+ my $remote_IP = $2;
+ my $local_IP = $3;
+ my $local_PORT = $4;
+ my $thread_ID = $5;
+
+ my $query = " INSERT INTO
+ proxy_dati
+ (ip, thread, data_new)
+ VALUES
+ ('$remote_IP', $thread_ID, FROM_UNIXTIME($remote_START))
+ ";
+# print "$query\n";
+ $sts = $dbmysql->prepare($query);
+ $sts->execute ();
+
+# 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);
+
+ my $remote_DESTROY = $1;
+ my $remote_IP = $2;
+ my $local_IP = $3;
+ my $local_PORT = $4;
+ my $remote_SEND = $5;
+ my $remote_RECEIVE = $6;
+ my $thread_ID = $7;
+
+ print "IP: $remote_IP - ID: $thread_ID - Invati: $remote_SEND - Ricevuti: $remote_RECEIVE\n";
+
+ my $query = " UPDATE
+ proxy_dati
+ SET
+ data_destroy = FROM_UNIXTIME($remote_DESTROY),
+ inviati = $remote_SEND,
+ ricevuti = $remote_RECEIVE,
+ tempo = TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY)),
+ vel_inv = $remote_SEND / TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY)),
+ vel_ric = $remote_RECEIVE / TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY))
+ WHERE
+ thread = $thread_ID
+ AND
+ ip = '$remote_IP'
+ AND
+ data_destroy IS NULL
+ ";
+
+# print "$query\n";
+
+ $sts = $dbmysql->prepare($query);
+ $sts->execute ();
+ }
+}
+close CT;
diff --git a/proxy/index.php b/proxy/index.php
index 239edba..3ba40bd 100755
--- a/proxy/index.php
+++ b/proxy/index.php
@@ -1,17 +1,34 @@
-
-?>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
diff --git a/remove/cluster.php b/remove/cluster.php
deleted file mode 100755
index f83e200..0000000
--- a/remove/cluster.php
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IP
-
- Posizione
-
- Device
-
- Stato
-
- Utilizzo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/remove/defrule.php b/remove/defrule.php
deleted file mode 100755
index 113e207..0000000
--- a/remove/defrule.php
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 3 AND idparent = '$parent' AND idinterfacce = $device ORDER BY priorita";
- $res = mysql_query( $query, $DB_ID );
- while ($dato = mysql_fetch_array ( $res )) {
- $queryint = "SELECT count(id) AS figli FROM defrule WHERE stato<>3 AND idparent = ".$dato['id'];
- $queryrule = "SELECT COUNT(id) AS numrule FROM rule WHERE iddefrule = ".$dato['id'];
- $resint = mysql_query( $queryint, $DB_ID );
- $resrule = mysql_query( $queryrule, $DB_ID );
- $datofigli = mysql_fetch_array ( $resint );
- $datorule = mysql_fetch_array ( $resrule );
- $numfigli = $datofigli['figli'];
- $numrule = $datorule['numrule'];
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/remove/device.php b/remove/device.php
deleted file mode 100755
index b64d57c..0000000
--- a/remove/device.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/remove/gestdevice.php b/remove/gestdevice.php
deleted file mode 100644
index 51c5016..0000000
--- a/remove/gestdevice.php
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/remove/modcluster.php b/remove/modcluster.php
deleted file mode 100755
index eb35679..0000000
--- a/remove/modcluster.php
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-
- 0) {
- $testo = "L'indirizzo IP e' stato correttamente aggiornata";
- $query = "UPDATE indirizzi SET ip='$ip', netmask = $netmask, attivo = $attivo, idfirewall = $idfirewall, idinterfaccia = $idinterfaccia, commento = '$commento' WHERE `id`=$id";
- } else {
- $testo = "L'indirizzo IP e' stato correttamento inserito";
- $query = "INSERT INTO indirizzi SET ip='$ip', netmask = $netmask, attivo = $attivo, idfirewall = $idfirewall, idinterfaccia = $idinterfaccia, vf = 0, commento = '$commento'";
- }
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/remove/moddefrule.php b/remove/moddefrule.php
deleted file mode 100755
index ec37d3b..0000000
--- a/remove/moddefrule.php
+++ /dev/null
@@ -1,245 +0,0 @@
-
-
-
-
-
-
-
- 0) {
- $testo = "L'interfaccia e' stata correttamente aggiornata";
- $query = "UPDATE `defrule` SET `descrizione`='$descrizione', `priorita`=$priorita, `rate`=$rate, `ceil`=$ceil, `attivo`=$attivo WHERE `id`=$id";
- } else {
- $testo = "L'interfaccia e' stata correttamente inserita";
- $query = "INSERT INTO `defrule` SET idinterfacce=$device, `idparent`=$idparent, `descrizione`='$descrizione', `priorita`=$priorita, `rate`=$rate, `ceil`=$ceil, `stato`=1, `attivo`= 0";
- }
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/remove/moddevice.php b/remove/moddevice.php
deleted file mode 100755
index a10a4e7..0000000
--- a/remove/moddevice.php
+++ /dev/null
@@ -1,195 +0,0 @@
-
-
-
- 0) {
- $testo = "L'interfaccia e' stata correttamente aggiornata";
- $query = "UPDATE `interfacce` SET `device`='$device', `descrizione`='$descrizione', `rate`=$rate, `ceil`=$ceil, `inout`='$inout', `stato`=2 WHERE `id`=$id";
- } else {
- $testo = "L'interfaccia e' stata correttamente inserita";
- $query = "INSERT INTO `interfacce` SET `device`='$device', `descrizione`='$descrizione', `rate`=$rate, `ceil`=$ceil, `inout`='$inout', `stato`=1, `attivo`=0";
- }
-?>
-
-
-
-
-
-
- 0) {
- if ($attivo) {
- azioni ("interfacce", $id, 2);
- }
- } else {
- $iddevice = mysql_insert_id ($DB_ID);
- $querydefrule = "INSERT INTO `defrule` SET `idparent`=0, `idinterfacce`=$iddevice, `descrizione`='DEFAULT', `priorita`=1000, `rate`=$rate, `ceil`=$ceil, `stato`=1, `default`=1, `attivo`=0";
- mysql_query( $querydefrule, $DB_ID );
- }
-?>
-
-
-Non e' stato possibile eseguire l'operazione richiesta a causa di un errore:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/routing/immagini/add.png b/routing/immagini/add.png
new file mode 100644
index 0000000..092bc69
Binary files /dev/null and b/routing/immagini/add.png differ
diff --git a/routing/immagini/addlinea.png b/routing/immagini/addlinea.png
new file mode 100644
index 0000000..eaa459f
Binary files /dev/null and b/routing/immagini/addlinea.png differ
diff --git a/routing/immagini/net_card.png b/routing/immagini/net_card.png
new file mode 100644
index 0000000..e1a2187
Binary files /dev/null and b/routing/immagini/net_card.png differ
diff --git a/routing/index.php b/routing/index.php
new file mode 100755
index 0000000..1c1bebb
--- /dev/null
+++ b/routing/index.php
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/routing/linee.php b/routing/linee.php
new file mode 100755
index 0000000..bb3e1f4
--- /dev/null
+++ b/routing/linee.php
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Linea
+
+ Gateway
+
+ Priorita'
+
+ Stato
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/routing/modlinea.php b/routing/modlinea.php
new file mode 100755
index 0000000..63b14ca
--- /dev/null
+++ b/routing/modlinea.php
@@ -0,0 +1,294 @@
+ "/30 - 255.255.255.252",
+ 29 => "/29 - 255.255.255.248",
+ 28 => "/28 - 255.255.255.240",
+ 27 => "/27 - 255.255.255.224",
+ 26 => "/26 - 255.255.255.192",
+ 25 => "/25 - 255.255.255.128",
+ 24 => "/24 - 255.255.255.0",
+ 16 => "/16 - 255.255.0.0",
+ 8 => "/8 - 255.0.0.0",
+ );
+
+if (isset($_GET['id'])) {
+ $bottone = "Modifica";
+ $modifica = 1;
+ $query = "SELECT * FROM route_linee WHERE id = ".$_GET['id'];
+ $res = mysql_query( $query, $DB_ID );
+ $dato = mysql_fetch_array ( $res );
+
+ $query = "SELECT * FROM route_ip WHERE id_route_linee = ".$_GET['id'];
+ $res = mysql_query( $query, $DB_ID );
+ $quanti = mysql_num_rows ($res);
+
+} else if (isset ($_POST['id'])) {
+ $modifica = 2;
+ $id = $_POST['id'];
+ $rm = $_POST['rm'];
+ $utente = $_POST['utente'];
+ $password1 = $_POST['password1'];
+ $password2 = $_POST['password2'];
+ $admin = $_POST['admin'];
+ $attivo = $_POST['attivo'];
+ $mail = $_POST['mail'];
+
+ if (!$admin) $admin = 0;
+
+ if (!$attivo) $attivo = 0;
+
+ if (($password1 != "ahg5t!frtb5@u&^!") && ($password1 == $password2)) {
+ $querypwd = "password = MD5('$password1'),";
+ } else {
+ $querypwd = "";
+ }
+
+ if ( $rm == 1) {
+ $testo = "L'utente e' stato correttamente rimosso";
+ $query = "DELETE FROM permessi WHERE id_utenti = $id";
+ $query2 = "DELETE FROM utenti WHERE id = $id";
+ } elseif ($id > 0) {
+ $testo = "L'utente e' stato correttamente modificato";
+ $query = "UPDATE utenti SET $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), mail='$mail' WHERE `id`=$id";
+ } else {
+ $testo = "L'utente e' stato correttamente inserito";
+ $query = "INSERT INTO utenti SET utente = '$utente', $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), creazione = NOW(), mail='$mail'";
+ }
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/utenti/index.php b/utenti/index.php
index c3e15c0..cf4bc5e 100755
--- a/utenti/index.php
+++ b/utenti/index.php
@@ -1,12 +1,10 @@
-
-
-
+