Ejemplo n.º 1
0
def execute(tfl):
    bbs={}
    args=config.SUT % tfl
    runcmd=config.PINCMD+args.split(' ')
    try:
        os.unlink(config.BBOUT)
    except:
        pass
    retc = run(runcmd)
    #check if loading address was changed
    #liboffsetprev=int(config.LIBOFFSETS[1],0)
    if config.LIBNUM == 2:
        if config.BIT64 == False:
            liboffsetcur=int(libfd_mm[:10],0)
        else:
            liboffsetcur=int(libfd_mm[:],0)
        libfd_mm.seek(0)
        if liboffsetcur != int(config.LIBOFFSETS[1],0):
            #print "Load address changed!"
            gau.die("load address changed..run again!")
    # open BB trace file to get BBs
    bbs = bbdict(config.BBOUT)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)
    return (bbs,retc)
Ejemplo n.º 2
0
def execute(tfl):
    bbs = {}
    args = config.SUT % tfl
    ih = config.PINCMD.index("$")
    config.PINCMD[ih] = tfl
    runcmd = config.PINCMD + args.split(' ')
    try:
        os.unlink(config.BBOUT)
    except:
        pass
    retc = run(runcmd)
    #check if loading address was changed
    #liboffsetprev=int(config.LIBOFFSETS[1],0)
    if config.LIBNUM == 2:
        if config.BIT64 == False:
            liboffsetcur = int(libfd_mm[:10], 0)
        else:
            liboffsetcur = int(libfd_mm[:18], 0)
        libfd_mm.seek(0)
        if liboffsetcur != int(config.LIBOFFSETS[1], 0):
            #print "Load address changed!"
            print liboffsetcur, int(config.LIBOFFSETS[1], 0)
            gau.die("load address changed..run again!")
    # open BB trace file to get BBs
    bbs = bbdict(config.BBOUT)
    #print bbs
    for bb in bbs.keys():
        config.globalbb.add(bb)
        config.tempbb.add(bb)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)
    config.PINCMD[ih] = "$"
    return (bbs, retc)
Ejemplo n.º 3
0
def execute2(tfl, fl, is_initial=0):
    args = config.SUT % tfl
    args = '\"' + args + '\"'  # For cmd shell
    pargs = config.PINTNTCMD[:]

    if is_initial == 1:
        runcmd = [pargs[0], args, fl, "0"] 
    else:
        runcmd = [pargs[0], args, fl, str(config.TIMEOUT)]

    # pargs[pargs.index("inputf")]=fl
    # runcmd=pargs + args.split.split(' ')

    #print "[*] args : ", args
    #print "[*] tfl : ", tfl
    #print "[*] config.SUT : ", config.SUT

    #print "[*] execute : %s" % (" ".join(runcmd))


    retc = run(runcmd)

    if config.CLEARSPECIALOUTPUT:
        gau.delete_special_out_file(config.SPECIALOUTPUT)

    #print "[+] Done with exit code %d" % (retc)

    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)

    return retc
Ejemplo n.º 4
0
def execute_without_analysis(tfl):
    bbs = {}
    args = config.SUT % tfl
    runcmd = args.split(' ')
    retc = timeout_command(runcmd, 10)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)
    if retc == None:
        return None
    return retc
Ejemplo n.º 5
0
def execute2(tfl,fl):
    args=config.SUT % tfl
    pargs=config.PINTNTCMD[:]
    pargs[pargs.index("inputf")]=fl
    runcmd=pargs+args.split(' ')
    #print "[*] Executing: ",runcmd 
    retc = run(runcmd)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)
    return retc
Ejemplo n.º 6
0
def execute2(tfl,fl, is_initial=0):
    args=config.SUT % tfl
    args='\"' + args + '\"' # For cmd shell
    pargs=config.PINTNTCMD[:]
    if is_initial == 1:
      runcmd = [pargs[0], args, fl, "0"]
    else:
      runcmd = [pargs[0], args, fl, str(config.TIMEOUT)]
    #pargs[pargs.index("inputf")]=fl
    #runcmd=pargs + args.split.split(' ')
    
    #print "[*] Executing: ",runcmd 
    retc = run(runcmd)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)
    return retc
Ejemplo n.º 7
0
def execute(tfl):
    bbs = {}
    args = config.SUT % tfl
    runcmd = config.BBCMD+args.split(' ')
    try:
        os.unlink(config.BBOUT)
    except:
        pass

    #print "[*] args : ", args
    #print "[*] tfl : ", tfl
    #print "[*] config.SUT : ", config.SUT

    #print "[*] execute : %s" % (" ".join(runcmd))

    retc = run(runcmd)

    #print "[*] Done with exit code %d" % (retc)

    # check if loading address was changed
    # liboffsetprev=int(config.LIBOFFSETS[1],0)
    if config.LIBNUM == 2:

        if config.BIT64 == False:
            liboffsetcur = int(libfd_mm[:10], 0)
        else:
            liboffsetcur = int(libfd_mm[:18], 0)

        libfd_mm.seek(0)
        
        if liboffsetcur != int(config.LIBOFFSETS[1], 0):
            # print "Load address changed!"
            gau.die("[-] Load address of %s changed to 0x%x and you gave 0x%x : change it in launch options" % (config.LIBTOMONITOR, liboffsetcur, int(config.LIBOFFSETS[1], 0)))

    if config.CLEARSPECIALOUTPUT:
        gau.delete_special_out_file(config.SPECIALOUTPUT)

    # open BB trace file to get BBs
    bbs = bbdict(config.BBOUT)
    if config.CLEANOUT == True:
        gau.delete_out_file(tfl)

    return (bbs, retc)