Files
frida-frida-python/tests/test_tracer.py
T
Ole André Vadla Ravnås 6284b97c37 Factor out console application logic into a helper class
This introduces the -U/--usb switch for using a USB-tethered device instead
of the local system. Only iOS devices are supported for now (PR for completing
Android support in frida-core is most appreciated!).
2014-01-12 18:46:53 +01:00

46 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
import platform
import subprocess
import threading
try:
import unittest2 as unittest
except:
import unittest
import frida
from frida.application import Reactor
from frida.tracer import Tracer, TracerProfileBuilder, MemoryRepository, UI
class TestTracer(unittest.TestCase):
@classmethod
def setUpClass(cls):
system = platform.system()
if system == 'Windows':
cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
else:
cls.target = subprocess.Popen(["/bin/cat"])
cls.process = frida.attach(cls.target.pid)
@classmethod
def tearDownClass(cls):
cls.process.detach()
cls.target.terminate()
def test_basics(self):
never = threading.Event()
reactor = Reactor(never.wait)
def start():
tp = TracerProfileBuilder().include("open*")
t = Tracer(reactor, MemoryRepository(), tp.build())
targets = t.start_trace(self.process, UI())
t.stop()
reactor.stop()
reactor.schedule(start)
reactor.run()
if __name__ == '__main__':
unittest.main()