def test_sourceCodeGenerator(self): testFolder = "/home/gbt/Developpements/DLL_Injection/got_netzob" # create the parasite generator parasiteGenerator = ParasiteGenerator(testFolder) # register the two following functions to hijack # int SSL_read(void *ssl,char *buf,int num); # int SSL_write(void *ssl,char *buf,int num); # sslReadFunc = HijackedFunction("SSL_read", "int", ["void *", "char *", "int"]) # sslWriteFunc = HijackedFunction("SSL_write", "int", ["void *", "char *", "int"]) putsFunc = HijackedFunction("puts", "int", [ ["char *", "param0"]]) putsFunc.setSource('''''') # parasiteGenerator.addAnHijackedFunctions(sslReadFunc) # parasiteGenerator.addAnHijackedFunctions(sslWriteFunc) parasiteGenerator.addAnHijackedFunctions(putsFunc) parasiteGenerator.writeParasiteToFile() parasiteGenerator.compileParasite() parasiteGenerator.linkParasite() injectorGenerator = InjectorGenerator("/home/gbt/Developpements/DLL_Injection/got_netzob", parasiteGenerator) injectorGenerator.writeInjectorToFile() injectorGenerator.compileInjector() poisoner = GOTPoisoner(parasiteGenerator, injectorGenerator) poisoner.injectProcess(20121)
def startCaptureFunction(self, button): if self.selectedProcess is None: self.log.warning( "You have to select a process if you want to capture it") return if self.selectedDLL is None: self.log.warning( "You have to select a DLL if you want to capture it") return if self.selectedFunction is None: self.log.warning( "You have to select a function if you want to capture it") return # Create a temporary folder (secure way) <- hihihihi tmpFolder = tempfile.mkdtemp() self.log.info("Temporary folder: {0}".format(tmpFolder)) parasiteGenerator = ParasiteGenerator(tmpFolder) parasiteGenerator.addAnHijackedFunctions(self.selectedFunction) parasiteGenerator.writeParasiteToFile() parasiteGenerator.compileParasite() parasiteGenerator.linkParasite() injectorGenerator = InjectorGenerator(tmpFolder, parasiteGenerator) injectorGenerator.writeInjectorToFile() injectorGenerator.compileInjector() poisoner = GOTPoisoner(parasiteGenerator, injectorGenerator) poisoner.injectProcess(self.selectedProcess.getPid()) self.fifoFile = parasiteGenerator.getFifoFile() self.aSniffThread = threading.Thread(None, self.sniffThread, None, (), {}) self.aSniffThread.start() self.log.info("Starting the capture of [{0}]".format( self.selectedProcess.getPid())) self.log.info("DLL [{0}]".format(self.selectedDLL.getName())) self.log.info("Function [{0}]".format( self.selectedFunction.getPrototype()))
def startCaptureFunction(self, button): if self.selectedProcess == None: self.log.warning(_("You have to select a process if you want to capture it")) return if self.selectedDLL == None: self.log.warning(_("You have to select a DLL if you want to capture it")) return if self.selectedFunction == None: self.log.warning(_("You have to select a function if you want to capture it")) return # Create a temporary folder (secure way) <- hihihihi tmpFolder = tempfile.mkdtemp() self.log.info(_("Temporary folder: {0}").format(tmpFolder)) parasiteGenerator = ParasiteGenerator(tmpFolder) parasiteGenerator.addAnHijackedFunctions(self.selectedFunction) parasiteGenerator.writeParasiteToFile() parasiteGenerator.compileParasite() parasiteGenerator.linkParasite() injectorGenerator = InjectorGenerator(tmpFolder, parasiteGenerator) injectorGenerator.writeInjectorToFile() injectorGenerator.compileInjector() poisoner = GOTPoisoner(parasiteGenerator, injectorGenerator) poisoner.injectProcess(self.selectedProcess.getPid()) self.fifoFile = parasiteGenerator.getFifoFile() self.aSniffThread = threading.Thread(None, self.sniffThread, None, (), {}) self.aSniffThread.start() self.log.info(_("Starting the capture of [{0}]").format(self.selectedProcess.getPid())) self.log.info(_("DLL [{0}]").format(self.selectedDLL.getName())) self.log.info(_("Function [{0}]").format(self.selectedFunction.getPrototype()))