Skip to content

Crash: UnicodeDecodeError on usernames with special characters #2730

@ele-sage

Description

@ele-sage

Installation method

PyPI (via pip)

Package version

Sherlock v0.16.0

Description

I was trying to find accounts for the username 'Émile'.

I expected Sherlock to complete the scan successfully.

The program crashed and exited prematurely. The error is a UnicodeDecodeError, which appears to be triggered by the requests library when it tries to handle a redirect from a server that is not sending a properly encoded URL.

Full Error Traceback:

sherlock 'Émile'
[*] Checking username Émile on:

[+] 7Cups: https://www.7cups.com/@Émile
[+] AniWorld: https://aniworld.to/user/profil/Émile
...
[+] SlideShare: https://slideshare.net/Émile
[+] Strava: https://www.strava.com/athletes/Émile
Traceback (most recent call last):
  File "/home/elesage/.local/bin/sherlock", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/sherlock_project/sherlock.py", line 870, in main
    results = sherlock(
              ^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/sherlock_project/sherlock.py", line 387, in sherlock
    r, error_text, exception_text = get_response(
                                    ^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/sherlock_project/sherlock.py", line 120, in get_response
    response = request_future.result()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/requests/sessions.py", line 724, in send
    history = [resp for resp in gen]
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/requests/sessions.py", line 175, in resolve_redirects
    url = self.get_redirect_target(resp)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/requests/sessions.py", line 124, in get_redirect_target
    return to_native_string(location, "utf8")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elesage/.local/share/pipx/venvs/sherlock-project/lib/python3.12/site-packages/requests/_internal_utils.py", line 33, in to_native_string
    out = string.decode(encoding)
          ^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte

Steps to reproduce

sherlock 'Émile'

Additional information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions