Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
feat: add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfzxcvbn committed Mar 3, 2024
1 parent 09d2fd7 commit 9708e12
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions install-pyzule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if [ ! -d ${PZ_DIR}/CydiaSubstrate.framework ]; then
fi

echo "[*] installing pyzule.."
curl -so ~/.config/pyzule/version.json https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/version.json
sudo rm /usr/local/bin/pyzule &> /dev/null # yeah this is totally required leave me alone
sudo curl -so /usr/local/bin/pyzule https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/pyzule.py
if [ "$OS" == "Linux" ]; then
Expand Down
33 changes: 29 additions & 4 deletions pyzule.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import lief
import orjson
from PIL import Image
from requests import get

WORKING_DIR = os.getcwd()
USER_DIR = os.path.expanduser("~/.config/pyzule")
Expand All @@ -27,9 +28,9 @@

# set/get all args
parser = argparse.ArgumentParser(description="an azule \"clone\" written in python3.")
parser.add_argument("-i", metavar="input", type=str, required=True,
parser.add_argument("-i", metavar="input", type=str, required=False,
help="the .ipa/.app to patch")
parser.add_argument("-o", metavar="output", type=str, required=True,
parser.add_argument("-o", metavar="output", type=str, required=False,
help="the name of the patched .ipa/.app that will be created")
parser.add_argument("-z", metavar=".pyzule", type=str, required=False,
help="the .pyzule file to get info from")
Expand Down Expand Up @@ -71,11 +72,35 @@
help="inject into @executable_path")
parser.add_argument("-t", action="store_true",
help="use substitute instead of substrate")
parser.add_argument("--update", action="store_true",
help="check for updates")
args = parser.parse_args()

if args.update:
print("[*] checking for updates..")
with open(f"{USER_DIR}/version.json", "rb") as f:
info = orjson.loads(f.read())

new = orjson.loads(get(
"https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/version.json")
.content)

# guys please please please update to python 3.12 :pray:
if new["internal"] > info["internal"]:
print("[*] an update is available!")
print(f"[*] update: {info['version']} -> {new['version']}")
print(f"[*] link: https://github.com/asdfzxcvbn/pyzule/releases/tag/{new['version']}")
exit(0)
else:
print("[?] no update detected")
exit(1)

# sanitize paths
args.i = os.path.normpath(args.i)
args.o = os.path.normpath(args.o)
try:
args.i = os.path.normpath(args.i)
args.o = os.path.normpath(args.o)
except TypeError:
parser.error("the following arguments are required: -i, -o")

# checking received args for errors
if not args.i.endswith(".ipa") and not args.i.endswith(".app"):
Expand Down
1 change: 1 addition & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"internal": 1, "version": "v1.3"}

0 comments on commit 9708e12

Please sign in to comment.