""" r = trace.db.fetch_changes_by_clnum(clnum, 100) for e in r: print e """ clnum -= 1 cls = set(cls) cls.discard(inclnum) return list(cls) if __name__ == "__main__": # can run standalone for testing program = qira_program.Program("/tmp/qira_binary", []) trace = program.add_trace("/tmp/qira_logs/0", 0) while not trace.db.did_update(): time.sleep(0.1) print "loaded" program.qira_asm_file = open("/tmp/qira_asm", "r") qira_program.Program.read_asm_file(program) # *** analysis time *** flow = get_instruction_flow(trace, program, trace.db.get_minclnum(), trace.db.get_maxclnum()) blocks = get_blocks(flow, True) print slice(trace, 124)
if args.static: print "*** enabling static with engine", args.static qira_config.WITH_STATIC = True qira_config.STATIC_ENGINE = args.static if args.flush_cache: print "*** flushing caches" os.system("rm -rfv /tmp/qira*") # qemu args from command line qemu_args = [] if args.gate_trace != None: qemu_args.append("-gatetrace") qemu_args.append(args.gate_trace) # creates the file symlink, program is constant through server run program = qira_program.Program(args.binary, args.args, qemu_args) is_qira_running = 1 try: socket.create_connection(('127.0.0.1', qira_config.WEB_PORT)) if args.server: raise Exception("can't run as server if QIRA is already running") except: is_qira_running = 0 print "no qira server found, starting it" program.clear() # start the binary runner if args.server: qira_socat.start_bindserver(program, qira_config.SOCAT_PORT, -1, 1, True)
def test(): program = qira_program.Program("qira_tests/bin/loop") program.execqira(shouldfork=True) time.sleep(1)