Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def checkOption(self, e, l, index, root):
        from gui import Gui
        if len(e[0].get()) > 0:
            t = None
            if len(e[1].get()) > 0:
                if len(e[2].get()) > 0:
                    t = (e[0].get(), e[1].get().split(e[2].get()))
                    Gui.addElToList(l, t)
                else:
                    t = (e[0].get(), e[1].get().split(None))
                    Gui.addElToList(l, t)               
            else:
                t = (e[0].get(),[])
                Gui.addElToList(l, t)
            if index == 0:
                self.tmpOpt1.append(t)
            else:
                self.tmpOpt2.append(t)
        else:
            Gui.alertErr("Error", "Option name is obligatory", root)


        Ctrl.emptyText(e[0])
        Ctrl.emptyText(e[1])
        Ctrl.emptyText(e[2])
Exemplo n.º 3
0
 def checkSub(self, top, e, list):
     from gui import Gui
     if len(e[0].get()) != 0 and len(e[1].get()) != 0:
         self.conf.addToSub((e[0].get(),e[1].get()))
         Gui.addElToList(list, (e[0].get(),e[1].get()))
         Gui.destroyTop(top)
     else:
         Gui.alertErr("Error", "Both fields are obligatory", top)
Exemplo n.º 4
0
 def checkClear(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)
         ce.clear()
         p['value'] = 100
         w.update_idletasks()
         Gui.alertInfo("Info", "Cleaning completed", w)
     except Exception as err:
         p['value'] = 0
         w.update_idletasks()
         Gui.alertErr("Error", err, w)                      
Exemplo n.º 5
0
    def checkComp(self, top, e, list):
        from gui import Gui
        comp = Comp()
        if len(e[0].get()) != 0 and len(e[1].get()) != 0:
            comp.setName(e[0].get())
            comp.setPath(e[1].get())

            for t in self.tmpOpt1:
                comp.addOpt1(t)
            for t in self.tmpOpt2:
                comp.addOpt2(t)

            self.tmpOpt1 = []
            self.tmpOpt2 = []   

            self.listOfComp.append(comp)        
            Gui.addElToList(list, str(comp))
            Gui.destroyTop(top)
        else:
            Gui.alertErr("Error", "Fill obligatory fields", top)
Exemplo n.º 6
0
    def checkConf(self, e, l):
        from gui import Gui
        if len(e[0].get()) == 0 or len(e[1].get()) == 0 or len(e[2].get()) == 0 or len(e[3].get()) == 0:
            Gui.alertErr("Error", "Fill obligatory fields")
            return
        if len(self.listOfComp) == 0:
            Gui.alertErr("Error", "Insert at least a compilation test")
            return
        if len(e[6].get()) == 0:
            Gui.alertErr("Error", "Insert configuration file name")
            return  

        self.conf.setTemplatePath(e[0].get())
        self.conf.setPayloadPath(e[1].get())
        self.conf.setSpecialChar(e[2].get())
        self.conf.setPlaceholderPayload(e[3].get()) 
        if len(e[4].get()) != 0:
            try:
                rate = float(e[4].get())
                if not(rate >= 0 and rate < 1):
                    Gui.alertErr("Error", "The rate must be a decimal between (0,1]")
                    return
                self.conf.setFreq(rate)
            except ValueError:
                Gui.alertErr("Error", "The rate must be a decimal between (0,1]")
                return

        if len(e[5].get()) != 0:
            self.conf.setOut(e[5].get())    
        #vettore sub gestito a runtime
        
        print(str(self.conf))
        with open(e[6].get(), "w") as f:
            tmp = str(self.conf)
            tmp = tmp.replace("\'", "\"")
            f.write(tmp)
            Gui.alertErr("Info", "File saved : {}".format(e[6].get()))