evyatarmeged/Raccoon

Error running raccoon

securitybites opened this issue · 5 comments

When running a scan I get the following output:

[#] Done enumerating Subdomains

### Raccoon scan finished ###

Task exception was never retrieved
future: <Task finished coro=<TLSHandler.run() done, defined at /usr/local/lib/python3.6/site-packages/raccoon_src/lib/tls.py:204> exception=FileNotFoundError(2, "No such file or directory: 'timeout'")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/raccoon_src/lib/tls.py", line 207, in run
    self.non_sni_data = await self._execute_ssl_data_extraction()
  File "/usr/local/lib/python3.6/site-packages/raccoon_src/lib/tls.py", line 130, in _execute_ssl_data_extraction
    responses = await self._run_openssl_sclient_cmd(self._base_script, sni)
  File "/usr/local/lib/python3.6/site-packages/raccoon_src/lib/tls.py", line 152, in _run_openssl_sclient_cmd
    stderr=PIPE
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 1192, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 200, in _make_subprocess_transport
    **kwargs)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_subprocess.py", line 39, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/unix_events.py", line 706, in _start
    universal_newlines=False, bufsize=bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'timeout': 'timeout'

This is on OSX. I installed using pip3.

That's because there is no native 'timeout' command in OSX.
In tls.py you can find this:

#OpenSSL likes to hang, Linux timeout to the rescue
self._base_script = "timeout 10 openssl s_client -connect {}:{} ".format(self.target, self.port)

And that's why raccoon throws the exception. Maybe the bug is due to OSX replacing openssl with native libraries.

The workaround for this is installing 'coreutils' with brew, this will install 'gtimeout' the needed command. Replace 'timeout' with 'gtimeout' and you are to go.

Check this stack overflow answer for more info on gtimeout: https://stackoverflow.com/a/21118126

Edit: I will later in the day for a fix to make cross platform that snippet, we need to detect what kind of OS we are on and pass the correct command.

@securitybites, @PurpleSec
A fix is up in branch macos-support.
Kindly let me know if you can run successful scans now and if so, I'll merge this to master.

@evyatarmeged Confirmed. It works now.

Thanks for the helpful insights guys.
macOS support is now available in master and will be uploaded to PyPi soon.