I'm trying to upload an exported scan (.nessus) file to a Nessus Community Edition server using python and the Nessus REST API (func POST /file/upload) however I keep getting the response null
like this {"fileuploaded":null}
in the response.
I can't seem to see in the API doc's what else could be required.
def upload_scan_file(_path):
_url = url+"/file/upload"
_head['Content-type'] = ''
_files = {"file": open(_path, 'rb'), "no_enc" : "0"}
r = requests.post(_url, headers=_head, verify=False, files=_files)
return r.text
The reason I unset the Content-type
key in the headers dict is that I get a {'error': Content-type: application/json not supported'}
_path
contains the file path.
_head
is a dict of header values that I use to query all the others information.
Any help would be appreciated.