def main(args): imm = MyDebugger() start_addr = None end_addr = None output_reg = None lower = LOWER upper = UPPER user_regs = None timeout = None range_size = RANGE_MIN precise_mode = False try: opts, argo = getopt.getopt(args, "s:e:r:u:v:a:t:p", ["start_addr=", "end_addr=", "output_reg=", "value_range=", "user_regs=", "range_size", "timeout=" "precise"]) except getopt.GetoptError, reason: imm.log("Exception when parsing arguments: %s" % reason) log_traceback(imm) return "Error parsing arguments. See log for details"
if not exp: usage(imm) imm.log("[!] -e is mandatory") return "Error, check script usemode" if logfile: imm = MyDebugger(template="findpivot-log-") sm = StateMachine(solver=PrettySolver()) #define the module/s to use in the search and all the database information here gf = GadgetFinder(imm, modules, dbname, dbtype, host, username, passwd) gf._debug = debug if debug: imm.log("[*] RAW Expression: %s" % str(exp)) exp = parseExpression(exp, sm) if exp == None: imm.log("[!] Expression could not be parsed, please review it") return "Error, check usemode" imm.log("[*] Parsed Expression: %s" % str(exp)) imm.log("[*] Stopping after %d results" % results_count) findings = [] #simulate a XCHG ESP, EXP/RETN sm.regs["ESP"] = exp sm.EIP = sm.readMemory(sm.regs["ESP"], 4)
if not exp: usage(imm) imm.log("[!] -e is mandatory") return "Error, check script usemode" if logfile: imm = MyDebugger(template="findpivot-log-") sm=StateMachine(solver=PrettySolver()) #define the module/s to use in the search and all the database information here gf=GadgetFinder(imm, modules, dbname, dbtype, host, username, passwd) gf._debug=debug if debug: imm.log("[*] RAW Expression: %s"%str(exp)) exp=parseExpression(exp, sm) if exp == None: imm.log("[!] Expression could not be parsed, please review it") return "Error, check usemode" imm.log("[*] Parsed Expression: %s"%str(exp)) imm.log("[*] Stopping after %d results"%results_count) findings=[] #simulate a XCHG ESP, EXP/RETN sm.regs["ESP"]=exp sm.EIP=sm.readMemory(sm.regs["ESP"], 4)