DataSploit / datasploit

An #OSINT Framework to perform various recon techniques on Companies, People, Phone Number, Bitcoin Addresses, etc., aggregate all the raw data, and give data in multiple formats.
GNU General Public License v3.0
2.97k stars 426 forks source link

KeyError: 'searchInformation' #90

Closed FreelancePentester closed 7 years ago

FreelancePentester commented 7 years ago

---> Finding Paste(s)..

Traceback (most recent call last): File "domainOsint.py", line 374, in main() File "domainOsint.py", line 345, in main do_everything(domain) File "domainOsint.py", line 135, in do_everything total_results = google_search(domain, 1) File "/media/ddos/DDOS/PenTest/datasploit/domain_pastes.py", line 43, in google_search elif results['searchInformation']['totalResults'] == "0": KeyError: 'searchInformation'

mrmookie commented 7 years ago

Same problem here... UI hangs on google search and domainOsint.py crashes here:

---> Finding Paste(s)..

Traceback (most recent call last): File "domainOsint.py", line 374, in main() File "domainOsint.py", line 345, in main do_everything(domain) File "domainOsint.py", line 135, in do_everything total_results = google_search(domain, 1) File "/home/twitter/datasploit/domain_pastes.py", line 43, in google_search elif results['searchInformation']['totalResults'] == "0": KeyError: 'searchInformation'

marcdm7 commented 7 years ago

Same problem here, adding my paste:

---> Finding Paste(s)..

Traceback (most recent call last): File "domainOsint.py", line 374, in main() File "domainOsint.py", line 345, in main do_everything(domain) File "domainOsint.py", line 135, in do_everything total_results = google_search(domain, 1) File "/home/marc/datasploit/domain_pastes.py", line 43, in google_search elif results['searchInformation']['totalResults'] == "0": KeyError: 'searchInformation'

johnlittle4550 commented 7 years ago

Same thing fresh install today ---> Finding Paste(s)..

Traceback (most recent call last): File "domainOsint.py", line 374, in main() File "domainOsint.py", line 345, in main do_everything(domain) File "domainOsint.py", line 135, in do_everything total_results = google_search(domain, 1) File "/opt/datasploit/domain_pastes.py", line 43, in google_search elif results['searchInformation']['totalResults'] == "0": KeyError: 'searchInformation'

johnlittle4550 commented 7 years ago

May have something to contribute here ... so checking the code

def google_search(domain,start_index):
    time.sleep(0.3)
    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)
    res=requests.get(url)
    results = json.loads(res.text)
    if 'items' in results.keys():

then manually pulling the URL up in a browser https://www.googleapis.com/customsearch/v1?key=AIzaSyB7hjqMxfbzqfI8QLWW1ixOwXPsz4p1Aa4&cx=017412786085355526887:ztg3p9li4sm&q=%22grmc.org%22&start=0 I got this response

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. CustomSearch API has not been used in project 503665572114 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/customsearch/overview?project=503665572114 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/customsearch/overview?project=503665572114"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. CustomSearch API has not been used in project 503665572114 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/customsearch/overview?project=503665572114 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}

after checking on my API I was able to actually enable it and get the script working!

marcdm7 commented 7 years ago

Thanks @johnlittle4550 did the same steps as I was in the exact same situation, unfortunately after enabling my API I still get the same error. I'll wait a few minutes just in case :)

kab00kie commented 7 years ago

I have this error, followed john's manual browser and got this:

{ "error": { "errors": [ { "domain": "usageLimits", "reason": "ipRefererBlocked", "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.", "extendedHelp": "https://console.developers.google.com/apis/credentials?project=" } ], "code": 403, "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions." } }

I've disabled key restriction for testing and will check in 5-10 to see what happens.

EDIT: Disabling key restriction gets me beyond this error and onto another unrelated one. I don't want to leave it unrestricted but unsure what I should have restricted and still have it work.

@johnlittle4550: When you say that you enable the API is that from Dashbaord > Enable API > Select Custom Search API? And then you begin to see stats and charts for it? Just want to be sure I've enabled it the way I think you described above.

kishorer747-zz commented 7 years ago

I got that to work. Do the following:

  1. Enable custom search in Google Cloud Console: https://console.developers.google.com/apis/api/customsearch/overview (select your project and enable CustomSearch API)

or If you want to find the link directly, add print(results) below results = json.loads(res.text) in google_search function in domain_pastes.py file. This is will throw the exact error with the link to your project. Just click Enable API button there.

Comment or remove print(results) and the run python domain_pastes.py facebook.com

Below are few results:

Title: CSGO FACEBOOK GROUPS - Pastebin.com URL: http://pastebin.com/V1n9U2VP Snippet: Jan 9, 2017 ... CSGO Facebook groups: https://www.facebook.com/groups/159167004450085/. https://www.facebook.com/groups/vietnamsteammarket/.

Title: #FACEBOOK GROUP: https://m.facebook.com/groups ... URL: http://pastebin.com/58CPwxz9 Snippet: 1 hour ago ... #FACEBOOK GROUP: https://m.facebook.com/groups/1729442714041896. #BIG CREDITS TO: BISDAK ADMIN ROOM groupchat. #important ...

Title: <iframe src="//www.facebook.com/plugins/follow?href=https%3A ... URL: http://pastebin.com/z7dbTTF7 Snippet: Dec 20, 2016 ... <iframe src="//www.facebook.com/plugins/follow?href=https%3A%2F%2Fwww. facebook.com%2Fshitxoargak&layout=standard&amp ...

Title: https://www.facebook.com/calum.g.ferguson https://www.facebook ... URL: http://pastebin.com/NcByCh6h Snippet: Jan 9, 2017 ... https://www.facebook.com/JacobbFergusonn. https://www.facebook.com/maria. ferguson.7509. https://www.facebook.com/ross.ferguson.16547.

Title: https://www.facebook.com/groups/828377847278404/ https://www ... URL: http://pastebin.com/1FSPVtiG Snippet: Nov 28, 2016 ... https://www.facebook.com/groups/992661217460657/. https://www.facebook.com /groups/UniqueSantosRPG/.

upgoingstar commented 7 years ago

believe this is fixed now, please check and open the issue if it still persists.

Plazmaz commented 7 years ago

This is still an issue for me @upgoingstar

Traceback (most recent call last):
  File "datasploit.py", line 54, in <module>
    main(user_input)
  File "datasploit.py", line 36, in main
    emailOsint.run(user_input)
  File "/mnt/c/Users/dylan/Documents/GitHub/datasploit/emailOsint.py", line 8, in run
    osint_runner.run("email", "emails", email)
  File "/mnt/c/Users/dylan/Documents/GitHub/datasploit/osint_runner.py", line 23, in run
    data = x.main(m_input)
  File "/mnt/c/Users/dylan/Documents/GitHub/datasploit/emails/email_pastes.py", line 61, in main
    data = google_search(email)
  File "/mnt/c/Users/dylan/Documents/GitHub/datasploit/emails/email_pastes.py", line 44, in google_search
    if int(data['searchInformation']['totalResults']) > 0:
KeyError: 'searchInformation'
spmedia commented 7 years ago

If you visit https://console.developers.google.com/apis/library and type in "Custom Search API" and then click on it, you will see an "Enable" button up top. I Enabled it and thought that might have been the problem but I just tried the script again and get the same error.

gapi

lorenzoromani1983 commented 6 years ago

Still get the same error. I also enabled the custom search api. What to do next?