class ExploitVerification(unittest.TestCase): def __init__(self, exploit): unittest.TestCase.__init__(self, methodName="runTest") self.exploit = exploit return def setUp(self): self.engine = Engine(self.exploit(), config) self.engine.startup() def tearDown(self): self.engine.shutdown() def runTest(self): self.engine.xdebug_autotrace_on() self.engine.exploit.exploit() self.engine.xdebug_autotrace_off() try: self.assertTrue(self.engine.exploit.verify(), msg="Verification failed for (%s):" % (self.engine.exploitname,)) except NotImplementedError as e: self.fail(msg="verify method not implemented for (%s):" % (self.engine.exploitname,)) return ''' def test_CVE_2012_2922(self):
exploitname = get_running() if not exploitname: logger.error("No application is currently running") exit(-1) Exploit = Query().get_by_name(exploitname) if not Exploit: logger.error("Unable to find exploit for session %s", exploitname) exit(-1) if sys.argv[1] == "stop": logger.info("Stopping exploit instance (%s)", Exploit.attributes['Name']) engine = Engine(Exploit(), config) engine.shutdown() exit() elif sys.argv[1] == "trace_on": logger.info("Trace on for exploit %s", exploitname) engine = Engine(Exploit(), config) engine.xdebug_autotrace_on() exit() elif sys.argv[1] == "trace_off": logger.info("Trace off for exploit %s", exploitname) engine = Engine(Exploit(), config) engine.xdebug_autotrace_off() exit()
import config exploitname = get_running() if not exploitname: logger.error("No application is currently running") exit(-1) Exploit = Query().get_by_name(exploitname) if not Exploit: logger.error("Unable to find exploit for session %s", exploitname) exit(-1) if sys.argv[1] == "stop": logger.info("Stopping exploit instance (%s)", Exploit.attributes['Name']) engine = Engine(Exploit(), config) engine.shutdown() exit() elif sys.argv[1] == "trace_on": logger.info("Trace on for exploit %s", exploitname) engine = Engine(Exploit(), config) engine.xdebug_autotrace_on() exit() elif sys.argv[1] == "trace_off": logger.info("Trace off for exploit %s", exploitname) engine = Engine(Exploit(), config) engine.xdebug_autotrace_off() exit()