Closed acd62081 closed 3 years ago
I assume this is similar or the same as this issue: https://github.com/viper-framework/viper/issues/785 right?
Yes, that is the same issue. For the module, you would need to edit cuckoo.py to something like this starting at line 65 :
if files:
if cfg.cuckoo.cuckoo_modified:
try:
response = requests.post(api_uri, files=files, data=params,
proxies=cfg.cuckoo.proxies, verify=cfg.cuckoo.verify, cert=cfg.cuckoo.cert)
else:
auth_headers = {'Authorization': "Bearer {0}".format(cfg.cuckoo.auth_token)}
response = requests.post(uri, headers=auth_headers, files=options)
viper.conf file edit is listed above.
I haven't tested the module functionality with this config yet though.
Hi @acd62081 ,
Thanks for sharing your experience. Greatly appreciated!
Yes, that is the same issue. For the module, you would need to edit cuckoo.py to something like this starting at line 65 :
if files: if cfg.cuckoo.cuckoo_modified: try: response = requests.post(api_uri, files=files, data=params, proxies=cfg.cuckoo.proxies, verify=cfg.cuckoo.verify, cert=cfg.cuckoo.cert) else: auth_headers = {'Authorization': "Bearer {0}".format(cfg.cuckoo.auth_token)} response = requests.post(uri, headers=auth_headers, files=options)
viper.conf file edit is listed above.
I haven't tested the module functionality with this config yet though.
I tested above changes & had to update cuckoo.py as follows
65 if files:
66 if cfg.cuckoo.cuckoo_modified:
67 try:
68 response = requests.post(api_uri, files=files, data=params,
69 proxies=cfg.cuckoo.proxies, verify=cfg.cuckoo.verify, cert=cfg.cuckoo.cert)
70 except requests.ConnectionError:
71 self.log('error', "Unable to connect to Cuckoo API at '{0}'.".format(api_uri))
72 return
73 except Exception as e:
74 self.log('error', "Failed performing request at '{0}': {1}".format(api_uri, e))
75 return
76 else:
77 auth_headers = {'Authorization': "Bearer {0}".format(cfg.cuckoo.auth_token)}
78 response = requests.post(uri, headers=auth_headers, files=options)
I am using Cuckoo Version 2.0.7 and I am getting an error of Unable to Submit File with a 401 Unauthorized error code when submitting to Cuckoo from Viper Web. Newer versions of Cuckoo requires an API token in the header to access the API according to the Cuckoo Docs https://cuckoo.readthedocs.io/en/latest/usage/api/#starting-the-api-server
To fix this, I had to replace this line (line 711) in views.py:
cuckoo_response = requests.post(uri, files=options)
with this
Then I had to add an auth_token line to the cuckoo section of viper.conf