How to use the archr.arsenal.STraceAttachBow function in archr

To help you get started, we’ve selected a few archr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angr / archr / tests / test_bow_strace.py View on Github external
def check_strace_attach(self, t, **kwargs):
        target = t.run_command() # start target
        b = archr.arsenal.STraceAttachBow(t)
        pid = target.pid if isinstance(t, archr.targets.LocalTarget) else t.get_proc_pid('socat')
        with b.fire_context(pid=pid, trace_args=STRACE_ARGS, **kwargs) as flight:
            sleep(2)
            nc = flight.open_channel('tcp:0') # misuse of flight
            nc.send(b'ahoi!')
            assert nc.readuntil(b'ahoi!', timeout=5) == b'ahoi!'
            nc.close()
            target.terminate()

        trace = flight.result.splitlines()
        assert any(b'read' in t and b'ahoi' in t for t in trace)
        assert any(b'write' in t and b'ahoi' in t for t in trace)