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

 

转载于:https://www.cnblogs.com/xiaoCon/archive/2013/03/29/2989808.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值