Scan File-file Backdoor di situs anda
#1
kembali lagi ketemu ama ane .... kali ini ane mau share tentang script php yang mungkin berguna buat pertahanan situs kita ...

script ini akan menscan file2 yang ada di root yang di curigai atau berpotensi sebagai shell

Spoiler! :
PHP Code:
#!/usr/bin/php
<?php
/*
*    this script find some shell like
*    c99, c100, r57, erne, Safe_Over
*    and try to find some of unknow shell searching specific words this can be
*    not safe
*
*      how to use:
*      the script don't need no-one of these parameter thay are facoltative
*      -e Y/N enable disable eusristic mode (default is enable)
*      -p a number 1-100 , it's the percentual of word that must be find into the file to warm the euristic mode
*      -f check a single file
*     -d check a single dir (normaly the program is recursive chek ALL file )
*        powered by Dr. nefasto
*/
$euristic__ = array("fopen""file(""file_get_contents""sql""opendir""perms"

"port""eval""system""exec""rename""copy""delete""hack""(\$_""phpinfo"

"uname""glob""is_writable""is_readable""get_magic_quotes_gpc()"

"move_uploaded_file""\$dir""& 00""get");
$word__ = array(
            
"c99" => array("c999shexit();""setcookie(\"c999sh_surl\");""c999_buff_prepare();"),
            
"c100" => array("\$back_connect_c=\"f0VMRgEBAQA""function myshellexec(\$command) {""tEY87ExcilDfgAMhwqM74s6o"),
            
"r57" => array("if(strpos(ex(\"echo abcr57\"),\"r57\")!=3)""function ex(\$cfe)""\$port_bind_bd_c=\"I2luY2x1ZGUg"),
            
"erne"=> array("function unix2DosTime(\$unixtime = 0)""eh(\$errno, \$er""\$mtime=@date(\"Y-m-d H:i:s\",@filemti"),
            
"Safe_Over" => array("function walkArray(\$array){""function printpagelink(\$a, \$b, \$link = \"\")""if (\$cmd != \"downl\")"),
            
"cmd_asp" => array("   ' -- Read th""ll oFileSys.D""Author: Maceo")
        );
//the script work
$euristic_active true;
$euristic_sens 40;
for (
$i 1$i $argc$i++)
{
    if (
$argv[$i] == "-h")
        
help($argv[0]);
    elseif(
$argv[$i] == "-e")
    {
        if (
$argv[$i+1] == "Y"$euristic_active true;
        if (
$argv[$i+1] == "N"$euristic_active false;
    }
    elseif(
$argv[$i] == "-p")
        
$euristic_sens $argv[$i+1];
    elseif(
$argv[$i] == "-d")
    {
        
dir_scan($argv[$i+1]);    
        exit;
    }
    elseif(
$argv[$i] == "-f")
    {
        
a($argv[$i+1]);    
        exit;
    }
}
dir_scan(".");
function 
dir_scan($name)
{
    if (!
is_dir($name))
        echo 
"$name is not a dir\n"
    if (
$o = @opendir($name))
    {
        while(
false !== ($file readdir($o)))
        {
            if (
$file == '.' or $file == '..' or $file == basename(__file__)){    continue;}
            else if (
is_dir($name."/".$file)){dir_scan($name."/".$file);}
            else
                
a($name."/".$file);
        }
        
closedir($o);
    }
    else
        echo 
"i can't open $name dir\n";
}
function 
a($file)
{
    global 
$euristic_active;
    global 
$euristic_sens;
    if (
$l file_get_contents($file))
    {
        if ( 
$shell check($l))
        {
            echo 
"[DANGER] word_list > ".$file."\tprobably ".$shell." shell\n";
        } 
        else if (
$euristic_active)
            if (
$t check_euristic($l)   and $t $euristic_sens)
            {    
                echo 
"[_ALERT] euristic $t%> ".$file."\tprobably is a shell\n";
            }
    }
    else
    {
        echo 
"i can't open $file file\n";
    }
}
function 
check($string)
{
    
$check 0;
    global 
$word__;
    foreach(
$word__ as $shell => $code)
        foreach(
$code as $microcode)
            if (
stripos($string$microcode) !== false)
            {
                
$check ++;
                if (
$check == 3) return $shell;
            }
    return 
false;
}
function 
check_euristic($string)
{
    global 
$euristic__;
    
$check 0;
    foreach(
$euristic__ as $code)
        if (
stripos($string$code) !== false)
            
$check++;
    return 
intval(($check 100) / count($euristic__));
}
function 
help($me)
{
    echo     
"indonesianhacker shell scanner\n".
        
"$me {-e [euristic method default = Y] Y/N   -p [[0-100] euristic sensibility fewer == most feeble ]   [-d [directory] / -f [file] ]}\n".
        
"exemple: $me -e N -d /tmp\n"
        
;
    exit;
}
?>

simpan dengan nama amankan.php ato serah ente dah
panggil url nah ... http://situslo/amankan.php
ntar tinggal liat hasilnah....

nb : berfungsi pada folder di mana dia ditempatkan... dan tidak jalan pada server windows...
FOLLOW @DutaLinux
for more question and sharing about security and Opensource only

#2
mantab om zee, ane iji copas coding nya.....
tq

#3
ane coba dulu ya mas broo ntar ane balik lagi kesini . . .

#4
Big Grin ampuh kk, ane pernah nyoba di hotingan gratisss ane :d

#5
Wlopun ga begitupaham yang pentin Mantab om, lanjutkan !!!

#6
thanx om... ijin copas

#7
Thanks om zee,mantep nih

#8
thx om dan izin .. mengunakannya om ...

#9
(05-09-2011, 04:28 AM)3plex Wrote: ane coba dulu ya mas broo ntar ane balik lagi kesini . . .
udah di coba om??
(06-01-2011, 10:13 PM)d1d1 Wrote: Big Grin ampuh kk, ane pernah nyoba di hotingan gratisss ane :d
hahaha iya pasti itu
(06-28-2011, 11:33 AM)md-holic Wrote: Wlopun ga begitupaham yang pentin Mantab om, lanjutkan !!!
haha silahkan di pelajari om
(06-29-2011, 12:21 AM)mota Wrote: thanx om... ijin copas
jangan lupa source alias sumbernya om
(06-29-2011, 07:42 AM)Abdullah Wrote: Thanks om zee,mantep nih
hahaha mantab om
(07-04-2011, 04:34 PM)dedexz Wrote: thx om dan izin .. mengunakannya om ...
mantab om Big Grin

#10
(04-25-2011, 05:18 PM)zee eichel Wrote: kembali lagi ketemu ama ane .... kali ini ane mau share tentang script php yang mungkin berguna buat pertahanan situs kita ...

script ini akan menscan file2 yang ada di root yang di curigai atau berpotensi sebagai shell

Spoiler! :
PHP Code:
#!/usr/bin/php
<?php
/*
*    this script find some shell like
*    c99, c100, r57, erne, Safe_Over
*    and try to find some of unknow shell searching specific words this can be
*    not safe
*
*      how to use:
*      the script don't need no-one of these parameter thay are facoltative
*      -e Y/N enable disable eusristic mode (default is enable)
*      -p a number 1-100 , it's the percentual of word that must be find into the file to warm the euristic mode
*      -f check a single file
*     -d check a single dir (normaly the program is recursive chek ALL file )
*        powered by Dr. nefasto
*/
$euristic__ = array("fopen""file(""file_get_contents""sql""opendir""perms"

"port""eval""system""exec""rename""copy""delete""hack""(\$_""phpinfo"

"uname""glob""is_writable""is_readable""get_magic_quotes_gpc()"

"move_uploaded_file""\$dir""& 00""get");
$word__ = array(
            
"c99" => array("c999shexit();""setcookie(\"c999sh_surl\");""c999_buff_prepare();"),
            
"c100" => array("\$back_connect_c=\"f0VMRgEBAQA""function myshellexec(\$command) {""tEY87ExcilDfgAMhwqM74s6o"),
            
"r57" => array("if(strpos(ex(\"echo abcr57\"),\"r57\")!=3)""function ex(\$cfe)""\$port_bind_bd_c=\"I2luY2x1ZGUg"),
            
"erne"=> array("function unix2DosTime(\$unixtime = 0)""eh(\$errno, \$er""\$mtime=@date(\"Y-m-d H:i:s\",@filemti"),
            
"Safe_Over" => array("function walkArray(\$array){""function printpagelink(\$a, \$b, \$link = \"\")""if (\$cmd != \"downl\")"),
            
"cmd_asp" => array("   ' -- Read th""ll oFileSys.D""Author: Maceo")
        );
//the script work
$euristic_active true;
$euristic_sens 40;
for (
$i 1$i $argc$i++)
{
    if (
$argv[$i] == "-h")
        
help($argv[0]);
    elseif(
$argv[$i] == "-e")
    {
        if (
$argv[$i+1] == "Y"$euristic_active true;
        if (
$argv[$i+1] == "N"$euristic_active false;
    }
    elseif(
$argv[$i] == "-p")
        
$euristic_sens $argv[$i+1];
    elseif(
$argv[$i] == "-d")
    {
        
dir_scan($argv[$i+1]);    
        exit;
    }
    elseif(
$argv[$i] == "-f")
    {
        
a($argv[$i+1]);    
        exit;
    }
}
dir_scan(".");
function 
dir_scan($name)
{
    if (!
is_dir($name))
        echo 
"$name is not a dir\n"
    if (
$o = @opendir($name))
    {
        while(
false !== ($file readdir($o)))
        {
            if (
$file == '.' or $file == '..' or $file == basename(__file__)){    continue;}
            else if (
is_dir($name."/".$file)){dir_scan($name."/".$file);}
            else
                
a($name."/".$file);
        }
        
closedir($o);
    }
    else
        echo 
"i can't open $name dir\n";
}
function 
a($file)
{
    global 
$euristic_active;
    global 
$euristic_sens;
    if (
$l file_get_contents($file))
    {
        if ( 
$shell check($l))
        {
            echo 
"[DANGER] word_list > ".$file."\tprobably ".$shell." shell\n";
        } 
        else if (
$euristic_active)
            if (
$t check_euristic($l)   and $t $euristic_sens)
            {    
                echo 
"[_ALERT] euristic $t%> ".$file."\tprobably is a shell\n";
            }
    }
    else
    {
        echo 
"i can't open $file file\n";
    }
}
function 
check($string)
{
    
$check 0;
    global 
$word__;
    foreach(
$word__ as $shell => $code)
        foreach(
$code as $microcode)
            if (
stripos($string$microcode) !== false)
            {
                
$check ++;
                if (
$check == 3) return $shell;
            }
    return 
false;
}
function 
check_euristic($string)
{
    global 
$euristic__;
    
$check 0;
    foreach(
$euristic__ as $code)
        if (
stripos($string$code) !== false)
            
$check++;
    return 
intval(($check 100) / count($euristic__));
}
function 
help($me)
{
    echo     
"indonesianhacker shell scanner\n".
        
"$me {-e [euristic method default = Y] Y/N   -p [[0-100] euristic sensibility fewer == most feeble ]   [-d [directory] / -f [file] ]}\n".
        
"exemple: $me -e N -d /tmp\n"
        
;
    exit;
}
?>

simpan dengan nama amankan.php ato serah ente dah
panggil url nah ... http://situslo/amankan.php
ntar tinggal liat hasilnah....

nb : berfungsi pada folder di mana dia ditempatkan... dan tidak jalan pada server windows...


trima kasih sekali buat share nya yg amat bermanfaat ini kak,boleh saya share scriptnya buat kwn2 saya yg punya web jg gak??tentunya dg syarat asal dari script ini gak akan di lupakan,boleh kak??






Users browsing this thread: 2 Guest(s)