0 Members and 2 Guests are viewing this topic.
Hey Can you give me an example of non-ascii file name? (picture preferred, I don't know if the forum supports it)Also, can you show me the upload script, I'll check there's no error.
TOKEN='MyToken'def upload(filetoupload, vtsubmit=False, tags=None): # URL setup _get_param = (('token', TOKEN), ('action', 'uploadfiles')) _url = '?'.join([URL, urllib.parse.urlencode(_get_param)]) # POST params setup _metadata = {'index': 0, 'vtsubmit': vtsubmit, 'cksubmit': not vtsubmit, 'tags': tags} _file = {'upload_file': open(filetoupload, 'rb'), } _post_param = {'files_data': (_metadata, )} _res = requests.post(_url, files=_file, data=_post_param) if _res.status_code is 200: return _res.contentfor file in filelist: upload(file, vtsubmit=True, tags='Malware, doc')
Hey,I'll add the upload script example to the documentation, that's indeed a good idea.The character issue is due to the mysql database storing the data as ASCII. We'll try to see if adding utf8 encoding/decoding solves the issue, it's added to the backlog (todo list for next version).Is it working better (tags) with my upload script?
def getfiles_by_tags(self, tags): # setup url _get_param = (('token', self.token), ('action', 'getfiles'), ('tags', tags)) _url = '?'.join([self.url, urllib.parse.urlencode(_get_param)]) _res = requests.get(_url) if _res.status_code is 200: _result = _res.json() for file in _result['files']: yield file['md5'] else: return False
thepage = 0while True: results = query ( http://localhost/mrf/api.php?action=getfiles&token=bd5ca2c860ff601186cc50a42b213bbe&page=thepage&tags=test ) if results.empty: break # do something with results thepage = thepage + 1