forked from NyaMisty/fouldecrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flexwrapper.cpp
executable file
·43 lines (40 loc) · 1.06 KB
/
flexwrapper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
extern int VERBOSE;
int decrypt_macho(const char *inputFile, const char *outputFile);
int
main(int argc, char* argv[]) {
int opt;
while((opt = getopt(argc, argv, "v")) != -1) {
switch (opt) {
case 'v':
VERBOSE = 1;
break;
default:
printf("optopt = %c\n", (char)optopt);
printf("opterr = %d\n", opterr);
fprintf(stderr, "usage: %s [-v] encfile\n", argv[0]);
exit(1);
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
return 1;
}
char outpath[0x200] = { 0 };
strcpy(outpath, "/tmp/");
const char *lastPathComponent = strrchr(argv[0], '/');
if (!lastPathComponent) {
strcat(outpath, argv[0]);
} else {
strcat(outpath, lastPathComponent + 1);
}
int ret = decrypt_macho(argv[0], outpath);
if (!ret) {
printf("Wrote decrypted image to %s\n", outpath);
}
return ret;
}