Skip to content

Commit 596fc6f

Browse files
committed
Fixed #102 #100 #90
1 parent 43dee4c commit 596fc6f

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

domainOsint.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,24 @@ def do_everything(domain, output, active):
173173

174174

175175
print colored(style.BOLD + '\n---> Finding Paste(s)..\n' + style.END, 'blue')
176+
177+
178+
179+
'''print colored(style.BOLD + '\n---> Finding Paste(s)..\n' + style.END, 'blue')
180+
if cfg.google_cse_key and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx and cfg.google_cse_cx != "XYZ":
181+
total_results = google_search(domain, 1)
182+
if (total_results != 0 and total_results > 10):
183+
more_iters = (total_results / 10)
184+
if more_iters >= 10:
185+
print colored(style.BOLD + '\n---> Too many results, Daily API limit might exceed\n' + style.END, 'red')
186+
for x in xrange(1,more_iters + 1):
187+
google_search(domain, (x*10)+1)
188+
print "\n\n-----------------------------------------n"
189+
else:
190+
print colored(style.BOLD + '\n[-] google_cse_key and google_cse_cx not configured. Skipping paste(s) search.\nPlease refer to http://datasploit.readthedocs.io/en/latest/apiGeneration/.\n' + style.END, 'red')
191+
'''
192+
193+
176194
if cfg.google_cse_key != "" and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx != "" and cfg.google_cse_cx != "XYZ":
177195
total_results, results = google_search(domain, 1)
178196
if not total_results == 0:
@@ -195,8 +213,7 @@ def do_everything(domain, output, active):
195213
if more_iters >= 10:
196214
print colored(style.BOLD + '\n---> Too many results, Daily API limit might exceed\n' + style.END, 'red')
197215
for x in xrange(1,more_iters + 1):
198-
results = google_search(domain, (x*10)+1)
199-
print type(results)
216+
total_results, results = google_search(domain, (x*10)+1)
200217
if results:
201218
for y in results['items']:
202219
lhtml += "<tr>"

domain_pastes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ def google_search(domain,start_index):
3333
url="https://www.googleapis.com/customsearch/v1?key=%s&cx=%s&q=\"%s\"&start=%s" % (cfg.google_cse_key, cfg.google_cse_cx, domain, start_index)
3434
res=requests.get(url)
3535
results = json.loads(res.text)
36+
#print(results)
3637
if 'items' in results.keys():
3738
if start_index == 1:
3839
print "[+] %s results found\n" % int(results['searchInformation']['totalResults'])
3940
for x in results['items']:
4041
print "Title: %s\nURL: %s\nSnippet: %s\n" % (x['title'], colorize(x['link']), colorize(x['snippet']))
4142
start_index = +1
42-
return int(results['searchInformation']['totalResults'])
43-
elif 'searchInformation' in results.keys():
44-
if results['searchInformation']['totalResults'] == "0":
43+
return int(results['searchInformation']['totalResults']), results
44+
elif 'searchInformation' in results.keys() and 'totalResults' in results["searchInformation"].keys() and results['searchInformation']['totalResults'] == "0":
4545
print '0 Results found'
46-
return 0
46+
return 0, []
4747
elif results['error']['code'] == 403:
48-
print 'Rate limit Exceeded'
49-
return 0
48+
print results['error']["message"]
49+
return 0, []
5050
else:
51-
return 0
52-
#return json.loads(res.text)
51+
return 0, []
52+
#return json.loads(res.text)
5353

5454

5555
def main():
5656
domain = sys.argv[1]
5757
print colored(style.BOLD + '\n---> Finding Paste(s)..\n' + style.END, 'blue')
58-
if cfg.google_cse_key != "" and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx != "" and cfg.google_cse_cx != "XYZ":
58+
if cfg.google_cse_key and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx and cfg.google_cse_cx != "XYZ":
5959
total_results = google_search(domain, 1)
6060
if (total_results != 0 and total_results > 10):
6161
more_iters = (total_results / 10)

0 commit comments

Comments
 (0)