-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathresign.c
More file actions
86 lines (76 loc) · 1.61 KB
/
resign.c
File metadata and controls
86 lines (76 loc) · 1.61 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <stdio.h>
#include <string.h>
#include "resignCore.h"
int main(int argc, char *argv[]){
//resign -i "/Desktop/myapp/sign.ipa" -c "XXXXCo., Ltd." -e "/Desktop/myapp/embedded.mobileprovision" -o "/Desktop"
int j = 0;
char * ipaPtah = NULL;
char * identity= NULL;
char * embedded= NULL;
char * output = NULL;
while(j<argc){
if (strcmp(argv[j],"-h") == 0 || argc == 1)
{
resignHelp();
return -1;
}
if (strcmp(argv[j],"-s") == 0)
{
showAllIdentity();
return -1;
}
//后跟ipa包路径
if (strcmp(argv[j],"-i") == 0)
{
FILE *fp = fopen(argv[j+1],"r");
if (fp == NULL)
{
printf("%s\n","Error file,Not find ipa.");
return -1;
}else{
fclose(fp);
printf("%s\n","Find this ipa..\nStart find P12...");
ipaPtah = argv[j+1];
}
}
//后跟证书名字
if (strcmp(argv[j],"-c") == 0)
{
ERROR * error = findIdentity(argv[j+1]);
if (error->errorCode == ERRORNULL)
{
identity = argv[j+1];
}else{
printf("%s\n",error->errorMsg);
return -1;
}
}
//后跟描述文件路径
if (strcmp(argv[j],"-e") == 0)
{
FILE *fp = fopen(argv[j+1],"r");
if (fp == NULL)
{
printf("%s\n","Error file,Not find embedded.");
return -1;
}else{
fclose(fp);
printf("%s\n","Find this embedded...");
embedded = argv[j+1];
}
}
//后跟输出路径
if (strcmp(argv[j],"-o") == 0)
{
output = argv[j+1];
}
j++;
}
printf("%s\n","---------- 开始工作 ---------");
ERROR * error = startResigned(ipaPtah,identity,embedded,output);
if (error->errorCode != ERRORNULL)
{
printf("%s\n",error->errorMsg);
}
return 0;
}