在一些渗透当中,我们需要批量探针出口来达到我们的目的。

所以就有了这个丑陋简洁的小脚本。

#!/usr/bin/env python
#-*- coding:utf- -*- import sys
import threading
import httplib
import re
import time class Myclass(threading.Thread):
def __init__(self,host,path):
threading.Thread.__init__(self)
self.host = host
self.path = path
self.result = [] def run(self):
if "https://" in self.host:
conn = httplib.HTTPSConnection(self.host,,None,None,False,)
else:
conn = httplib.HTTPConnection(self.host,,False,) i_headers = {"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-Us; rv:1.9.1) Gecko/20090624 Firefox/3.5","Accept": "text/plain"}
conn.request('GET',self.path,headers = i_headers)
r1 = conn.getresponse() text = r1.read()
text1 = text.lstrip() #size = text.count("\n")
test = open('ip.txt','a+')
test.write(text1) b = open("ip.txt",'r')
c = open("ids.txt",'w')
for line in b.readlines():
m = re.search(r'(IP:\d*.\w*.\d*.\d*.\d*)',line)
mm = m.group()
owa = mm.replace("IP:","").strip().replace("\n","")
self.result = owa.replace("\n","")
c.write(self.result)
c.write("\n")
#print "write success"
g = open("ids.txt",'r')
for lines in g.readlines():
getsip = lines.replace("\n","")
try:
conns = httplib.HTTPConnection("bgp.he.net",,False,)
except Exception:
print "[-]:connection out time"
break
else:
conns.request('GET','/ip/%s' % getsip,headers = i_headers)
r2 = conns.getresponse()
texts = r2.read()
try:
line_split = re.search(r'(<u>.*\d+\D+.*.title=)',texts)
obj = line_split.group()
print "server:",obj.replace("<u>","").replace("</u>","").replace("\n","").replace("(<a href=\"","search domain:").replace("\" title=","").replace("/dns/","") except Exception, e:
pass
time.sleep()
#print line_split def main():
if len(sys.argv) < :
print "[*]:Usage python info.py 127.0.0.1 /path"
sys.exit()
Mythread = Myclass(sys.argv[],str(sys.argv[]))
Mythread.start() if __name__ == "__main__":
main()

python test.py ip /探针/1.txt

而1.txt页面为:

IP:xxx.xxx.xxx.xxx        OS:Windows x        Language:xxx        Browser:FireFox 2x.0        Referer:xxxxx        Cookies:        Time:201x-0x-xx 05:43:51 AM        id:xxxxx

因为查询的网站有限制。所以1个线程足以。

代码写的太粗糙了,见笑了。

最新文章

  1. 修改了chrome的官方的有道词典插件,添加了生词本的功能
  2. 在CentOS下安装Redis
  3. nginx做负载均衡配置文件
  4. zepto源码学习-06 touch
  5. fcntl记录锁实例
  6. android中网络操作使用总结(http)
  7. Ubuntu12.04 下修改Apache端口号
  8. hdu 1253 胜利大逃亡_三维
  9. 【稳定婚姻问题】【HDU1435】【Stable Match】
  10. apache cxf笔记之Spring客户端访问和调用webservice服务
  11. memcached添加IP白名单,只允许指定服务器调用
  12. Android launcher 壁纸 wallpaper
  13. System.IO在不存在的路径下创建文件夹和文件的测试
  14. 使用 AppScan 进行扫描
  15. jsp 标签文件
  16. 【Java】类加载过程
  17. web(六)css的基本语法、取值与单位
  18. Spring 注解bean默认名称规则
  19. [TJOI2013]拯救小矮人
  20. PyMongo基本使用

热门文章

  1. 教程less
  2. Openstack创建镜像
  3. delphi xe-intarweb 功能记录
  4. JS不改HTML任何代码就达到动态效果
  5. PHP的几种排序方法
  6. 11.Query an Array of Embedded Documents-官方文档摘录
  7. tomcat 是如何处理jsp和servlet请求
  8. discuz手机版图片缩略图大小设置/修改清晰度
  9. PAT 1035 Password [字符串][简单]
  10. 【教程】Microsoft Visual Studio 2015 安装Android SDK