Skip to content

Commit 6ac8b8a

Browse files
Improve inject.sh
Now it can automatically download the original .ipa file. Plus some improvements.
1 parent c2945da commit 6ac8b8a

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

inject.sh

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
###
66

77
ORIGINAL_IPA_NAME="original.ipa"
8+
ORIGINAL_IPA_SHA256="187253d4aa1c951af95957a49b926cfb7be4e953af578b6963fb4c7c9c0b6cb0"
9+
ORIGINAL_IPA_URL="https://archive.org/download/i-3-u-so-com.julienadam.cassius-1.04/I-3-U-SO-com.julienadam.cassius-1.04.ipa"
10+
ORIGINAL_ICON_URL="https://web.archive.org/web/20240111215624if_/https://is4-ssl.mzstatic.com/image/thumb/Purple/2b/df/56/mzi.rptjtlhi.png/738x0w.png"
811
IPA_NAME="iloveusomuch.ipa"
912

1013
if [ "$1" == "project" ]; then
1114
OUT_DIR="./iloveusomuch/originalAssets"
1215
else
1316
OUT_DIR="./Payload/iloveusomuch.app"
14-
mkdir -p $OUT_DIR
1517
fi
1618

1719
zipPath="Payload/Cassius.app/"
@@ -22,8 +24,28 @@ zipFiles=(
2224
"${zipPath}Videos.m4v"
2325
)
2426

27+
# Suggest downloading the original ipa file if it doesn't exit
2528
if ! [ -f "./$ORIGINAL_IPA_NAME" ]; then
26-
echo "Please put the original .ipa file under the '$ORIGINAL_IPA_NAME' name first"
29+
echo "The original.ipa file doesn't exist. This script can automatically download it from archive.org."
30+
echo "Note: this file contains copyrighted materials that will be injected into the resulting app."
31+
echo "\033[0;31m$(tput bold)You CANNOT distribute the resulting $IPA_NAME file in any way. For personal use only.$(tput sgr0)\033[0m"
32+
while [ "$choice" != "n" ] && [ "$choice" != "y" ]; do
33+
printf "Do you want to continue? [y/n]: "
34+
read choice
35+
done
36+
if [ "$choice" == "n" ]; then
37+
exit 0
38+
fi
39+
echo "Downloading the original app..."
40+
curl -SLo "./$ORIGINAL_IPA_NAME" "$ORIGINAL_IPA_URL"
41+
if ! [ $? = 0 ]; then
42+
echo "Failed to download the original app"
43+
exit 1
44+
fi
45+
fi
46+
47+
if [ "`openssl dgst -sha256 "./$ORIGINAL_IPA_NAME" | sed -E 's/SHA(2-)?256(.*)= //'`" != "$ORIGINAL_IPA_SHA256" ]; then
48+
echo "$ORIGINAL_IPA_NAME has an unexpected checksum. Try downloading it again."
2749
exit 1
2850
fi
2951

@@ -36,23 +58,29 @@ for file in ${zipFiles[@]}; do
3658
fi
3759
done
3860

61+
if [ "$1" != "project" ]; then
62+
mkdir -p "$OUT_DIR"
63+
fi
64+
3965
# Create an argument for unzip to extract only these files
4066
zipFilesArg=""
4167
for file in ${zipFiles[@]}; do
4268
zipFilesArg="${zipFilesArg} ${file}"
4369
done
4470

45-
unzip -j $ORIGINAL_IPA_NAME ${zipFilesArg} -d $OUT_DIR
71+
echo "Extracting original files..."
72+
unzip -j "$ORIGINAL_IPA_NAME" ${zipFilesArg} -d "$OUT_DIR" > /dev/null
4673

4774
if ! [ $? = 0 ]; then
4875
echo "Failed to uncompress the archive"
4976
exit 1
50-
fi;
77+
fi
5178

52-
mv $OUT_DIR/[email protected] $OUT_DIR/loader.png
79+
mv "$OUT_DIR/[email protected]" "$OUT_DIR/loader.png"
5380

5481
# Download the original app icon from web.archive.org
55-
curl -o $OUT_DIR/AppIcon.png "https://web.archive.org/web/20240111215624if_/https://is4-ssl.mzstatic.com/image/thumb/Purple/2b/df/56/mzi.rptjtlhi.png/738x0w.png"
82+
echo "Downloading the original app icon..."
83+
curl -LsSo "$OUT_DIR/AppIcon.png" "$ORIGINAL_ICON_URL"
5684
if ! [ $? = 0 ]; then
5785
echo "Failed to download an app icon"
5886
exit 1
@@ -63,5 +91,8 @@ if [ "$1" == "project" ]; then
6391
fi
6492

6593
# Inject files into a compiled .ipa
66-
zip -ru $IPA_NAME Payload
94+
echo "Injecting files into iloveusomuch.ipa..."
95+
zip -ru "$IPA_NAME" Payload > /dev/null
6796
rm -R ./Payload
97+
98+
echo "\nIPA is ready!"

0 commit comments

Comments
 (0)