perl版 Webshell存活检测

原理:
检测url返回状态即可

源码:

 1 #!c:\\perl\\bin\\perl.exe
 2 use warnings;
 3 use strict;
 4 use LWP::UserAgent;
 5 $| = 1;
 6 print "---------------------------------------------------------\n";
 7 print "|              Webshell online check v1.0               |\n";
 8 print "---------------------------------------------------------\n";
 9 print "|                                                       |\n";
10 print '|              Power by :FireC@t                        |'."\n";
11 print "|              bbs:www.script-toolf.info                |\n";
12 print "|                                                       |\n";
13 print "---------------------------------------------------------\n";
14 my $ua = LWP::UserAgent->new();
15 $ua->timeout(5);
16 my $ok = 'OK';
17 my $false = 'False';
18 while(1){
19     print "---------------------------------------------------------\n";
20     open FILE, "<", "webshell.txt" or die "webshell file open error:$!\n";
21     foreach(<FILE>){
22         chomp;
23         if($_ !~ m#^http#i){$_ = 'http://'.$_;}
24         my $req = HTTP::Request->new(GET => "$_");
25         my $rep = $ua->request($req);
26         if($rep->status_line =~ /200/){
27             print "Yes --> $_\n";
28         }else{
29             print " No --> $_\n";
30         }
31     }
32     close FILE;
33     print "---------------------------------------------------------\n";
34     print "Ctrl+c to exit\nThe Next Check after 30sec please waite.....\n";
35     sleep(30);
36     system('cls');
37     #system('clear');
38 }
39  
40 print "press any key to continue";
41 getc();

 

 

#等有时间优化一下
#注意, 这个是用于win版本, 因为开头的#!路径, 还有就是system(‘cls’)用于WIN, 如果是linux的话
#请修改system(‘cls’)为system(‘clear’)
#再把开头的#!c:\\perl\\bin\\perl.exe修改为相应的perl路径
#
#

转载于:https://www.cnblogs.com/perl6/p/6120058.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值