def checkRun(e, p, w): from gui import Gui if not os.path.exists(e.get()): Gui.alertErr("Error", "Configuration file not found", w) return try: conf = e.get() ce = CompilationEngine(conf) m = Manipulator(conf) p['value'] = 20 w.update_idletasks() m.generateSource() p['value'] = 40 w.update_idletasks() ce.createExes() p['value'] = 60 w.update_idletasks() complist = ce.getReport() vt = VirusTotal() p['value'] = 80 w.update_idletasks() report = vt.getScore(complist) p['value'] = 100 w.update_idletasks() str = "" i = 0 for x,y in complist.items(): str += "<{} : {}>\n".format(x,report[i]) i+=1 Gui.alertInfo("Result", str, w) except Exception as err: p['value'] = 0 w.update_idletasks() Gui.alertErr("Error", err, w)
def test_input_11(self): man = Manipulator("integration.conf.json") man.generateSource() comp = CompilationEngine("integration.conf.json") comp.createExes() self.assertTrue(os.path.exists("./gcc/a.out")) comp.clear()
def run_avevasion(self, hexed_filename, config_filename, path): #pickup config file based on hexed_filename and execute shell #conf = Path("C:\\Users\\ozne2\\Desktop\\Tesi\\AVevasion\\Wrapper\\AVevasion\\app\\uploads\\"+hexed_filename+"\\config\\"+config_filename) conf = Path(path + "\\" + hexed_filename + "\\config\\" + config_filename) ce = CompilationEngine(conf) m = Manipulator(conf) m.generateSource() ce.createExes() complist = ce.getReport() print(os.path) global vt report = vt.getScore(complist) print(complist) print(report) return report
def test_input5(self): man = Manipulator("man-obbligatori1.conf.json") man.generateSource() self.assertTrue(os.path.exists("out.c")) os.remove("out.c")
def test_input2(self): man = Manipulator("man-err2.conf.json") with self.assertRaises(ValueError): man.generateSource()
def test_input1(self): man = Manipulator("man-err1.conf.json") with self.assertRaises(KeyError): man.generateSource()
clear = True i += 1 elif sys.argv[i] == "--gui" or sys.argv[i] == "-G": some = True gui = True i += 1 if not some: usage() #main manageFlag() if gui: g = Gui() elif conf != "": ce = CompilationEngine(conf) m = Manipulator(conf) if clear: ce.clear() else: m.generateSource() ce.createExes() complist = ce.getReport() vt = VirusTotal() report = vt.getScore(complist) print(complist) print(report) else: usage()