Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def api_test():
'''
get verified with zoomeye
'''
amnt = int(
console.input_check(
"[*] How many results do you want? (10 IPs on each page) ",
check_type=int).strip())
threads = []
api = ZoomEyeAPI('zoomeye.conf')
access_token = api.login()
headers = {
'Authorization': 'JWT ' + access_token,
}
status = threading.Thread(target=progress, args=(ZoomEyeAPI.OUTFILE,))
status.setDaemon(True)
status.start()
limit = 0
for page in range(1, int(amnt / 10)):
thd = threading.Thread(
target=crawler, args=(ZoomEyeAPI.QRY, amnt, page, headers,))
threads.append(thd)
for job in threads:
job.setDaemon(True)
job.start()
if limit == 0 or limit == 10:
def api_test():
'''
get verified with zoomeye
'''
amnt = int(
console.input_check(
"[*] How many results do you want? (10 IPs on each page) ",
check_type=int).strip())
threads = []
api = ZoomEyeAPI('zoomeye.conf')
access_token = api.login()
headers = {
'Authorization': 'JWT ' + access_token,
}
status = threading.Thread(target=progress, args=(ZoomEyeAPI.OUTFILE,))
status.setDaemon(True)
status.start()
limit = 0
for page in range(1, int(amnt / 10)):
thd = threading.Thread(
target=crawler, args=(ZoomEyeAPI.QRY, amnt, page, headers,))
threads.append(thd)
for job in threads:
job.setDaemon(True)
job.start()
if limit == 0 or limit == 10:
limit = 0
job.join()
limit += 1
'''
put things together
'''
try:
api_test()
except (EOFError, KeyboardInterrupt, SystemExit):
pass
else:
console.print_error('[-] Error with api_test')
debug_traceback()
if __name__ == '__main__':
try:
ZoomEyeAPI.QRY = console.input_check(
"[*] Your query is: ", allow_blank=False)
ZoomEyeAPI.OUTFILE = '../data/zoomeye-{}.txt'.format(
'-'.join(ZoomEyeAPI.QRY.replace(':', '_').split()))
main()
except KeyboardInterrupt:
print('\n[*] Exiting...')
else:
debug_traceback()
put things together
'''
try:
api_test()
except (EOFError, KeyboardInterrupt, SystemExit):
pass
else:
console.print_error('[-] Error with api_test')
debug_traceback()
if __name__ == '__main__':
try:
ZoomEyeAPI.QRY = console.input_check(
"[*] Your query is: ", allow_blank=False)
ZoomEyeAPI.OUTFILE = '../data/zoomeye-{}.txt'.format(
'-'.join(ZoomEyeAPI.QRY.replace(':', '_').split()))
main()
except KeyboardInterrupt:
print('\n[*] Exiting...')
else:
debug_traceback()
def main():
'''
put things together
'''
try:
api_test()
except (EOFError, KeyboardInterrupt, SystemExit):
pass
else:
console.print_error('[-] Error with api_test')
debug_traceback()
if __name__ == '__main__':
try:
ZoomEyeAPI.QRY = console.input_check(
"[*] Your query is: ", allow_blank=False)
ZoomEyeAPI.OUTFILE = '../data/zoomeye-{}.txt'.format(
'-'.join(ZoomEyeAPI.QRY.replace(':', '_').split()))
main()
except KeyboardInterrupt:
print('\n[*] Exiting...')
else:
debug_traceback()
console.input_check(
"[*] How many results do you want? (10 IPs on each page) ",
check_type=int).strip())
threads = []
api = ZoomEyeAPI('zoomeye.conf')
access_token = api.login()
headers = {
'Authorization': 'JWT ' + access_token,
}
status = threading.Thread(target=progress, args=(ZoomEyeAPI.OUTFILE,))
status.setDaemon(True)
status.start()
limit = 0
for page in range(1, int(amnt / 10)):
thd = threading.Thread(
target=crawler, args=(ZoomEyeAPI.QRY, amnt, page, headers,))
threads.append(thd)
for job in threads:
job.setDaemon(True)
job.start()
if limit == 0 or limit == 10:
limit = 0
job.join()
limit += 1
def zoomeye_api_test():
zoomeye = ZoomEye()
zoomeye.username = raw_input('ZoomEye Username: ')
zoomeye.password = getpass.getpass(prompt='ZoomEye Password: ')
zoomeye.login()
print(zoomeye.resources_info())
data = zoomeye.dork_search('solr')
show_site_ip(data)
data = zoomeye.dork_search('country:cn')
show_site_ip(data)
data = zoomeye.dork_search('solr country:cn')
show_site_ip(data)
data = zoomeye.dork_search('solr country:cn', resource='host')
show_ip_port(data)
def exploit(self):
if not self.payload:
self.output("[!] please config the payload first!")
else:
if self.query:
z = zoomeye.Zoomeye("YOUR EMAIL", "YOUR PASSWORD")
try:
z.run(self.poc.exploit, self.query, pages = self.pages, facets = self.facets, port = self.port, search_type = self.search_type)
while z.isReady():
time.sleep(1)
except KeyboardInterrupt,e:
self.output("[!] user abort! Waiting for payload to stop...")
z.Done = True
while not z.queue.empty():
tmp = z.queue.get()
elif self.target:
try:
self.poc.exploit(self.target)
except KeyboardInterrupt,e:
self.output("[!] user abort!")
else:
self.output("[!] please config target or zoomeye query first!")
def send_command(self, command, search, thread_num, exec_cmd, startIP, endIP, ipfile):
"""Execute a command"""
if search == "censys":
self.search = Censys()
elif search == "zoomeye":
self.search = Zoomeye()
elif search == "shodan":
self.search = Shodan()
elif search == "local":
self.search = Local()
else:
print "you got a wrong type of search engine, you can select censys, shodan or zoomeye as your scan engine."
sys.exit()
if self.setQuery(command):
return {'prompt': '', 'busy': False, 'data': 'QUERY => %s\n' % self.query}
elif self.setPage(command):
return {'prompt': '', 'busy': False, 'data': 'PAGE => %d\n' % self.page}
else:
if command == "exploit\n" or command == "run\n":
if not self.search:
print "please select a search engine using the -s or --search option."
def __init__(self, tID, q):
"""ZoomEyeProc init function, defines id and feeding queue"""
FeederBase.__init__(self, tID, 'ZoomEyeProc', q)
self.api = zoomeye.ZoomEye()
self.api.username = Zoom_CREDS[0]
self.api.password = Zoom_CREDS[1]
self.api.login()