Ejemplo n.º 1
0
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"
Ejemplo n.º 2
0
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"
Ejemplo n.º 3
0
            modules.append(a.split("|"))
        elif o == "-d":
            debug = True
        elif o == "-l":
            logfile = True
        else:
            usage(imm)
            return "Unknown option"

    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"
Ejemplo n.º 4
0
        elif o == "-l":
            logfile=True
        elif o == "-i":
            listmods=True
        elif o == "-h":
            host = a
        else:
            usage(imm)
            return "Unknown option"
    
    if not modules and not allmodules and not listmods:
        usage(imm)
        return "you must select a module to analyze and store"

    if logfile:
        gdbimm = MyDebugger(template="gadgets_db-log-")
    else:
        gdbimm = imm
    
    gdb = GadgetsDB(gdbimm, dbtype, dbname, host, username, passwd)
    gdb.debug=debug
    gdb.force_analysis=force
    gdb.max_gadgets=maxgadgets
    
    if not gdb.db_connection:
        imm.log("[!] Could not connect to db, exiting...")
        return "Failed to connect to DB"
    
    if dbtype == "sqlite3" and not nobackup and not listmods:
        imm.log("[*] Database backup: %s.bak" % gdb.database_file)
        shutil.copyfile(gdb.database_file, "%s.bak" % gdb.database_file)
Ejemplo n.º 5
0
         modules.append(a.split("|"))
     elif o == "-d":
         debug=True
     elif o == "-l":
         logfile=True
     else:
         usage(imm)
         return "Unknown option"
 
 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"