Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'searchInformation' #90

Closed
FreelancePentester opened this issue Jan 16, 2017 · 11 comments
Closed

KeyError: 'searchInformation' #90

FreelancePentester opened this issue Jan 16, 2017 · 11 comments

Comments

@FreelancePentester
Copy link

---> 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
Copy link

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
Copy link

marcdm7 commented Feb 21, 2017

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
Copy link

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
Copy link

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
Copy link

marcdm7 commented Feb 22, 2017

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
Copy link

kab00kie commented Feb 24, 2017

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
Copy link

kishorer747-zz commented Mar 3, 2017

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
Copy link
Member

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

upgoingstar added a commit that referenced this issue Apr 11, 2017
@Plazmaz
Copy link

Plazmaz commented Jul 13, 2017

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
Copy link

spmedia commented Jul 13, 2017

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants