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路径
#
#

posted on   Perl6  阅读(763)  评论(0编辑  收藏  举报

编辑推荐:
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
· 对象命名为何需要避免'-er'和'-or'后缀
· SQL Server如何跟踪自动统计信息更新?
· AI与.NET技术实操系列:使用Catalyst进行自然语言处理
阅读排行:
· 官方的 MCP C# SDK:csharp-sdk
· 一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
· 提示词工程师自白:我如何用一个技巧解放自己的生产力
· 一文搞懂MCP协议与Function Call的区别
· 如何不购买域名在云服务器上搭建HTTPS服务

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示