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

google_search ... NameError:name 'google' is not defined #601

Open
mathurin68 opened this issue Feb 17, 2023 · 1 comment
Open

google_search ... NameError:name 'google' is not defined #601

mathurin68 opened this issue Feb 17, 2023 · 1 comment

Comments

@mathurin68
Copy link

Playing with some of the modules and came across this error, I seem to have a lot of them working now, BUT, I got this error on the google search?

Feb 16 19:14:44 MISP misp-modules[1794626]: File "/var/www/MISP/venv/lib/python3.8/site-packages/misp_modules/__init__.py", line 188, in run_request Feb 16 19:14:44 MISP misp-modules[1794626]: response = mhandlers[module].handler(q=jsonpayload) Feb 16 19:14:44 MISP misp-modules[1794626]: File "/var/www/MISP/venv/lib/python3.8/site-packages/misp_modules/modules/expansion/google_search.py", line 30,> Feb 16 19:14:44 MISP misp-modules[1794626]: search_results = google.search(request['url'], num_page) Feb 16 19:14:44 MISP misp-modules[1794626]: NameError: name 'google' is not defined

@adulau
Copy link
Member

adulau commented Mar 20, 2023

Thanks for the feedback.

I tried the following:

pip install git+https://github.com/abenassi/Google-Search-API
In [1]: from googleapi import google                                                                                                                                                          

In [2]: google.search("misp", 1)                                                                                                                                                              
Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
Traceback (most recent call last):
  File "/home/adulau/.local/lib/python3.8/site-packages/fake_useragent/utils.py", line 154, in load
    for item in get_browsers(verify_ssl=verify_ssl):
  File "/home/adulau/.local/lib/python3.8/site-packages/fake_useragent/utils.py", line 99, in get_browsers
    html = html.split('<table class="w3-table-all notranslate">')[1]
IndexError: list index out of range

It seems the module is still here but it seems the recent changes make this google search not working. We have two options:

  • Finding an alternative Python library supporting search query (which seems very fragile)
  • or we removed the module.

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

No branches or pull requests

2 participants