integrate it into the demo

This commit is contained in:
JJTech0130 2023-07-23 15:47:35 -04:00
parent 519c3ba2bb
commit 281f9e8cb2
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
3 changed files with 21 additions and 14 deletions

View file

@ -79,7 +79,10 @@ if CONFIG.get("id", {}).get("cert") is not None:
id_keypair = ids._helpers.KeyPair(CONFIG["id"]["key"], CONFIG["id"]["cert"])
user.restore_identity(id_keypair)
else:
vd = input_multiline("Enter validation data: ")
#vd = input_multiline("Enter validation data: ")
import emulated.nac
vd = emulated.nac.generate_validation_data()
vd = b64encode(vd).decode()
user.register(vd)
print(user.lookup(["mailto:textgpt@icloud.com"]))

View file

@ -2,6 +2,9 @@ from io import BytesIO
import unicorn
from . import mparser as macholibre
print = lambda *args, **kwargs: None
STOP_ADDRESS = 0x00900000 # Used as a return address when calling functions
ARG_REGISTERS = [

View file

@ -350,11 +350,12 @@ def arc4random(j: Jelly) -> int:
return random.randint(0, 0xFFFFFFFF)
#return 0
def main():
def load_nac() -> Jelly:
binary = load_binary()
binary = get_x64_slice(binary)
# Create a Jelly object from the binary
j = Jelly(binary)
hooks = {
"_malloc": malloc,
"___stack_chk_guard": lambda: 0,
@ -395,22 +396,22 @@ def main():
"_arc4random": arc4random
}
j.setup(hooks)
#j.uc.hook_add(unicorn.UC_HOOK_CODE, hook_code)
from base64 import b64encode
cert = get_cert()
val_ctx, req = nac_init(j,cert)
print(f"Validation Context: {hex(val_ctx)}")
print(f"Request: {b64encode(req).decode()}")
return j
def generate_validation_data() -> bytes:
j = load_nac()
val_ctx, req = nac_init(j,get_cert())
session_info = get_session_info(req)
print(f"Session Info: {b64encode(session_info).decode()}")
nac_submit(j, val_ctx, session_info)
val_data = nac_generate(j, val_ctx)
print(f"Validation Data: {b64encode(val_data).decode()}")
return bytes(val_data)
if __name__ == "__main__":
main()
from base64 import b64encode
val_data = generate_validation_data()
print(f"Validation Data: {b64encode(val_data).decode()}")
#main()
else:
# lazy hack: Disable print so that it's clean when not debugging
print = lambda *args, **kwargs: None