Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_entrypoint_false(self):
with archr.targets.DockerImageTarget('archr-test:entrypoint-false').build().start() as t:
p = t.run_command()
p.wait()
assert p.returncode == 1
def test_datascout(self):
with archr.targets.DockerImageTarget('archr-test:entrypoint-env').build().start() as t:
_,_,_,maps = self.datascout_checks(t)
docker_ref = {
'/lib/x86_64-linux-gnu/libc-2.27.so': 0x7ffff79e4000,
'/lib/x86_64-linux-gnu/ld-2.27.so': 0x7ffff7dd5000,
'[stack-end]': 0x7ffffffff000,
'[heap]': 0x55555575d000,
'[vvar]': 0x7ffff7ff8000,
'[vdso]': 0x7ffff7ffb000,
'[vsyscall]': 0xffffffffff600000
}
assert all(maps[x] == docker_ref[x] for x in docker_ref)
def test_crasher_trace(self):
with archr.targets.DockerImageTarget('archr-test:crasher').build().start() as t:
self.crasher_checks(t)
def test_offsetprinter32(self):
#with archr.targets.DockerImageTarget('archr-test:offsetprinter').build().start() as t:
t = archr.targets.DockerImageTarget('archr-test:offsetprinter32', target_arch='i386').build().start()
self.check_offsetprinter(t)
t.stop()
def test_arrow_injection_docker(self):
with archr.targets.DockerImageTarget('archr-test:crasher').build().start() as t:
archr.arsenal.QEMUTracerBow(t)
fire_path = os.path.join(t.tmpwd, "shellphish_qemu", "fire")
assert t.retrieve_contents(fire_path).startswith(b"#!/bin/sh")
def test_cat(self):
with archr.targets.DockerImageTarget('archr-test:cat').build().start() as t:
p = t.run_command()
p.stdin.write(b"Hello!\n")
assert p.stdout.read(7) == b"Hello!\n"
def test_cat_docker(self):
with archr.targets.DockerImageTarget('archr-test:entrypoint-false').build().start() as t:
self.check_gdb_cat(t)
def test_env_angr(self):
with archr.targets.DockerImageTarget('archr-test:entrypoint-env').build().start() as t:
self.angr_checks(t)
required = {
'archr: git clone https://github.com/angr/archr && cd archr && pip install -e .':archr,
'keystone: pip install --no-binary keystone-engine keystone-engine':keystone
}
is_missing = [ key for key, value in required.items() if value is None ]
if len(is_missing) > 0:
req_msg = 'You need to install the following:\n\n\t' + '\n\t'.join(is_missing)
req_msg += '\n\nInstall them to enable this functionality.'
req_msg += '\nRelaunch angr-management after install.'
QMessageBox(self).critical(None, 'Dependency error', req_msg)
return
img_name = self._pick_image_dialog()
if img_name is None:
return
target = archr.targets.DockerImageTarget(img_name, target_path=None)
self.workspace.instance.add_job(LoadTargetJob(target))
self.workspace.instance.set_image(img_name)
#!/usr/bin/env python
import archr
import sys
with archr.targets.DockerImageTarget(sys.argv[1]).build().start() as t:
print("target remote %s:1337" % t.ipv4_address)
g = archr.arsenal.GDBServerBow(t)
g.fire(stdout=1, stderr=2, port=1337, timeout=None)