original_docstring: 
          Submits the given file path to cuckoo with the provided conditions.
          :param filepath:
          :param tags:
          :return:
          
docstring: Submits the given file path to cuckoo with the provided conditions.
docstring_tokens: Submits the given file path to cuckoo with the provided conditions .
code: def submit_new_file(self, filepath, tags=[]):
          """
          Submits the given file path to cuckoo with the provided conditions.
          :param filepath:
          :param tags:
          :return:
          """
          with open(filepath, 'rb') as sample:
              fname = os.path.basename(filepath)
              mp_file = {'file': (fname, sample)}
              self.log.debug('Creating task for tags: {}'.format(','.join(tags)))
              # Cuckoo expects a comma separated list of tags
              data = {}
              data['options'] = ''
              if len(tags) > 0:
                  data['tags'] = ','.join(tags)
              r = requests.post("{0}/tasks/create/file".format(self.baseurl),
                                files=mp_file,
                                data=data,
                                proxies=self.proxies,
                                verify=self.verify)
  
          if r.status_code != 200:
              self.log.error('File submission to cuckoo failed for file '
                             '{0}'.format(filepath))
              self.log.error('Status code was: {0}'.format(r.status_code))
              self.log.error('Object was: {0}'.format(repr(r)))
              return []
  
          # Add the sample to the files this worker is tracking.
          json_decoder = json.JSONDecoder()
          response = json_decoder.decode(r.text)
          if 'error' in response:
              if response['error']:
                  self.log.error('Error received when creating a new task for '
                                 'file {0}. Error: '
                                 '{1}'.format(filepath,
                                              response['error_value']))
                  return []
  
          if response['task_id'] is None:
              self.log.error('Received no task_ids when submitting the file '
                             '{0}'.format(filepath))
              return []
  
          self.log.info('{0} submitted to Cuckoo successfully.'.format(filepath))
          # TODO: This is hacky for now, but I believe we may want to submit
          # multiple files in the future in this function?
          return [response['task_id']]
code_tokens: def submit_new_file ( self , filepath , tags = [ ] ) : with open ( filepath , 'rb' ) as sample : fname = os . path . basename ( filepath ) mp_file = { 'file' : ( fname , sample ) } self . log . debug ( 'Creating task for tags: {}' . format ( ',' . join ( tags ) ) ) data = { } data [ 'options' ] = '' if len ( tags ) > 0 : data [ 'tags' ] = ',' . join ( tags ) r = requests . post ( "{0}/tasks/create/file" . format ( self . baseurl ) , files = mp_file , data = data , proxies = self . proxies , verify = self . verify ) if r . status_code != 200 : self . log . error ( 'File submission to cuckoo failed for file ' '{0}' . format ( filepath ) ) self . log . error ( 'Status code was: {0}' . format ( r . status_code ) ) self . log . error ( 'Object was: {0}' . format ( repr ( r ) ) ) return [ ] json_decoder = json . JSONDecoder ( ) response = json_decoder . decode ( r . text ) if 'error' in response : if response [ 'error' ] : self . log . error ( 'Error received when creating a new task for ' 'file {0}. Error: ' '{1}' . format ( filepath , response [ 'error_value' ] ) ) return [ ] if response [ 'task_id' ] is None : self . log . error ( 'Received no task_ids when submitting the file ' '{0}' . format ( filepath ) ) return [ ] self . log . info ( '{0} submitted to Cuckoo successfully.' . format ( filepath ) ) return [ response [ 'task_id' ] ]
short_docstring: Submits the given file path to cuckoo with the provided conditions.
short_docstring_tokens: Submits the given file path to cuckoo with the provided conditions .
comment: """
          Submits the given file path to cuckoo with the provided conditions.
          :param filepath:
          :param tags:
          :return:
          """$SEP$# Cuckoo expects a comma separated list of tags$SEP$# Add the sample to the files this worker is tracking.$SEP$# TODO: This is hacky for now, but I believe we may want to submit$SEP$# multiple files in the future in this function?