zoukankan      html  css  js  c++  java
  • Perl 旁站查询(站长工具提取)

    感谢V总教会我用brupsuite.谢谢这位没有任何脾气的大牛。。这个软件说实话真不是很会用,纯英文比较蛋疼。。。刚学会使用,抓包写了个旁站查询的小玩具,大牛见笑了~

    原始的数据包如下:

    POST /Same/ HTTP/1.1
    Host: tool.chinaz.com
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0)
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: zh-cn,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate
    Referer: http://tool.chinaz.com/Same/
    Connection: keep-alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 13
    
    s=www.163.com

    Perl写出的工具如下:

    #!/usr/bin/perl
    use LWP::UserAgent;
    use HTTP::Request;
    use HTTP::Response;
    use HTTP::Request::Common;
    print "Set the URL:";
    chomp($task_name=<STDIN>);
    $agent=new LWP::UserAgent;
    $request=POST('http://tool.chinaz.com/Same/',[s=>$task_name]);
    $request->header('User-Agent'=>'Mozilla/5.0 (X11; Linux x86_64; rv:18.0)');
    $request->header('Accept-Encoding'=>'zh-cn,en-us;q=0.7,en;q=0.3');
    $response=$agent->request($request);
    if($response->is_success){
        $url_tmp=$response->content;
        if($url_tmp=~m#<ul><li><span>(.*)</li></ul>#){
            grep_task($1);
        }
    
    }else{
        print "Error!!\n";
    }
    #grep of the task url.
    sub grep_task{
        local($url_other)=shift;
        @other_list=split(/<li>/,$url_other);
        foreach my $url(@other_list){
            if($url=~m#href='(.*)'#){
                print "URL:$1\n";
            }
        }
    }

    这个脚本主要用到的是一些未曾用过的模块,就当练习了~谢谢V总~V总威武。。。:)

    使用后的结果:

    smart@smart:~/perl$ ./PostWeb2.pl 
    Set the URL:www.163.com
    URL:http://www.sihongfeng.com
    URL:http://imga5.4399.com
    URL:http://xiuxiu.dl.meitu.com
    URL:http://www.4m6m.com
    URL:http://mimg.126.net
    URL:http://ci.aizhan.com
    URL:http://my.91wan.com
    URL:http://swf.games.sina.com.cn
    URL:http://img.t.sinajs.cn
    URL:http://www.qq937.com
    URL:http://xy.163.com
    URL:http://xiuxiu.meitu.com
    URL:http://icp.aizhan.com
    URL:http://www.kan300.com
    URL:http://lifestyle.rayli.com.cn
    URL:http://images4.tuniucdn.com
    URL:http://www.kkgame.cn
    URL:http://mimg.127.net
    URL:http://163mail.help.163.com
  • 相关阅读:
    BZOJ 3236 AHOI 2013 作业 莫队算法
    使用再哈希算法查找元素
    冰雪奇缘--用爱酿就一部经典
    Scrapy系列教程(2)------Item(结构化数据存储结构)
    html学习笔记二
    知方可补不足~sqlserver中触发器的使用
    我心中的核心组件(可插拔的AOP)~调度组件quartz.net
    EF架构~为BulkInsert引入SET IDENTITY_INSERT ON功能
    知方可补不足~sqlserver中使用sp_who查看sql的进程
    知方可补不足~为千万级数据表加索引
  • 原文地址:https://www.cnblogs.com/xiaoCon/p/2989808.html
Copyright © 2011-2022 走看看