def gharv(magicWord):
vUniq = []
for site in sitearray:
counter = 0;bcksp = 0
try:
CXname = CXdic.keys()[int(random.random()*len(CXdic.keys()))];CXr = CXdic[CXname]
print "\n| Site : ", site, " | CSEngine : ", CXname+" | Progress : ",
saveCount = len(targets);cmpslptime = 0;lastlen = 0
while counter < maxcount:
jar = cookielib.FileCookieJar("cookies")
query = magicWord+'+'+dork+'+site:'+site
results_web = 'http://www.google.com/cse?cx='+CXr+'&q='+query+'&num='+str(gnum)+'&hl=en&lr=&ie=UTF-8&start=' + repr(counter) + '&sa=N'
request_web = urllib2.Request(results_web);agent = random.choice(header)
request_web.add_header('User-Agent', agent);opener_web = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
text = opener_web.open(request_web).read();strreg = re.compile('(?<=href=")(.*?)(?=")')
names = strreg.findall(text)
for name in names:
if name not in targets:
if re.search(r'\(', name) or re.search("<", name) or re.search("\A/", name) or re.search("\A(http://)\d", name):
pass
elif re.search("google", name) or re.search("youtube", name) or re.search(".gov", name):
pass
else:
targets.append(name)
sleeptimer = random.choice(rSA);time.sleep(sleeptimer)
cmpslptime += sleeptimer;counter += gnum
percent = int((1.0*counter/maxcount)*100)
if bcksp == 1:
stroutlen = 0
while stroutlen < lastlen:
sys.stdout.write("\10");stroutlen += 1
sys.stdout.write("%s(%s) - %s percent" % (counter,sleeptimer,percent))
lastlen = len(str(counter)+str(sleeptimer)+str(percent))+13
sys.stdout.flush()
bcksp = 1
sys.stdout.write(" | %s Strings recieved, in %s seconds" % (len(targets)-saveCount,cmpslptime))
except IOError:
sys.stdout.write(" | %s Strings recieved" % (len(targets)-saveCount))
firstparm = '';uList = []
for entry in targets:
thost = entry.rsplit("=");t2host = entry.rsplit("/")
try:
firstparm = thost[1];domain = t2host[2]
if domain not in uList:
if '.'+dorkEXT+'?' in entry and firstparm.isdigit() == True:
uniqvictims.append(entry);uList.append(domain)
pass
elif 'http://' in entry and 'index.' in entry and firstparm.isalpha() == True:
spidervictims.append(entry);uList.append(domain)
pass
else:
miscVic.append(entry)
pass
except:
pass
# ScanQueue Builder
评论列表
文章目录