cuckoosandbox / cuckoo

Cuckoo Sandbox is an automated dynamic malware analysis system
http://www.cuckoosandbox.org
Other
5.54k stars 1.7k forks source link

Cuckoo Api token error #2987

Open LovishBathla opened 4 years ago

LovishBathla commented 4 years ago

import requests

REST_URL = "http://localhost:8090/tasks/create/file" SAMPLE_FILE = "12.pdf" headers = {'Authorization': 'BEARER MDD567'}

with open(SAMPLE_FILE, "rb") as sample: files = {"file": ("temp_file_name", sample)} r = requests.post(REST_URL,headers=headers)

task_id = r.text print (task_id)

When I run this I am getting { "message": "Authentication in the form of an 'Authorization: Bearer ' header is required" }

But I already assigned headers in requests like this only and I also changed this in cuckoo.conf See this cuckoo.conf

The authentication token that is required to access the Cuckoo API, using

HTTP Bearer authentication. This will protect the API instance against

unauthorized access and CSRF attacks. It is strongly recommended to set this

to a secure value.

api_token = MDD567

The Web secret is used as a very basic, but successful way to provide basic

authentication to the Cuckoo Web Interface. This is a shared secret amongst

all users of this Cuckoo instance and will "protect" usage from users outside

of this instance. Therefore, if you'd like to share this Cuckoo instance with

the outside world, then don't use the Web secret functionality.

web_secret = {{ cuckoo.cuckoo.web_secret }}

. Thanks

nadir3392 commented 4 years ago

this is the correct form to make a file to analysis

import requests REST_URL = "http://your_IP/tasks/create/file" SAMPLE_FILE ='C:\Users\Vaio\Desktop\idmBroker.exe'

SAMPLE_FILE = '/home/cuckoo/Desktop/svchost.exe'

HEADERS = {"Authorization": "Bearer BL_RznQIxP"} with open(SAMPLE_FILE, "rb") as sample: files = {"file": ("temp_file_name", sample)} r = requests.post(REST_URL, headers=HEADERS, files=files) task_id = r.json()["task_id"]

api_token value exist in file .cuckoo/config/cuckoo.config


nadir3392 commented 4 years ago

plz close the issue.