| Server IP : 172.64.80.1 / Your IP : 172.70.50.62 Web Server : Apache System : Linux mail.federalpolyede.edu.ng 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 User : federalpolyede.edu.ng_idh35skikv ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/federalpolyede.edu.ng/httpdocs_backup/phpStuff/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: adisa
* Date: 07/07/2022
* Time: 04:43
*/
ini_set('memory_limit', '4024M');
$intensity=0;
$counter0=$counter1=$counter2=0;
//die();
require_once('../connect.php');
$db=db_connect();
$sql="select * from securitytb where sn not in (select ID from attackintesity) limit 20000";
$sql_exe=$db->query($sql);
$k=0;
while ($sql_fetch=$sql_exe->fetch(PDO::FETCH_BOTH)) {
$sn = $sql_fetch['sn'];
// die();
// echo '--';
$username = $sql_fetch['username'];
$password = $sql_fetch['password'];
$ipaddress = $sql_fetch['ipaddress'];
$timest = $sql_fetch['timest'];
$ipaddress2 = $sql_fetch['ipaddress2'];
// $sta = $sql_fetch['sta'];
$sn=$sql_fetch['sn'];
if ($sta == 1) {
$intensity = 0;
$counter0+=1;
$k=0;
} else {
$sql2 = "select * from securitytb where ipaddress='$ipaddress' and sn<'$sn' and sta=1";
$sql2_exe = $db->query($sql2);
if ($sql2_exe->rowCount() > 5) {
$intensity = 1;
$k+=1;
$counter1+=1;
if (($k>=5) and ($sql2_exe->rowCount()>5)) {
if ($k==5){
$timeSTART=$timest;
// $timeEND = date($timeSTART, time() + 30);
// die();
// echo $timeEND=$timeEND->modify('+30 minutes');
$timeEND= date('Y-m-d H:i:s', strtotime($timeSTART. ' +30000 second'));
// die();
}
$sql21 = "select * from securitytb where ipaddress='$ipaddress' and sn<'$sn' and timest>='$timeSTART' and timest<='$timeEND'";
// die();
$sql21_exe = $db->query($sql21);
if ($sql21_exe->rowCount()>3){
$intensity=2;
$counter2+=1;
// die();
}else{
$intensity=1;
$counter1+=1;
}
}
} else {
$intensity = 0;
$k=0;
$counter0+=1;
}
}
// echo '=>'.$intensity.'===k'.$k.'==>'.$ipaddress;
// echo '<br>';
if ($sta==''){
$sta=0;
}
require_once('model_fetch.php');
$attack="INSERT INTO `attackIntesity` (`sn`, `ipAdd`, `intensity`, `attackStatus`,`ID`) VALUES (NULL, '$ipaddress', '$intensity', '$sta',$sn);";
$db->query($attack);
// $k=0;
// if ($intensity==2){
// echo $timeSTART.'ugtutiug';
// echo '<br>';
// echo $timeEND;
// die();
// }
}
echo "======================SUMMARY=============================";
echo '<br> No Attack--->'.$counter0;
echo '<br>Low Intensity Attack--->'.$counter1;
echo '<br>High Intensity Attack--->'.$counter2;