Пример #1
0
 def run(self, obj, config):
     mmb = MaliciousMacroBot()
     mmb.mmb_init_model()
     mmb.set_model_paths(benign_path=None, malicious_path=None, model_path=self.model)
     fc =(obj.filedata.read())
     result = mmb.mmb_predict(fc, datatype='filecontents')
     json = mmb.mmb_prediction_to_json(result)[0]
     for k,v in json.iteritems():
         if k == 'prediction':
             self._add_result("Prediction", v, {"name": k})
     for k,v in json.iteritems():
         if k != 'prediction': 
             self._add_result("Features", v, {"name": k})
Пример #2
0
 def run(self, obj, config):
     mmb = MaliciousMacroBot()
     mmb.mmb_init_model()
     mmb.set_model_paths(benign_path=None,
                         malicious_path=None,
                         model_path=self.model)
     f = tempfile.NamedTemporaryFile()
     f.write(obj.filedata.read())
     result = mmb.mmb_predict(f.name, datatype='filepath')
     f.close()
     json = mmb.mmb_prediction_to_json(result)[0]
     for k, v in json.iteritems():
         self._add_result("Prediction", k, {"value": v})