这篇文章主要介绍“怎么从apnic提取ip信息”,在日常操作中,相信很多人在怎么从apnic提取ip信息问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么从apnic提取ip信息”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
代码如下:
#!/bin/bash# download from apnicrm -f delegated-apnic-latestwget http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest# IPs allocated to china.grep 'apnic|CN|ipv4|' delegated-apnic-latest | cut -f 4 -d'|' > delegated-apnic-CN# get detail of echo IP from apnic database.rm -f apnic_CN.txtwhile read ipdo # query apnic database echo "query who is $ip" whois -h whois.apnic.net $ip > tmp.txt grep inetnum tmp.txt >> apnic_CN.txt # IP range grep netname tmp.txt >> apnic_CN.txt # netname which include sp information grep descr tmp.txt >> apnic_CN.txt # description which include province information echo "" >> apnic_CN.txt done < delegated-apnic-CN# clean uprm -f tmp.txtrm -f delegated-apnic-latestrm -f delegated-apnic-CN
到此,关于“怎么从apnic提取ip信息”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程网网站,小编会继续努力为大家带来更多实用的文章!