#!/bin/bash
for i in `cat /root/ip/1.txt`
do
ip_address=`curl -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" \
-s "http://ip138.com/ips138.asp?ip="$i"&action=2" |\
iconv -f gb2312 -t utf-8 |\
grep "class" |\
awk '{n=split($0,a,"<li>");for(i=2;i<n;i++) print a[i]}' |\
sed 's/<\/li>//g' |\
sed -n '1p;3p'`
echo -e $i "\n" $ip_address >> /root/ip/2.txt
done
linux批量查询ip归属地
最新推荐文章于 2024-03-12 22:51:50 发布