Perl uses the IP138 Web site to query IP attribution script sharing _perl

Source: Internet
Author: User
Tags perl script

This is a Perl script written last year, and I haven't seen Perl since years ago.

Copy Code code as follows:

#!/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, $;
}
}
}
Close (FILE);

The file files are formatted as follows

Copy Code code as follows:

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

Results

Copy Code code as follows:

Perl ip138.pl

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.