Skip to content
This repository was archived by the owner on Aug 8, 2018. It is now read-only.

Commit 8acc8bd

Browse files
author
mathieu
committed
Updated decrypt0r to work with img4tool by xerub
BTW I cleaned build.sh and removed the way to save SHSHs with savethemblobs
1 parent 072fd36 commit 8acc8bd

File tree

5 files changed

+36
-47
lines changed

5 files changed

+36
-47
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ decrypt0r
55
*.im4p
66
*.dec
77
IPSW
8+
kernel*

build.sh

100644100755
+8-26
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ if [[ $(uname) != 'Linux' ]]; then
3737
exit 1
3838
fi
3939

40-
if [[ $(uname -m) == x86_64 ]]; then
41-
wget https://www.dropbox.com/s/b6m5bkaqym2gaqh/joker?dl=0 -O joker
42-
mv joker /usr/local/bin/
43-
chmod +x /usr/local/bin/joker
44-
fi
45-
4640
apt-get -y install binutils
4741
apt-get -y install p7zip-full
4842
apt-get -y install git
@@ -64,22 +58,16 @@ git clone https://github.com/xerub/xpwn.git
6458
mkdir ~/build
6559
cd ~/build
6660
cmake ~/xpwn
67-
make
68-
make package
69-
tar xvjf XPwn-0.5.8-Linux.tar.bz2
70-
71-
wget
72-
cd XPwn-0.5.8-Linux
73-
cp dmg hdutil hfsplus ipsw ticket xpwntool validate /usr/local/bin/ # Maybe I can replace this shit with one line : sudo make install
61+
make install
7462

7563
echo "XPwn binaries installed !"
7664

77-
7865
echo "Now installing reimagine..."
7966

8067
apt-get -y install libssl-dev:i386 #Should work for reimagine
8168
apt-get -y install clang
8269

70+
# Reimagine
8371
cd ~
8472
git clone https://github.com/danzatt/reimagine.git #
8573
cd reimagine
@@ -88,19 +76,13 @@ git clone https://github.com/danzatt/opensn0w-X.git
8876
cd ~
8977
cd reimagine/opensn0w-X/src && make all
9078
cd ../.. && make
91-
9279
cp ~/reimagine/reimagine /usr/local/bin/
93-
9480
echo "Installed reimagine !"
95-
echo "Downloading Savethemblobs..."
96-
cd ~
97-
git clone https://github.com/Neal/savethemblobs.git
98-
cp savethemblobs/savethemblobs.py /usr/local/bin/
99-
echo "Installed Savethemblobs"
10081

10182
apt-get -y install gcc
102-
cd ~ # I don't know yet why I install it
103-
git clone https://github.com/matteyeux/iOS-Utilities.git
104-
cd iOS-Utilities
105-
make
106-
make install
83+
84+
git clone --recursive https://github.com/xerub/img4tool
85+
cd img4tool/lzfse
86+
make && make install
87+
cd ../
88+
make && cp img4 /usr/local/bin/

src/decrypt0r.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,23 @@ int main(int argc, char const *argv[])
1717
printf("Choose what you want to do\n");
1818
printf(" 1) Decrypt Root Filesystem\n");
1919
printf(" 2) Decrypt Ramdisk\n");
20-
printf(" 3) Decrypt IMG3 File\n");
20+
printf(" 3) Decrypt IMG3/IMG4 File\n");
2121
printf(" 4) Decrypt DFU File\n");
2222
printf(" 5) Decrypt Kernelcache\n");
2323
printf(" 6) Grab Keybags\n");
2424
printf(" 7) Patch iBEC/iBSS\n");
25-
printf(" 8) Save SHSHs blobs\n");
2625
printf("> ");
2726
choice_of_your_life = fgetn();
2827

2928
switch (choice_of_your_life)
3029
{
3130
case 1 : rootfs(); break;
3231
case 2 : Ramdisk(); break;
33-
case 3 : IMG3(); break;
32+
case 3 : IMGfile(); break;
3433
case 4 : DFU_file(); break;
3534
case 5 : kernelcache(); break;
3635
case 6 : get_keybags(); break;
3736
case 7 : patcher(); break;
38-
case 8 : save_blobs(); break;
3937
default : printf("No option available yet\n");
4038
}
4139
return 0;

src/firmware_tools.c

+24-16
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ int Ramdisk()
255255
return 0;
256256
}
257257

258-
int IMG3()
258+
int IMGfile()
259259
{
260260
char name[120];
261261
char buildCommand[1024];
@@ -293,7 +293,7 @@ int IMG3()
293293

294294
else if (im4p == 1)
295295
{
296-
sprintf(buildCommand, "dd if=target bs=52 skip=1 | openssl aes-256-cbc -K %s -iv %s -nopad -d > %s.dec", keyiv, key, name);
296+
sprintf(buildCommand, "img4 -extra target %s.dec %s%s", name, keyiv, key);
297297
}
298298

299299
else {
@@ -338,7 +338,7 @@ int DFU_file()
338338

339339
else if (im4p == 1)
340340
{
341-
sprintf(buildCommand, "dd if=target bs=52 skip=1 | openssl aes-256-cbc -K %s -iv %s -nopad -d > %s.dec", keyiv, key, dfu_name);
341+
sprintf(buildCommand, "img4 -extra target %s.dec %s%s", dfu_name, keyiv, key);
342342
}
343343
system(buildCommand);
344344
rename("target", dfu_name);
@@ -363,6 +363,7 @@ int kernelcache()
363363

364364
printf("Enter the key IV for %s: ", name);
365365
fget(keyiv, 80);
366+
366367
rename(name, "target");
367368

368369
if (im4p == 0)
@@ -372,7 +373,14 @@ int kernelcache()
372373

373374
else if (im4p == 1)
374375
{
375-
sprintf(buildCommand, "dd if=target bs=52 skip=1 | openssl aes-256-cbc -K %s -iv %s -nopad -d > %s.dec", keyiv, key, name);
376+
if (strcmp(keyiv, "")==0 && strcmp(keyiv, "")==0)
377+
{
378+
sprintf(buildCommand, "img4 -image target %s.dec", name);
379+
}
380+
else {
381+
sprintf(buildCommand, "img4 -extra target %s.dec %s%s", name, keyiv, key);
382+
}
383+
376384
}
377385
system(buildCommand);
378386
rename("target", name);
@@ -421,15 +429,15 @@ int patcher()
421429
return 0;
422430
}
423431

424-
int save_blobs()
425-
{
426-
char ecid[15], model[10], command[256];
427-
swag_logo();
428-
printf("ECID : ");
429-
fget(ecid, 15);
430-
printf("model (e.g iPhone5,4 for iPhone 5C) : ");
431-
fget(model, 10);
432-
sprintf(command, "savethemblobs.py --no-submit-cydia --skip-cydia --skip-ifaith 0x%s %s", ecid, model);
433-
system(command);
434-
printf("Blobs saved to ~/.shsh\n");
435-
}
432+
// int save_blobs()
433+
// {
434+
// char ecid[15], model[10], command[256];
435+
// swag_logo();
436+
// printf("ECID : ");
437+
// fget(ecid, 15);
438+
// printf("model (e.g iPhone5,4 for iPhone 5C) : ");
439+
// fget(model, 10);
440+
// sprintf(command, "savethemblobs.py --no-submit-cydia --skip-cydia --skip-ifaith 0x%s %s", ecid, model);
441+
// system(command);
442+
// printf("Blobs saved to ~/.shsh\n");
443+
// }

src/firmware_tools.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int unziper();
77
int ipswDownloader();
88
int rootfs();
99
int Ramdisk();
10-
int IMG3();
10+
int IMGfile();
1111
int DFU_file();
1212
int kernelcache();
1313
int patcher();

0 commit comments

Comments
 (0)