perl中使用ip138网站查询ip归属地脚本分享

2023-12-08 0 983

这是去年年前写的一个perl脚本 哎 年后都没看过perl了。

复制代码 代码如下:
#!/usr/bin/perl
use LWP::Simple;
open (FILE,”<file”);
while(<FILE>){
s/^IP1.*//g;
my @file =split(/\\,|\\s+/,$_);
my @file1=”$file[0] $file[1]“;
my $IP =”$file[1]” ;
my $domain=”$file[0]“;
my $url=”http://ip138.com/ips138.asp?ip=$IP&action=2″;
my $connet =get(“$url”);
my @connet =split(/\\n/,$connet);
foreach my $sc (@connet){
if($sc =~ m/td align=”center”><ul><li>(.*?)<.*/){
printf “%-40s %-20s %s\\n”,$domain,$IP,$1 ;
}
}
}
close(FILE);

file 文件的格式 如下
复制代码 代码如下:
conf.f.360.cn 113.105.246.71,113.105.246.78
u.qurl.f.360.cn 218.30.117.155,218.30.117.156
config.dengluqi.net 127.0.0.1
www.sina.com 61.172.201.194,61.172.201.195
dns.msftncsi.com 131.107.255.255
ptlogin2.qq.com 222.73.82.34

结果
复制代码 代码如下:
perl ip138.pl

perl中使用ip138网站查询ip归属地脚本分享

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 Perl perl中使用ip138网站查询ip归属地脚本分享 https://www.u-9.cn/jiaoben/perl/145056.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务