python旁站查询

  • A+
所属分类:安全文章
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Lcy # @Date:   2015-07-22 10:41:17 # @Last Modified by:   Lcy # @Last Modified time: 2015-07-22 10:49:44 import urllib2 import re import sys import socket  def curl(ip,first):         #设置国外ip代理,不设置的话是查不到的..         proxy_handler = urllib2.ProxyHandler({"http" : 'http://127.0.0.1:1080'})         null_proxy_handler = urllib2.ProxyHandler({})         opener = urllib2.build_opener(proxy_handler)         urllib2.install_opener(opener)         uri = "http://www.bing.com/search?q=ip%3A" + ip +"&go=%E6%8F%90%E4%BA%A4&qs=n&first="+ str(first) +"&form=QBRE&pq=ip%3A" + ip +"&sc=0-0&sp=-1&sk=&cvid=5e52385772e24683a0bdf047de60abfc"         request = urllib2.Request(uri)         request.add_header('User-Agent', 'BaiduSpider')         response = urllib2.urlopen(request, timeout=10)         res = response.read()         return res def getIp(domain):     myaddr = socket.getaddrinfo(domain,'http')[0][4][0]     return myaddr def get(ip):         ip = getIp(ip)         print "[+] Query IP:" + ip + "n"         rev = []         first = 1         while True:                 res = curl(ip,first)                 first = first + 10                 r = re.findall(r'<h2><a href="((http|https)://([w|.]+)/)([w|/|&|=|.|?]+)?" h="ID=w+,w+.w+">',res)                 for i in r:                         print "[+] " + i[0]                         rev.append(i[0])                 m = re.search(r'<div class="sw_next">', res)                 if not m:                         break         result = list(set(rev))         return result if __name__ == "__main__":         print u"""------------------------------------------------------------------------------ 必应旁站查询                                                    qq:1141056911                                                                        By Lcy                                                             
------------------------------------------------------------------------------ """ if len(sys.argv) != 2: print "Usage: %s ip" % sys.argv[0] exit() urllist = get(sys.argv[1]) result = "" for i in urllist: result = result + i + "rn" f = open("Result.txt","w") f.write(result) f.close() print u"rn结果已经保存为Result.txt"


原文链接:https://www.t00ls.net/thread-31195-1-1.html

本文始发于微信公众号(T00ls):python旁站查询

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: