From 519c3ba2bb4dfbe3cd0569bac70aaf3f3eadb41b Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Sun, 23 Jul 2023 15:37:43 -0400 Subject: [PATCH] relative imports --- .gitignore | 1 + emulated/jelly.py | 2 +- emulated/test.py | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1ddd245..b777fcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ config.json +IMDAppleServices # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/emulated/jelly.py b/emulated/jelly.py index 75f49a3..383f391 100644 --- a/emulated/jelly.py +++ b/emulated/jelly.py @@ -1,6 +1,6 @@ from io import BytesIO import unicorn -import mparser as macholibre +from . import mparser as macholibre STOP_ADDRESS = 0x00900000 # Used as a return address when calling functions diff --git a/emulated/test.py b/emulated/test.py index f79356c..ebc8d9b 100644 --- a/emulated/test.py +++ b/emulated/test.py @@ -1,13 +1,13 @@ import hashlib -import mparser as macholibre -from jelly import Jelly +from . import mparser as macholibre +from .jelly import Jelly import plistlib BINARY_HASH = "e1181ccad82e6629d52c6a006645ad87ee59bd13" -BINARY_PATH = "/Users/jjtech/Downloads/IMDAppleServices" +BINARY_PATH = "emulated/IMDAppleServices" BINARY_URL = "https://github.com/JJTech0130/nacserver/raw/main/IMDAppleServices" -FAKE_DATA = plistlib.load(open("data.plist", "rb")) +FAKE_DATA = plistlib.load(open("emulated/data.plist", "rb")) def load_binary() -> bytes: # Open the file at BINARY_PATH, check the hash, and return the binary @@ -18,6 +18,8 @@ def load_binary() -> bytes: print("Downloading binary...") resp = requests.get(BINARY_URL) b = resp.content + # Save the binary + open(BINARY_PATH, "wb").write(b) else: b = open(BINARY_PATH, "rb").read() if hashlib.sha1(b).hexdigest() != BINARY_HASH: