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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# File 'lib/yptools/package/yp_package.rb', line 13
def self.analysis(filePath, delete = 1)
fileName = File.basename(filePath)
fileBasename = File.basename(filePath, ".*")
fileSuffix = File.extname(filePath)
fileDirname = File.dirname(filePath)
yp_path = `pwd`
yp_path = yp_path.sub("\n","")
yp_outPath = fileDirname + '/ipa-' + Time.new.strftime("%Y%m%d%H%M%S-%L")
yp_method_mkdir yp_outPath
yp_log_doing "将ipa解压到临时目录#{yp_outPath}"
`tar -xf #{filePath} -C #{yp_outPath}`
yp_resourceFile = "#{yp_outPath}/Payload/"
yp_resourceFile_app = ""
Dir.entries(yp_resourceFile).each do |sub|
if sub.end_with?(".app")
yp_resourceFile_app = yp_resourceFile + sub;
end
end
if yp_resourceFile_app.length == 0
yp_log_fail "解析失败,请检查压缩包是否是ipa文件"
return
end
puts yp_resourceFile_app
yp_infoPlistName = "Info.plist"
yp_infoPlistPath = ""
yp_mobileprovisionName = ".mobileprovision"
yp_mobileprovisionPath = ""
Dir.entries(yp_resourceFile_app).each do |sub|
if sub == yp_infoPlistName
yp_infoPlistPath = yp_resourceFile_app + "/" + sub;
end
if sub.end_with?(yp_mobileprovisionName)
yp_mobileprovisionPath = yp_resourceFile_app + "/" + sub;
end
end
puts yp_infoPlistPath
if yp_mobileprovisionPath.length > 0
puts yp_mobileprovisionPath
yp_mobileprovisionPlistPath = yp_resourceFile_app + "/" + "mobileprovision.plist"
yp_mobileprovisionDatum = `security cms -D -i #{yp_mobileprovisionPath}`
puts yp_mobileprovisionPlistPath
yp_plistCreateFile = File.new(yp_mobileprovisionPlistPath,"w+")
yp_plistCreateFile.syswrite(yp_mobileprovisionDatum)
yp_plistCreateFile.close
yp_log_success "============================================================"
yp_plist = Plist.parse_xml(yp_mobileprovisionPlistPath)
if !yp_plist
yp_plist = {}
end
yp_appIDName = yp_plist["AppIDName"]
yp_applicationIdentifierPrefix = yp_plist["ApplicationIdentifierPrefix"]
yp_creationDate = yp_plist["CreationDate"]
yp_platform = yp_plist["Platform"]
yp_isXcodeManaged = yp_plist["IsXcodeManaged"]
yp_developerCertificates = yp_plist["DeveloperCertificates"]
yp_DER_Encoded_Profile = yp_plist["DER-Encoded-Profile"]
yp_entitlements = yp_plist["Entitlements"]
yp_expirationDate = yp_plist["ExpirationDate"]
yp_name = yp_plist["Name"]
yp_provisionsAllDevices = yp_plist["ProvisionsAllDevices"]
yp_teamIdentifier = yp_plist["TeamIdentifier"]
yp_teamName = yp_plist["TeamName"]
yp_timeToLive = yp_plist["TimeToLive"]
yp_uUID = yp_plist["UUID"]
yp_version = yp_plist["Version"]
yp_provisionedDevices = yp_plist["ProvisionedDevices"]
yp_log_success " 输出描述文件embedded.mobileprovision"
puts yp_mobileprovisionPlistPath
puts ''
yp_log_doing " 程序名称:\t#{yp_appIDName}"
yp_log_doing " 团队名称:\t#{yp_teamName}"
yp_log_doing " 创建时间:\t#{yp_creationDate}"
yp_log_fail " 过期时间:\t#{yp_expirationDate}"
yp_log_doing " 系统平台:\t#{yp_platform}"
if yp_provisionedDevices.class == Array
yp_log_doing " \n udids"
for device in yp_provisionedDevices
yp_log_doing " #{device}"
end
end
puts ''
else
yp_log_success "============================================================"
yp_log_success "==================== 来自 AppStore 下载 ===================="
end
yp_log_success "============================================================"
`plutil -convert json #{yp_infoPlistPath}`
yp_info_plist = `cat #{yp_infoPlistPath}`
yp_info_plist_hash = JSON.parse(yp_info_plist)
yp_log_success " 输出Info.plist文件#{yp_infoPlistName}"
puts yp_infoPlistPath
puts ''
yp_log_doing " CFBundleDisplayName:\t#{yp_info_plist_hash['CFBundleDisplayName']}"
yp_log_doing " CFBundleIdentifier:\t#{yp_info_plist_hash['CFBundleIdentifier']}"
yp_log_doing " CFBundleVersion:\t#{yp_info_plist_hash['CFBundleVersion']}"
puts ''
yp_log_success "============================================================"
if delete == 1
yp_log_doing "移除临时目录#{yp_outPath}"
yp_method_rmdir yp_outPath
end
end
|