• perl版 Webshell存活检测


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

    源码:

     1 #!c:\perl\bin\perl.exe
     2 use warnings;
     3 use strict;
     4 use LWP::UserAgent;
     5 $| = 1;
     6 print "---------------------------------------------------------
    ";
     7 print "|              Webshell online check v1.0               |
    ";
     8 print "---------------------------------------------------------
    ";
     9 print "|                                                       |
    ";
    10 print '|              Power by :FireC@t                        |'."
    ";
    11 print "|              bbs:www.script-toolf.info                |
    ";
    12 print "|                                                       |
    ";
    13 print "---------------------------------------------------------
    ";
    14 my $ua = LWP::UserAgent->new();
    15 $ua->timeout(5);
    16 my $ok = 'OK';
    17 my $false = 'False';
    18 while(1){
    19     print "---------------------------------------------------------
    ";
    20     open FILE, "<", "webshell.txt" or die "webshell file open error:$!
    ";
    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 --> $_
    ";
    28         }else{
    29             print " No --> $_
    ";
    30         }
    31     }
    32     close FILE;
    33     print "---------------------------------------------------------
    ";
    34     print "Ctrl+c to exit
    The Next Check after 30sec please waite.....
    ";
    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路径
    #
    #

  • 相关阅读:
    ORM模型框架(使用mysql)
    Python操作Mysql
    Jmeter操作数据库
    .NetCore+OpenSSL实现Https
    深入理解Https如何保证通信安全
    关于数据库事务和锁的一些分析
    C# Task.Run与Task.Factory.StartNew
    WPF 元素代理解决MVVM模式下DataGridColumn绑定无效问题
    WPF DataGrid行拖拽
    C#集合Clear()和new的性能差异
  • 原文地址:https://www.cnblogs.com/perl6/p/6120058.html
Copyright © 2020-2023  润新知