4
4
#include <unistd.h>
5
5
#include <fcntl.h>
6
6
#include <errno.h>
7
+
8
+ #define VERSION "1.1.2"
9
+
7
10
void swag_logo ()
8
11
{
9
12
system ("clear" );
@@ -12,7 +15,7 @@ void swag_logo()
12
15
printf ("| | | |/ _ \\/ __| '__| | | | '_ \\| __| | | | '__|\n" );
13
16
printf ("| |_| | __/ (__| | | |_| | |_) | |_| |_| | |\n" );
14
17
printf ("|____/ \\___|\\___|_| \\__, | .__/ \\__|\\___/|_|\n" );
15
- printf (" |___/|_|\n\n" );
18
+ printf (" Version %s |___/|_| by matteyeux \n\n" , VERSION );
16
19
}
17
20
18
21
void nBuffer ()
@@ -47,6 +50,13 @@ int fget(char *chain, int sizee)
47
50
}
48
51
}
49
52
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
+
50
60
int fgetn ()
51
61
{
52
62
char chain [64 ];
@@ -117,7 +127,7 @@ int unziper()
117
127
{
118
128
printf ("Firmware to decompress : " );
119
129
fget (firmware , 80 );
120
-
130
+ isfilehere ( firmware );
121
131
printf ("Extracting firmware in the IPSW folder...\n" );
122
132
sprintf (buildCommand , "7z x -oIPSW %s" , firmware );
123
133
system (buildCommand );
@@ -229,6 +239,7 @@ int Ramdisk()
229
239
chdir ("IPSW" );
230
240
printf ("Enter the Ramdisk name : " );
231
241
fget (name , 120 );
242
+ isfilehere (name );
232
243
233
244
printf ("Enter key for the Ramdisk : " );
234
245
fget (key , 80 );
@@ -264,16 +275,16 @@ int IMG3()
264
275
265
276
sprintf (img3_dir ,"IPSW/Firmware/all_flash/all_flash.%s.production" , boardID );
266
277
chdir (img3_dir );
267
- system ( "ls" );
278
+ isfilehere ( name );
268
279
check4im4p (name );
269
- printf ("%d\n" ,im4p );
270
- rename (name , "target" );
280
+
271
281
272
282
printf ("Enter the key for %s: " , name );
273
283
fget (key , 80 );
274
284
275
285
printf ("Enter the key IV for %s: " , name );
276
286
fget (keyiv , 80 );
287
+ rename (name , "target" );
277
288
278
289
if (im4p == 0 )
279
290
{
@@ -310,15 +321,16 @@ int DFU_file()
310
321
311
322
sprintf (dfu_dir , "IPSW/Firmware/dfu/" );
312
323
chdir (dfu_dir );
324
+ isfilehere (dfu_name );
313
325
check4im4p (dfu_name );
314
- rename (dfu_name , "target" );
315
326
316
327
printf ("Enter the key for %s: " , dfu_name );
317
328
fget (key , 80 );
318
329
319
330
printf ("Enter the key IV for %s: " , dfu_name );
320
331
fget (keyiv , 80 );
321
332
333
+ rename (dfu_name , "target" );
322
334
if (im4p == 0 )
323
335
{
324
336
sprintf (buildCommand ,"xpwntool target %s.dec -k %s -iv %s -decrypt" , dfu_name , key , keyiv );
@@ -342,19 +354,17 @@ int kernelcache()
342
354
swag_logo ();
343
355
printf ("Enter the kernel filename : " );
344
356
fget (name , 120 );
345
- system ("ls" );
346
357
chdir ("IPSW" );
347
- system ( "ls" );
358
+ isfilehere ( name );
348
359
check4im4p (name );
349
- rename (name , "target" );
350
- system ("ls" );
351
360
printf ("Enter the key for %s: " , name );
352
361
fget (key , 80 );
353
362
354
363
355
364
printf ("Enter the key IV for %s: " , name );
356
365
fget (keyiv , 80 );
357
- printf ("%d\n" , im4p );
366
+ rename (name , "target" );
367
+
358
368
if (im4p == 0 )
359
369
{
360
370
sprintf (buildCommand ,"xpwntool target %s.dec -k %s -iv %s -decrypt" , name , key , keyiv );
0 commit comments