byt3bl33d3r / WitnessMe

Web Inventory tool, takes screenshots of webpages using Pyppeteer (headless Chrome/Chromium) and provides some extra bells & whistles to make life easier.
GNU General Public License v3.0
727 stars 109 forks source link

Requests pending and no proxy #38

Open t0-git opened 2 years ago

t0-git commented 2 years ago

Good morning,

I encounter issues using witnessme. I don't understand where's the problem. When I try to launch it against a list of IPs in a file, it enters in an infinite loop, pending all the requests :

witnessme -d screenshot urls.txt

image

Same problem if I try only with one IP, or reduce the thread to 1 and timeout to 60 seconds. The chrome process is running when executing the command :

ss -tunltp

image

Moreover, I don't know if this issue is related, but I can't proxify the trafic :

HTTP_PROXY=http://127.0.0.1:8080 witnessme -d screenshot urls.txt

[witnessme.utils] DEBUG - Patching pyppeteer...
[witnessme] DEBUG - {'threads': 15, 'timeout': 15, 'debug': True, 'command': 'screenshot', 'target': ['urls.txt'], 'ports': [80, 8080, 443, 8443], 'func': <function screenshot at 0x7f20904152d0>}
[witnessme.screenshot] INFO - Starting scan 0e26de7e-b6fe-45e1-8e0c-6d9105a27b53
[witnessme.headlessbrowser] DEBUG - Waiting for queue to populate...
[witnessme.parsers] DEBUG - Detected file as a target
[witnessme.headlessbrowser] INFO - Starting headless browser
[witnessme.headlessbrowser] INFO - Proxy set to http://127.0.0.1:8080
Traceback (most recent call last):
  File "/home/t0/.local/bin/witnessme", line 8, in <module>
    sys.exit(run())
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/console/witnessme.py", line 113, in run
    args.func(args)
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/utils.py", line 41, in wrapper
    return asyncio.run(f(*args, **kwargs))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/console/witnessme.py", line 19, in screenshot
    await cmd.start()
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/commands/screenshot.py", line 124, in start
    await self._scan_task
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/commands/screenshot.py", line 118, in setup_and_run
    await self._browser.run(self.target, self.ports)
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/headlessbrowser.py", line 149, in run
    await self.start_browser(
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/witnessme/headlessbrowser.py", line 107, in start_browser
    browser = await pyppeteer.launch(
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/pyppeteer/launcher.py", line 306, in launch
    return await Launcher(options, **kwargs).launch()
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/pyppeteer/launcher.py", line 167, in launch
    self.browserWSEndpoint = get_ws_endpoint(self.url)
  File "/home/t0/.local/pipx/venvs/witnessme/lib/python3.10/site-packages/pyppeteer/launcher.py", line 229, in get_ws_endpoint
    data = json.loads(f.read().decode())
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It seems it tries to access to http://127.0.0.1:<port_of_headless_chrome>/json/version, but can't reach it :

image

I installed witnessme using pipx following the README.

System : Arch Linux 5.16.1-arch1-1 x86_64 GNU/Linux