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

Commit 072fd36

Browse files
committed
Some improvments
1 parent 1c210a7 commit 072fd36

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ decrypt0r
22
*.o
33
*.ipsw
44
*.img3
5+
*.im4p
56
*.dec
6-
IPSW
7+
IPSW

src/firmware_tools.c

+21-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include <unistd.h>
55
#include <fcntl.h>
66
#include <errno.h>
7+
8+
#define VERSION "1.1.2"
9+
710
void swag_logo()
811
{
912
system("clear");
@@ -12,7 +15,7 @@ void swag_logo()
1215
printf("| | | |/ _ \\/ __| '__| | | | '_ \\| __| | | | '__|\n");
1316
printf("| |_| | __/ (__| | | |_| | |_) | |_| |_| | |\n");
1417
printf("|____/ \\___|\\___|_| \\__, | .__/ \\__|\\___/|_|\n");
15-
printf(" |___/|_|\n\n");
18+
printf(" Version %s |___/|_| by matteyeux\n\n", VERSION);
1619
}
1720

1821
void nBuffer()
@@ -47,6 +50,13 @@ int fget(char *chain, int sizee)
4750
}
4851
}
4952

53+
void isfilehere(char *name){
54+
if (fopen(name,"r")==NULL){
55+
printf("File %s is missing\n", name);
56+
exit(1);
57+
}
58+
}
59+
5060
int fgetn()
5161
{
5262
char chain[64];
@@ -117,7 +127,7 @@ int unziper()
117127
{
118128
printf("Firmware to decompress : ");
119129
fget(firmware, 80);
120-
130+
isfilehere(firmware);
121131
printf("Extracting firmware in the IPSW folder...\n");
122132
sprintf(buildCommand, "7z x -oIPSW %s", firmware);
123133
system(buildCommand);
@@ -229,6 +239,7 @@ int Ramdisk()
229239
chdir("IPSW");
230240
printf("Enter the Ramdisk name : ");
231241
fget(name, 120);
242+
isfilehere(name);
232243

233244
printf("Enter key for the Ramdisk : ");
234245
fget(key, 80);
@@ -264,16 +275,16 @@ int IMG3()
264275

265276
sprintf(img3_dir,"IPSW/Firmware/all_flash/all_flash.%s.production", boardID);
266277
chdir(img3_dir);
267-
system("ls");
278+
isfilehere(name);
268279
check4im4p(name);
269-
printf("%d\n",im4p);
270-
rename(name, "target");
280+
271281

272282
printf("Enter the key for %s: ", name);
273283
fget(key, 80);
274284

275285
printf("Enter the key IV for %s: ", name);
276286
fget(keyiv, 80);
287+
rename(name, "target");
277288

278289
if (im4p == 0)
279290
{
@@ -310,15 +321,16 @@ int DFU_file()
310321

311322
sprintf(dfu_dir, "IPSW/Firmware/dfu/");
312323
chdir(dfu_dir);
324+
isfilehere(dfu_name);
313325
check4im4p(dfu_name);
314-
rename(dfu_name, "target");
315326

316327
printf("Enter the key for %s: ", dfu_name);
317328
fget(key, 80);
318329

319330
printf("Enter the key IV for %s: ", dfu_name);
320331
fget(keyiv, 80);
321332

333+
rename(dfu_name, "target");
322334
if (im4p == 0)
323335
{
324336
sprintf(buildCommand,"xpwntool target %s.dec -k %s -iv %s -decrypt", dfu_name, key, keyiv);
@@ -342,19 +354,17 @@ int kernelcache()
342354
swag_logo();
343355
printf("Enter the kernel filename : ");
344356
fget(name, 120);
345-
system("ls");
346357
chdir("IPSW");
347-
system("ls");
358+
isfilehere(name);
348359
check4im4p(name);
349-
rename(name, "target");
350-
system("ls");
351360
printf("Enter the key for %s: ", name);
352361
fget(key, 80);
353362

354363

355364
printf("Enter the key IV for %s: ", name);
356365
fget(keyiv, 80);
357-
printf("%d\n", im4p);
366+
rename(name, "target");
367+
358368
if (im4p == 0)
359369
{
360370
sprintf(buildCommand,"xpwntool target %s.dec -k %s -iv %s -decrypt", name, key, keyiv);

0 commit comments

Comments
 (0)