再某一网站找安卓游戏时,使用站内搜索;点击搜索之后竟然跳到百度 使用site:www.xxx.com 方式搜索,很偷懒,但是很聪明,
那我们就用IP138来做IP地址查询的库吧
#!/bin/bash
ipp (){
exec < $1
while read a
do
sring=`curl -s "http://ip138.com/ips138.asp?ip=${a}&action=2" |grep '<ul class="ul1"><li>' |awk -F'[><]+' '{
print $5}'`
echo $a $sring
done
}
case $1 in
-f)
shift
ipp $1
;;
-i)
shift
sring=`curl -s "http://ip138.com/ips138.asp?ip=${1}&action=2" |grep '<ul class="ul1"><li>' |awk -F'[
><]+' '{print $5}'`
echo $1 $sring
;;
*)
echo "[Help]
$0 need -f or -i
-f ------- argument is a file
-i ------- argument is a IP
[For example]:
$0 -f filename
$0 -i ipadress
"
;;
esac
本文介绍了一个用于查询IP地址信息的Shell脚本实现方法。该脚本通过调用ip138.com的服务来获取并打印出指定IP地址的相关地理位置信息。支持从文件中批量读取IP地址进行查询。
3236

被折叠的 条评论
为什么被折叠?



