예제 #1
0
def android_test_setup(testbin):
    utils.green('testing %s' % testbin)

    # send file to phone
    fpath = testbin_to_fpath(testbin)
    shellout(['adb', 'push', fpath, '/data/local/tmp'])

    # launch adb
    threading.Thread(target=invoke_adb_gdb_listen, args=[testbin]).start()

    # connect to adb
    time.sleep(.25)
    adapter = gdb.DebugAdapterGdb()
    adapter.connect('localhost', 31337)
    entry = confirm_initial_module(adapter, testbin)

    return (adapter, entry)
예제 #2
0
if __name__ == '__main__':
	colorama.init()

	# set up ctrl+c for break-into
	signal.signal(signal.SIGINT, handler_sigint)
	if platform.system() == 'Windows':
		adjust_ctrl_c()

	adapter = None
	if not sys.argv[1:]:
		raise Exception('specify target on command line')
	arg1 = sys.argv[1]
	if re.match(r'^.*:\d+$', arg1):
		(host, port) = arg1.split(':')
		adapter = gdb.DebugAdapterGdb()
		adapter.setup()
		adapter.connect(host, int(port))
	else:
		if '~' in arg1:
			arg1 = os.expanduser(arg1)
		arg1 = os.path.abspath(arg1)
		if not os.path.exists(arg1):
			raise Exception('file not found: %s' % arg1)

		adapter = DebugAdapter.get_adapter_for_current_system()
		adapter.setup()
		adapter.exec(arg1, '')

	arch = adapter.target_arch()