email_pastes API Key Generation insufficient
jaraco opened this issue · 3 comments
Following the instructions on generating API keys for Custom Search API, and configuring those values in config.py, I still get an error message when searching Pastes that the key is not configured:
---> Finding Paste(s)..
[-] google_cse_key and google_cse_cx not configured. Skipping paste(s) search.
Please refer to http://datasploit.readthedocs.io/en/latest/apiGeneration/.
Doing a little troubleshooting, I find the error message is misleading, and that error message is posted when the query fails also:
$ python -m pdb emailOsint.py test@example.com
> .../datasploit/emailOsint.py(3)<module>()
-> from __future__ import absolute_import
(Pdb) b emails/email_pastes.py:68
Breakpoint 1 at .../datasploit/emails/email_pastes.py:68
(Pdb) c
[-] Skipping Clearbit because it is marked as disabled.
---> Finding Paste(s)..
> .../datasploit/emails/email_pastes.py(68)main()
-> if cfg.google_cse_key != "" and cfg.google_cse_key != "XYZ" and cfg.google_cse_cx != "" and cfg.google_cse_cx != "XYZ":
(Pdb) n
> .../datasploit/emails/email_pastes.py(69)main()
-> status, data = google_search(email)
(Pdb) n
> .../datasploit/emails/email_pastes.py(70)main()
-> return [status, data]
(Pdb) status
False
(Pdb) data
{'error': {'errors': [{'domain': 'usageLimits', 'reason': 'accessNotConfigured', 'message': 'Project ELIDED is not found and cannot be used for API calls. If it is recently created, enable CustomSearch API by visiting https://console.developers.google.com/apis/api/customsearch.googleapis.com/overview?project=ELIDED 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.googleapis.com/overview?project=ELIDED'}], 'code': 403, 'message': 'Project ELIDED is not found and cannot be used for API calls. If it is recently created, enable CustomSearch API by visiting https://console.developers.google.com/apis/api/customsearch.googleapis.com/overview?project=ELIDED then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.'}}
So this is sort of two bugs:
- The instructions are insufficient. One must also enable the project with the search API.
- When the query fails, the actual cause (and message to resolve) is masked and the wrong cause is reported.
Hey @jaraco thats for the suggestions. Please pull the latest code, and check if you are facing the same issue. Any further feedback would be grateful.
Hi @Chan9390 i have pulled the latest code but i still see similar error when i try to search on an email ID and i have double checked that i have put in the correct google_cse_key and google_cse_cx.
Can you help me with this issue please? many thanks!
These instructions need to be updated to include the api key for google custom search api:
https://datasploit.readthedocs.io/en/latest/apiGeneration/#google-custom-search-engine-api-key-and-cx-id
Get API KEY for "google_api" in config.py
https://developers.google.com/custom-search/json-api/v1/overview#api_key
confirm it works by passing info@test.com and it should return pastebin results