mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-27 17:00:19 +00:00
aebda5213a
Next up: mmiotrace Signed-off-by: Hector Martin <marcan@marcan.st>
33 lines
820 B
Python
Executable file
33 lines
820 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import argparse, pathlib
|
|
|
|
parser = argparse.ArgumentParser(description='Run a Mach-O payload under the hypervisor')
|
|
parser.add_argument('-s', '--symbols', type=pathlib.Path)
|
|
parser.add_argument('payload', type=pathlib.Path)
|
|
parser.add_argument('boot_args', default=[], nargs="*")
|
|
args = parser.parse_args()
|
|
|
|
from proxy import *
|
|
from proxyutils import *
|
|
from utils import *
|
|
from hv import HV
|
|
|
|
iface = UartInterface()
|
|
p = M1N1Proxy(iface, debug=False)
|
|
bootstrap_port(iface, p)
|
|
u = ProxyUtils(p, heap_size = 128 * 1024 * 1024)
|
|
|
|
hv = HV(iface, p, u)
|
|
|
|
hv.init()
|
|
|
|
if len(args.boot_args) > 0:
|
|
boot_args = " ".join(args.boot_args)
|
|
hv.set_bootargs(boot_args)
|
|
|
|
symfile = None
|
|
if args.symbols:
|
|
symfile = args.symbols.open("rb")
|
|
hv.load_macho(args.payload.open("rb"), symfile=symfile)
|
|
hv.start()
|