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

Unable to GET/screenshot/{scan_id}/result #41

Open ghost opened 2 years ago

ghost commented 2 years ago

hi, i follow all steps to test API (http://127.0.0.1:8000/docs#/), but on step GET/screenshot/{scan_id}/result i have this error:

INFO:     172.17.0.1:60500 - "GET /screenshot/ HTTP/1.1" 200 OK
INFO:     172.17.0.1:60502 - "POST /screenshot/ HTTP/1.1" 200 OK
INFO:     172.17.0.1:60504 - "GET /screenshot/3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2 HTTP/1.1" 200 OK
INFO:     172.17.0.1:60506 - "GET /screenshot/3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2/start HTTP/1.1" 200 OK
2022-02-22 18:57:01,848 [INFO] witnessme.screenshot - screenshot.py: start - Starting scan 3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2
2022-02-22 18:57:01,866 [DEBUG] witnessme.headlessbrowser - headlessbrowser.py: run - Waiting for queue to populate...
2022-02-22 18:57:01,866 [DEBUG] witnessme.parsers - parsers.py: generate - Detected IP Address/Range/CIDR, hostname or URL as a target
2022-02-22 18:57:01,866 [DEBUG] witnessme.parsers - parsers.py: generate - Detected IP Address/Range/CIDR, hostname or URL as a target
2022-02-22 18:57:01,966 [INFO] witnessme.headlessbrowser - headlessbrowser.py: start_browser - Starting headless browser
2022-02-22 18:57:02,052 [INFO] witnessme.headlessbrowser - headlessbrowser.py: start_browser - Using 2 browser tab(s)/thread(s)
2022-02-22 18:57:04,913 [INFO] witnessme.screenshot - screenshot.py: add_to_database - Took screenshot of https://google.com:443
2022-02-22 18:57:04,926 [DEBUG] witnessme.headlessbrowser - headlessbrowser.py: open_browser_tab - Navigated to https://google.com
2022-02-22 18:57:05,983 [INFO] witnessme.screenshot - screenshot.py: add_to_database - Took screenshot of https://opera.com:443
2022-02-22 18:57:05,998 [DEBUG] witnessme.headlessbrowser - headlessbrowser.py: open_browser_tab - Navigated to https://opera.com
2022-02-22 18:57:06,003 [INFO] witnessme.headlessbrowser - headlessbrowser.py: start_browser - Killing headless browser
2022-02-22 18:57:06,023 [INFO] witnessme.screenshot - screenshot.py: start - Saved scan to scan_2022_02_22_185619/
2022-02-22 18:57:27,397 [INFO] witnessme.screenshot - screenshot.py: stop - Stopping scan 3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2
INFO:     172.17.0.1:60510 - "GET /screenshot/3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2/stop HTTP/1.1" 200 OK
INFO:     172.17.0.1:60512 - "GET /screenshot/3a2438f3-3c4c-4438-9ed7-44d5ae5c45f2/result HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/appuser/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/appuser/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/home/appuser/.local/lib/python3.8/site-packages/fastapi/applications.py", line 146, in __call__
    await super().__call__(scope, receive, send)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
    await route.handle(scope, receive, send)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/home/appuser/.local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/home/appuser/.local/lib/python3.8/site-packages/fastapi/routing.py", line 196, in app
    raw_response = await run_endpoint_function(
  File "/home/appuser/.local/lib/python3.8/site-packages/fastapi/routing.py", line 148, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/appuser/.local/lib/python3.8/site-packages/witnessme/api/routers/scan.py", line 59, in get_scan_result
    if not scan.stats.done:
AttributeError: 'BrowserStats' object has no attribute 'done'