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

Upload report error #497

Open
prateekshetty-eox opened this issue Jul 8, 2024 · 1 comment
Open

Upload report error #497

prateekshetty-eox opened this issue Jul 8, 2024 · 1 comment

Comments

@prateekshetty-eox
Copy link

Please search the Wiki for a solution before posting a ticket. Use the “New Support Request” button to the right of the screen to submit a ticket for technical support.

Issue Type

  • Bug Re port

Faraday version

Paste the output of the ./faraday.py --version command

Component Name

If you know where the problem lays indicate it:
WebGui/GTKGui/Plugin/Console/Continuous Scanning/Etc.

Steps to reproduce

Provide detailed steps on how the issue happened so we can try to reproduce it. If the issue is random, please provide as much information as possible.

I used $ wget https://raw.githubusercontent.com/infobyte/faraday/master/docker-compose.yaml
$ docker-compose up to set it up

Used the docker compose up to install faraday and run it, so when i run it and i get logs, i get this when i call http://X.X.X.X:5985/_api/v3/token from postman:
faraday_app | 2024-07-08T10:51:03+0000 - passlib.handlers.bcrypt - WARNING {Dummy-11} [pid:20] [bcrypt.py:622 - _load_backend_mixin()] (trapped) error reading bcrypt version
faraday_app | Traceback (most recent call last):
faraday_app | File "/usr/local/lib/python3.8/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
faraday_app | version = _bcrypt.about.version
faraday_app | AttributeError: module 'bcrypt' has no attribute 'about'
faraday_app | 2024-07-08T10:51:04+0000 - geventwebsocket.handler - INFO {Dummy-11} [pid:20] [handler.py:242 - log_request()] 106.51.64.181 - - [2024-07-08 10:51:04] "GET /_api/v3/token HTTP/1.1" 200 474 1.189582

and for http://X.X.X.X:5985/_api/v3/ws/Test/upload_report i get this:
faraday_app | 2024-07-08T10:51:26+0000 - faraday.server.api.modules.upload_reports - INFO {Dummy-11} [pid:20] [upload_reports.py:70 - file_upload()] Importing new plugin report in server...
faraday_app | 2024-07-08T10:51:27+0000 - geventwebsocket.handler - INFO {Dummy-11} [pid:20] [handler.py:242 - log_request()] 106.51.64.181 - - [2024-07-08 10:51:27] "POST /_api/v3/ws/Test/upload_report HTTP/1.1" 400 318 0.772049
no matter what authentication i try it doesnt work

in postman or terminal :

<title>400 Bad Request</title>

Bad Request

The browser (or proxy) sent a request that this server could not understand.

When i try connecting using faraday-cli i keep getting connection refused error

OS

Provide information on your operating system. Example:

$ cat /etc/lsb-release
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04 LTS"

@ezk06eer
Copy link

ezk06eer commented Sep 2, 2024

Hello, @prateekshetty-eox

Are you still having an issue here? it seems you are having a hard time trying to setup an environment, have you checked in our docs? Docs

if you fire up faraday using docker compose up, you should try to connect to 127.0.0.1:5985 and use latest vs latest both faraday and faraday-cli.

about the token and upload report there is an api specification in our docs, we use the openapi model for that and you could just simply upload a report to the endpoint, i think you can still use authentication basic in the headers, and also you can also find this example using curl:

cURL example:

curl 'https://xxx/_api/v3/ws/workspacename/upload_report' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9,es;q=0.8' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryciJQBAtz2MWk25PX' \
  -H 'cookie: _gcl_au=xxx; _hjSessionUser_1808475=xxx==;' \
  -H 'origin: https://xxx.com' \
  -H 'priority: u=1, i' \
  -H 'referer: https://xxx/manage/workspacename' \
  -H 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
  --data-raw $'------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="file"; filename="filename.json"\r\nContent-Type: application/json\r\n\r\n\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="ignore_info"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="resolve_hostname"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name="csrf_token"\r\n\r\nIjFjNGFkZGYzZmY4MThiN2ZmZGI5YTJhMWIxZmVlY2M2ODZlMjRiODQi.ZtWraw._MSm23jGSkqc7_lOqoTZKOQmfYI\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX--\r\n'

fetch example

fetch("https://XXX/_api/v3/ws/workspacename/upload_report", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "accept-language": "en-US,en;q=0.9,es;q=0.8",
    "content-type": "multipart/form-data; boundary=----WebKitFormBoundaryciJQBAtz2MWk25PX",
    "priority": "u=1, i",
    "sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"128\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin"
  },
  "referrer": "https://XXX/manage/workspacename",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"file\"; filename=\"filename.json\"\r\nContent-Type: application/json\r\n\r\n\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"ignore_info\"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"resolve_hostname\"\r\n\r\nfalse\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX\r\nContent-Disposition: form-data; name=\"csrf_token\"\r\n\r\nIjFjNGFkZGYzZmY4MThiN2ZmZGI5YTJhMWIxZmVlY2M2ODZlMjRiODQi.ZtWraw._MSm23jGSkqc7_lOqoTZKOQmfYI\r\n------WebKitFormBoundaryciJQBAtz2MWk25PX--\r\n",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

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

No branches or pull requests

2 participants