raga, sto costruendo una specie di sentinel..ecco il codice ke ho creato fin ora..
ho usato un file di testo cm database..però nn so se funziona...ke ne dite?? potrebbe andare??
PHP:
sentinel.php
<?
$date = date("m/d/Y H:i:s");
$browser = $_SERVER['HTTP_USER_AGENT'];
$sitename = "prova sentinel";
$adminaddress = "mia@email.it";
$ip = $_SERVER['REMOTE_ADDR'];
$stringa = $_SERVER['QUERY_STRING'];
$host = $_SERVER['HTTP_HOST'];
$file = $_SERVER['PHP_SELF'];
$path = "$host$file?$stringa";
$ip = $_SERVER['REMOTE_ADDR'];
$stringa = strtolower($stringa);
$maligno1 = 'http';
$maligno2 = 'www.';
$maligno3 = 'script';
$maligno4 = 'FROM';
$maligno5 = 'SELECT';
$maligno6 = 'WHERE';
$maligno7 = 'UNION';
$maligno8 = 'phpbb_';
$maligno9 = 'ftp';
$maligno10 = 'https';
$finder_maligno1 = ereg($stringa, $maligno1);
$finder_maligno2 = ereg($stringa, $maligno2);
$finder_maligno3 = ereg($stringa, $maligno3);
$finder_maligno4 = ereg($stringa, $maligno4);
$finder_maligno5 = ereg($stringa, $maligno5);
$finder_maligno6 = ereg($stringa, $maligno6);
$finder_maligno7 = ereg($stringa, $maligno7);
$finder_maligno8 = ereg($stringa, $maligno8);
$finder_maligno9 = ereg($stringa, $maligno9);
$finder_maligno10 = ereg($stringa, $maligno10);
if ($finder_maligno1 >= 1 OR $finder_maligno2 >= 1 OR $finder_maligno3 >= 1 OR $finder_maligno4 >= 1 OR $finder_maligno5 >= 1 OR $finder_maligno6 >= 1 OR $finder_maligno7 >= 1 OR $finder_maligno8 >= 1 OR $finder_maligno9 >= 1 OR $finder_maligno10 >= 1) {
echo " Hai tentato un attacco al sito.. Il tuo IP è stato loggato: $ip<br>";
echo "ed è appena stato inviato alle autorità competenti.";
mail("$adminaddress","Attacco sito prova ", "FAO: Admin @ $sitename \n
IP attaccante: $ip
Ha usato: $stringa
File: $file
Host: $host
Browser Usato: $browser
Data: $date","FROM:$adminaddress");
$open = fopen ("prova.txt","w+");
fwrite ($open, $ip);
fclose ($open);
}
else
?>
e poi qst da mettere su tutte le pagine:
<?
$ip = $_SERVER['REMOTE_ADDR'];
$ip2 = fopen ("prova.txt","r");
fread ($ip2);
fclose ($ip);
if ($ip == $ip2) {
echo " NON PUOI ACCEDERE";
}
else
bla bla bla..tutto quello ke vuoi!!!
?>