| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Hackers Alert/ |
Upload File : |
<?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
date_default_timezone_set('Europe/Athens');
require_once("phpmailer/class.phpmailer.php");
$checkedfolders = array("C:\inetpub/wwwroot/userfiles",
"C:\inetpub/wwwroot/Topogeo/userfiles",
"C:\inetpub/wwwroot/business/sites/default/files",
"C:\inetpub\wwwroot/business/mpa/wp-content/uploads",
"C:\inetpub\wwwroot/business/pms/sites/default\files",
"C:\inetpub/wwwroot/cdc/wp-content/uploads",
"C:\inetpub/wwwroot/cdc/ai4fashion22/wp-content/uploads",
"C:\inetpub\wwwroot/cdc/ai4fashion24/wp-content/uploads",
"C:\inetpub/wwwroot/Civil/userfiles",
"C:\inetpub/wwwroot/engineering/iimec/wp-content/uploads",
"C:\inetpub/wwwroot/engineering/wp-content/uploads",
"C:\inetpub/wwwroot/icd/mscinformatics2022/wp-content/uploads",
"C:\inetpub/wwwroot/icd/labs/output",
"C:\inetpub/wwwroot/Civil/civil/pms/wp-content/uploads",
"C:\inetpub/wwwroot/aecm.ihu.gr/wp-content/uploads",
"C:\inetpub/wwwroot/finman.es.ihu.gr/wp-content/uploads",
"C:\inetpub/wwwroot/ia/wp-content/uploads",
"C:\inetpub/wwwroot/prosvasi/wp-content/uploads",
"C:\inetpub/wwwroot/stirizo/wp-content/uploads");
$excludefolders = array("C:\inetpub/wwwroot/engineering/wp-content/uploads/cache");
$filesfound = array();
foreach ($checkedfolders as $checkedfolder)
{
if (is_dir($checkedfolder)) {
echo "Checking: ".$checkedfolder."\n";
listFolderFiles($checkedfolder);
}
}
if ($filescount=count($filesfound))
{
$to ="nocserres@ihu.gr";
$from = "nocserres@ihu.gr";
$sender_name = "NocSerres - Σαββας Πασχαλίδης";
$subject = "Προειδοποίηση για πιθανό hacking της Κεντρικής Ιστοσελίδας";
$headers = "From: nocserres@ihu.gr\r\n";
$message = "Προσοχή! Πιθανόν ο Web Server 1 του ΔΙΠΑΕ Σερρών να έχει πέσει θύμα επίθεσης από hacker.<br>";
$message .= "<br>Υπάρχουν ".$filescount." αρχεία php σε φακέλους uploads:<br>";
$message .= "----------------------------------------------------------------------------------------";
foreach ($filesfound as $filename)
{
$message .= "<br>$filename";
echo "Malicius file found: ".$filename."\n";
}
$message .= "<br>----------------------------------------------------------------------------------------<br>";
$message .= "Τα αρχεία μετονομάστηκαν με την κατάληξη .sos";
echo "Sending email...\n";
$sentstatus = sendEmail($to, $subject, $message, $from, $sender_name);
echo "Sentstatus: ".$sentstatus;
} else {
echo "No malicious files found.";
}
function listFolderFiles($dir){
global $filesfound, $excludefolders;
$ffs = scandir($dir);
foreach($ffs as $ff)
{
if($ff != '.' && $ff != '..')
{
if(is_dir($dir.'/'.$ff))
{
if (in_array($dir.'/'.$ff, $excludefolders))
continue;
listFolderFiles($dir.'/'.$ff);
}
else
{
$file_path = "$dir/$ff";
$file_type = strtolower(pathinfo($ff, PATHINFO_EXTENSION));
if ($file_type == "php" or $file_type == "asp" or $file_type == "aspx")
{
// Ειδικός έλεγχος αν το αρχείο ονομάζεται index.php
if (strtolower($ff) === 'index.php') {
$file_size = filesize($file_path);
// Αν το μέγεθος είναι μικρότερο από 250 bytes, κάνουμε έναν γρήγορο έλεγχο περιεχομένου
if ($file_size < 250) {
$content = file_get_contents($file_path);
// Ύποπτες συναρτήσεις που χρησιμοποιούν οι hackers για backdoors
$suspicious_patterns = array('eval', 'base64_decode', 'shell_exec', 'system', 'passthru', 'popen');
$is_malicious = false;
foreach ($suspicious_patterns as $pattern) {
if (stripos($content, $pattern) !== false) {
$is_malicious = true;
break;
}
}
// Αν δεν βρέθηκε τίποτα ύποπτο και το αρχείο είναι μικρό, το προσπερνάμε με ασφάλεια
if (!$is_malicious) {
continue;
}
}
}
// Αν φτάσει εδώ, είτε είναι άλλο PHP αρχείο, είτε είναι index.php που κρίθηκε ύποπτο
$filesfound[] = $file_path;
@rename($file_path, "$file_path.sos");
}
}
}
}
}
// Χρησιμοποιεί την PHPMailer() για να στείλει email σε πολλαπλούς παραλήπτες (μεταβλητή $recipients, χωρισμένοι με κόμματα), σε UTF-8 κωδικοποίηση, και με SMTP authentication
function sendEmail($recipients, $subject, $msghtml, $fromaddress, $fromname, $altbody="", $attachments="")
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->SMTPKeepAlive = true;
$mail->Host = "smtp.office365.com";
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "nocserres@ihu.gr"; // SMTP account username
$mail->Password = "*3r3v0$*"; // SMTP account password
$mail->CharSet = "utf-8";
$mail->SetFrom($fromaddress, $fromname);
$mail->AddReplyTo($fromaddress, $fromname);
$mail->IsHTML(true);
$mail->Subject = $subject;
$recipients_array = explode(",",$recipients);
foreach ($recipients_array as $recipient)
$mail->AddAddress(trim($recipient));
if ($altbody=="auto")
$mail->AltBody = $this->stripHTMLTags($msghtml,"");
else if ($altbody!="")
$mail->AltBody = $altbody;
$mail->Body = $msghtml;
if ($attachments!="")
{
if (is_array($attachments))
{
if (count($attachments)>0)
{
foreach($attachments as $attachment)
{
$mail->AddAttachment($attachment);
}
}
}
else
{
$mail->AddAttachment($attachments);
}
}
if(!$mail->Send()) {
return $mail->ErrorInfo;
} else {
return true;
}
}
?>