yptools 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d9a36624bc18f1d519d0a1b5e24440eec56f05729f2bb997646518eef48130e
4
- data.tar.gz: 5682539c004927df1bd3b4c8cb9ae8e0c327181311542370bdf42d4d82c46793
3
+ metadata.gz: b8094bf2aaae705c3e50ea6d5e7c07a2ed873b5ff136ce4c78a67c3a91d87ef3
4
+ data.tar.gz: dd15fd7a02bcfb9344b7fea0c5ee3e9e8bbc61d82542edc684c7d91e567d8961
5
5
  SHA512:
6
- metadata.gz: 5212b210a35eaef7c94b78e416847b4deb21a528f68db4173d0243966502268d0995d774090862b19c271dda78b45abd1def619bedd88c4134b2061adab950ce
7
- data.tar.gz: 1645e155cd85a3adb1f02492bc17759e6e969cc82f9de10fef12ff993eafdd849e65ec942f89e161487fad4a54e66be5a33d437bd2e460861fcc01aaddefd872
6
+ metadata.gz: b3453c6642aa86c9d11340ec6cd719320292262ca7d647eb14765cd0ac1945dd2025c9a6f0be780e0088feb7397e0af231dab53cb371e547844dbe90a2b99b6e
7
+ data.tar.gz: 0df2cd59b939826328dc7330f7d446f2d254ad454d87c37cc1389ab609aa937a919a9875ebdc259e93e65974f72dcebf606c0074688a56bb7b6b4ba50658ae5b
@@ -7,6 +7,8 @@ class YPHelp
7
7
 
8
8
  mgc: use [yptools mgc suffix] 在当前目录生成垃圾代码(当前目录需要有.xcworkspace或者.xcodeproj目录)
9
9
 
10
+ showipa: use [yptools showipa ...] 用于解析ipa文件
11
+
10
12
  update: use [yptools update] 更新yptools
11
13
 
12
14
  ufct: use [yptools ufct] 更新当前目录下面文件后缀为.h|.m 的文件创建时间
@@ -0,0 +1,189 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ require 'pathname'
4
+ require 'colored'
5
+ require 'plist'
6
+ require 'json'
7
+ require_relative '../log/yp_log'
8
+ require_relative '../mgc/yp_makegarbagecode'
9
+
10
+
11
+ class YPPackage
12
+
13
+ def self.analysis(filePath, delete = 1)
14
+
15
+ fileName = File.basename(filePath)
16
+ fileBasename = File.basename(filePath, ".*")
17
+ fileSuffix = File.extname(filePath)
18
+ fileDirname = File.dirname(filePath)
19
+
20
+ yp_path = `pwd`
21
+ yp_path = yp_path.sub("\n","")
22
+
23
+ # yp_outPath = yp_path + '/Payload + ' + Time.new.inspect
24
+ yp_outPath = fileDirname + '/ipa-' + Time.new.strftime("%Y%m%d%H%M%S-%L")
25
+ yp_method_mkdir yp_outPath
26
+ yp_log_doing "将ipa解压到临时目录#{yp_outPath}"
27
+ `tar -xf #{filePath} -C #{yp_outPath}`
28
+
29
+ yp_resourceFile = "#{yp_outPath}/Payload/"
30
+
31
+ yp_resourceFile_app = ""
32
+ Dir.entries(yp_resourceFile).each do |sub|
33
+ if sub.end_with?(".app")
34
+ yp_resourceFile_app = yp_resourceFile + sub;
35
+ end
36
+ end
37
+
38
+ if yp_resourceFile_app.length == 0
39
+ yp_log_fail "解析失败,请检查压缩包是否是ipa文件"
40
+ return
41
+ end
42
+
43
+ puts yp_resourceFile_app
44
+
45
+ yp_infoPlistName = "Info.plist"
46
+ yp_infoPlistPath = ""
47
+
48
+ yp_mobileprovisionName = ".mobileprovision"
49
+ yp_mobileprovisionPath = ""
50
+
51
+ Dir.entries(yp_resourceFile_app).each do |sub|
52
+ if sub == yp_infoPlistName
53
+ yp_infoPlistPath = yp_resourceFile_app + "/" + sub;
54
+ end
55
+ if sub.end_with?(yp_mobileprovisionName)
56
+ yp_mobileprovisionPath = yp_resourceFile_app + "/" + sub;
57
+ end
58
+ end
59
+
60
+ puts yp_infoPlistPath
61
+ puts yp_mobileprovisionPath
62
+
63
+ yp_mobileprovisionPlistPath = yp_resourceFile_app + "/" + "mobileprovision.plist"
64
+ # 解析描述文件
65
+ yp_mobileprovisionDatum = `security cms -D -i #{yp_mobileprovisionPath}`
66
+
67
+ puts yp_mobileprovisionPlistPath
68
+
69
+ yp_plistCreateFile = File.new(yp_mobileprovisionPlistPath,"w+")
70
+ yp_plistCreateFile.syswrite(yp_mobileprovisionDatum)
71
+ yp_plistCreateFile.close
72
+
73
+ yp_log_success "============================================================"
74
+
75
+ yp_plist = Plist.parse_xml(yp_mobileprovisionPlistPath)
76
+
77
+ yp_appIDName = yp_plist["AppIDName"]
78
+ yp_applicationIdentifierPrefix = yp_plist["ApplicationIdentifierPrefix"]
79
+ yp_creationDate = yp_plist["CreationDate"]
80
+ yp_platform = yp_plist["Platform"]
81
+ yp_isXcodeManaged = yp_plist["IsXcodeManaged"]
82
+ yp_developerCertificates = yp_plist["DeveloperCertificates"]
83
+ yp_DER_Encoded_Profile = yp_plist["DER-Encoded-Profile"]
84
+ yp_entitlements = yp_plist["Entitlements"]
85
+ yp_expirationDate = yp_plist["ExpirationDate"]
86
+ yp_name = yp_plist["Name"]
87
+ yp_provisionsAllDevices = yp_plist["ProvisionsAllDevices"]
88
+ yp_teamIdentifier = yp_plist["TeamIdentifier"]
89
+ yp_teamName = yp_plist["TeamName"]
90
+ yp_timeToLive = yp_plist["TimeToLive"]
91
+ yp_uUID = yp_plist["UUID"]
92
+ yp_version = yp_plist["Version"]
93
+ yp_provisionedDevices = yp_plist["ProvisionedDevices"]
94
+
95
+ yp_log_success " 输出描述文件embedded.mobileprovision"
96
+ puts yp_mobileprovisionPlistPath
97
+ puts ''
98
+ yp_log_doing " 程序名称:\t#{yp_appIDName}"
99
+ yp_log_doing " 团队名称:\t#{yp_teamName}"
100
+ yp_log_doing " 创建时间:\t#{yp_creationDate}"
101
+ yp_log_fail " 过期时间:\t#{yp_expirationDate}"
102
+ yp_log_doing " 系统平台:\t#{yp_platform}"
103
+
104
+ if yp_provisionedDevices.class == Array
105
+ yp_log_doing " \n udids"
106
+ for device in yp_provisionedDevices
107
+ yp_log_doing " #{device}"
108
+ end
109
+ end
110
+
111
+ # yp_log_msg " 标识符🚀:\t#{yp_applicationIdentifierPrefix}"
112
+ # yp_log_msg " 证书证书:\t#{yp_developerCertificates}"
113
+ # yp_log_msg " 证书证书:\t#{yp_DER_Encoded_Profile}"
114
+ # yp_log_doing " 随便看看:\t#{yp_entitlements}"
115
+ # yp_log_msg " 名字名字:\t#{yp_name}"
116
+ # yp_log_msg " 支持设备:\t#{yp_provisionsAllDevices}"
117
+ # yp_log_msg " 团队标识:\t#{yp_teamIdentifier}"
118
+ # puts " 生存时间:\t#{yp_timeToLive}"
119
+ # puts " uuid🚀🚀:\t#{yp_uUID}"
120
+ # puts " 版本号🚀:\t#{yp_version}"
121
+ puts ''
122
+ yp_log_success "============================================================"
123
+
124
+ # puts yp_infoPlistPath
125
+
126
+ # 解析加密之后的plist文件
127
+ `plutil -convert json #{yp_infoPlistPath}`
128
+ yp_info_plist = `cat #{yp_infoPlistPath}`
129
+ yp_info_plist_hash = JSON.parse(yp_info_plist)
130
+ yp_log_success " 输出Info.plist文件#{yp_infoPlistName}"
131
+ puts yp_infoPlistPath
132
+
133
+ puts ''
134
+ yp_log_doing " CFBundleDisplayName:\t#{yp_info_plist_hash['CFBundleDisplayName']}"
135
+ yp_log_doing " CFBundleIdentifier:\t#{yp_info_plist_hash['CFBundleIdentifier']}"
136
+ yp_log_doing " CFBundleVersion:\t#{yp_info_plist_hash['CFBundleVersion']}"
137
+ # if yp_info_plist_hash['NSContactsUsageDescription']
138
+ # yp_log_doing " NSContactsUsageDescription:\t#{yp_info_plist_hash['NSContactsUsageDescription']}"
139
+ # end
140
+ # if yp_info_plist_hash['NSPhotoLibraryUsageDescription']
141
+ # yp_log_doing " NSPhotoLibraryUsageDescription:\t#{yp_info_plist_hash['NSPhotoLibraryUsageDescription']}"
142
+ # end
143
+ # if yp_info_plist_hash['NSBluetoothAlwaysUsageDescription']
144
+ # yp_log_doing " NSBluetoothAlwaysUsageDescription:\t#{yp_info_plist_hash['NSBluetoothAlwaysUsageDescription']}"
145
+ # end
146
+ # if yp_info_plist_hash['NSLocationAlwaysAndWhenInUseUsageDescription']
147
+ # yp_log_doing " NSLocationAlwaysAndWhenInUseUsageDescription:\t#{yp_info_plist_hash['NSLocationAlwaysAndWhenInUseUsageDescription']}"
148
+ # end
149
+ # if yp_info_plist_hash['NSLocationWhenInUseUsageDescription']
150
+ # yp_log_doing " NSLocationWhenInUseUsageDescription:\t#{yp_info_plist_hash['NSLocationWhenInUseUsageDescription']}"
151
+ # end
152
+ # if yp_info_plist_hash['NSCameraUsageDescription']
153
+ # yp_log_doing " NSCameraUsageDescription:\t#{yp_info_plist_hash['NSCameraUsageDescription']}"
154
+ # end
155
+ # if yp_info_plist_hash['NSLocationAlwaysUsageDescription']
156
+ # yp_log_doing " NSLocationAlwaysUsageDescription:\t#{yp_info_plist_hash['NSLocationAlwaysUsageDescription']}"
157
+ # end
158
+ # if yp_info_plist_hash['NSBluetoothPeripheralUsageDescription']
159
+ # yp_log_doing " NSBluetoothPeripheralUsageDescription:\t#{yp_info_plist_hash['NSBluetoothPeripheralUsageDescription']}"
160
+ # end
161
+ # if yp_info_plist_hash['NSPhotoLibraryAddUsageDescription']
162
+ # yp_log_doing " NSPhotoLibraryAddUsageDescription:\t#{yp_info_plist_hash['NSPhotoLibraryAddUsageDescription']}"
163
+ # end
164
+ # if yp_info_plist_hash['NSMicrophoneUsageDescription']
165
+ # yp_log_doing " NSMicrophoneUsageDescription:\t#{yp_info_plist_hash['NSMicrophoneUsageDescription']}"
166
+ # end
167
+ # if yp_info_plist_hash['NSMotionUsageDescription']
168
+ # yp_log_doing " NSMotionUsageDescription:\t#{yp_info_plist_hash['NSMotionUsageDescription']}"
169
+ # end
170
+ # if yp_info_plist_hash['NSSiriUsageDescription']
171
+ # yp_log_doing " NSSiriUsageDescription:\t#{yp_info_plist_hash['NSSiriUsageDescription']}"
172
+ # end
173
+ # if yp_info_plist_hash['NSCalendarsUsageDescription']
174
+ # yp_log_doing " NSCalendarsUsageDescription:\t#{yp_info_plist_hash['NSCalendarsUsageDescription']}"
175
+ # end
176
+ # if yp_info_plist_hash['NSFaceIDUsageDescription']
177
+ # yp_log_doing " NSFaceIDUsageDescription:\t#{yp_info_plist_hash['NSFaceIDUsageDescription']}"
178
+ # end
179
+ puts ''
180
+ yp_log_success "============================================================"
181
+
182
+ if delete == 1
183
+ yp_log_doing "移除临时目录#{yp_outPath}"
184
+ yp_method_rmdir yp_outPath
185
+ end
186
+
187
+ end
188
+
189
+ end
data/lib/yptools.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # -*- coding: utf-8 -*-
2
+
1
3
  require_relative 'yptools/mgc/yp_makegarbagecode'
2
4
  require_relative 'yptools/help/yp_help'
3
5
  require_relative 'yptools/log/yp_log'
@@ -5,6 +7,7 @@ require_relative 'yptools/install/yp_install'
5
7
  require_relative 'yptools/update/yp_update'
6
8
  require_relative 'yptools/xcodeproj/yp_xcodeproj'
7
9
  require_relative 'yptools/file/yp_updatecreatedate'
10
+ require_relative 'yptools/package/yp_package'
8
11
 
9
12
  class YPTools
10
13
 
@@ -31,6 +34,25 @@ class YPTools
31
34
  yp_log_fail "'yptools mgc ..' 参数缺失"
32
35
  self.help
33
36
  end
37
+ when 'install'
38
+ if argvs.size > 1
39
+ name = argvs[1]
40
+ self.install name
41
+ else
42
+ yp_log_fail "'yptools install ..' 参数缺失"
43
+ self.help
44
+ end
45
+ when 'showipa'
46
+ if argvs.size > 2
47
+ filepath = argvs[1]
48
+ self.package(filepath,0)
49
+ elsif argvs.size > 1
50
+ filepath = argvs[1]
51
+ self.package filepath
52
+ else
53
+ yp_log_fail "'yptools package ..' 参数缺失"
54
+ self.help
55
+ end
34
56
  when 'update'
35
57
  self.update
36
58
  when 'xpj'
@@ -65,6 +87,10 @@ class YPTools
65
87
  YPInstall.install(name)
66
88
  end
67
89
 
90
+ def self.package(filepath, delete = 1)
91
+ YPPackage.analysis(filepath,delete)
92
+ end
93
+
68
94
  def self.update
69
95
  YPUpdate.update
70
96
  end
@@ -81,6 +107,7 @@ end
81
107
  # 垃圾代码自动添加
82
108
  # 自动打包功能
83
109
  # SDK自动生成
110
+ # ipa 自动解析
84
111
 
85
112
  #puts "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀";
86
113
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - chenghengsheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-20 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.17'
20
- type: :development
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -31,7 +31,7 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -45,7 +45,7 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -59,7 +59,7 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.2'
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
@@ -73,13 +73,27 @@ dependencies:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.1.0
76
- type: :development
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.1.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: plist
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.6.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.6.0
83
97
  description: Some useful tools make me happy
84
98
  email:
85
99
  - 2534550460@qq.com
@@ -95,6 +109,7 @@ files:
95
109
  - lib/yptools/install/yp_install.rb
96
110
  - lib/yptools/log/yp_log.rb
97
111
  - lib/yptools/mgc/yp_makegarbagecode.rb
112
+ - lib/yptools/package/yp_package.rb
98
113
  - lib/yptools/update/yp_update.rb
99
114
  - lib/yptools/xcodeproj/yp_xcodeproj.rb
100
115
  homepage: https://github.com/HansenCCC/YPTools.git
@@ -116,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
131
  - !ruby/object:Gem::Version
117
132
  version: '0'
118
133
  requirements: []
119
- rubygems_version: 3.0.9
134
+ rubygems_version: 3.0.3.1
120
135
  signing_key:
121
136
  specification_version: 4
122
137
  summary: YPTools!