cocoapods-privacy 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-privacy/command.rb +2 -0
- data/lib/cocoapods-privacy/gem_version.rb +1 -1
- data/lib/cocoapods-privacy/privacy/PrivacyHunter.rb +2 -22
- data/lib/cocoapods-privacy/privacy/PrivacyLog.rb +28 -0
- data/lib/cocoapods-privacy/privacy/PrivacyModule.rb +13 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17bcbadaa7fac402b93e8895f8122c527873f24c25698809657999163ad7a5b5
|
4
|
+
data.tar.gz: 511460533641f68349937f6b1bbb90ab65fe51eccc8eb2154eb41926169cf008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd028ae88664c51755d97bc79023e2eccf3245646dce468784197284a287ad525195e8a205cab60b8c36d9e46f3f88935627fa84f1e247e96c1efc72d5fa0841
|
7
|
+
data.tar.gz: a0ba51fe193e4415b1103e03401946acc3db965c594a990a34e1d24927404e583a4557fce182cd62a96f295b7841fc64bd4530572f65ba4d0773a50678540f94
|
@@ -198,9 +198,6 @@ module PrivacyHunter
|
|
198
198
|
|
199
199
|
#搜索所有子文件夹
|
200
200
|
def self.search_files(folder_paths, apis)
|
201
|
-
#清除上一次log
|
202
|
-
clean_log()
|
203
|
-
|
204
201
|
# 获取文件夹下所有文件(包括子文件夹)
|
205
202
|
all_files = []
|
206
203
|
folder_paths.each do |folder|
|
@@ -223,28 +220,11 @@ module PrivacyHunter
|
|
223
220
|
|
224
221
|
unless api_contains.empty?
|
225
222
|
log = "File #{file_path} contains the keyword '#{api_contains.keys}'.\n"
|
226
|
-
|
223
|
+
PrivacyLog.write_to_result_log(log)
|
227
224
|
end
|
228
225
|
end
|
229
|
-
|
226
|
+
PrivacyLog.write_to_result_log("\n") if !apis_found.empty?
|
230
227
|
apis_found
|
231
228
|
end
|
232
|
-
|
233
|
-
def self.write_log(log)
|
234
|
-
log_file_path = PrivacyUtils.cache_log_file
|
235
|
-
is_create = PrivacyUtils.create_file_and_fold_if_no_exit(log_file_path,log)
|
236
|
-
unless is_create
|
237
|
-
File.open(log_file_path, "a") do |file|
|
238
|
-
file << log
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
def self.clean_log()
|
244
|
-
File.open(PrivacyUtils.cache_log_file, "w") do |file|
|
245
|
-
# 写入空字符串,清空文件内容
|
246
|
-
file.write("")
|
247
|
-
end
|
248
|
-
end
|
249
229
|
end
|
250
230
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'cocoapods-privacy/command'
|
2
|
+
|
3
|
+
module PrivacyLog
|
4
|
+
|
5
|
+
# 提示log 存放地址
|
6
|
+
def self.result_log_tip()
|
7
|
+
puts "详细log请查看 #{PrivacyUtils.cache_log_file} 文件"
|
8
|
+
end
|
9
|
+
|
10
|
+
# 写入结果log 文件
|
11
|
+
def self.write_to_result_log(log)
|
12
|
+
log_file_path = PrivacyUtils.cache_log_file
|
13
|
+
is_create = PrivacyUtils.create_file_and_fold_if_no_exit(log_file_path,log)
|
14
|
+
unless is_create
|
15
|
+
File.open(log_file_path, "a") do |file|
|
16
|
+
file << log
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# 清除结果log文件
|
22
|
+
def self.clean_result_log()
|
23
|
+
File.open(PrivacyUtils.cache_log_file, "w") do |file|
|
24
|
+
# 写入空字符串,清空文件内容
|
25
|
+
file.write("")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -67,7 +67,14 @@ class BBSpec
|
|
67
67
|
if !line.is_comment && line.key.include?(".resource_bundle")
|
68
68
|
@has_resource_bundle = true
|
69
69
|
elsif !line.is_comment && line.key.include?(".source_files")
|
70
|
-
|
70
|
+
begin
|
71
|
+
code = "Pod::Spec.new do |s|; s.source_files = #{line.value}; end;"
|
72
|
+
RubyVM::InstructionSequence.compile(code)
|
73
|
+
spec = eval(code)
|
74
|
+
rescue SyntaxError, StandardError => e
|
75
|
+
raise Pod::Informative, "source_files字段 不支持多行拼写,请修改成成单行格式,重新执行pod privacy spec 命令"
|
76
|
+
end
|
77
|
+
|
71
78
|
if spec && !spec.attributes_hash['source_files'].nil?
|
72
79
|
source_files_value = spec.attributes_hash['source_files']
|
73
80
|
if source_files_value.is_a?(String) && !source_files_value.empty?
|
@@ -190,20 +197,25 @@ module PrivacyModule
|
|
190
197
|
project.save
|
191
198
|
|
192
199
|
# 开始检索api,并返回json 字符串数据
|
200
|
+
PrivacyLog.clean_result_log()
|
193
201
|
json_data = PrivacyHunter.search_pricacy_apis(folds)
|
194
202
|
|
195
203
|
# 将数据写入隐私清单文件
|
196
204
|
PrivacyHunter.write_to_privacy(json_data,privacy_file_path)
|
205
|
+
PrivacyLog.result_log_tip()
|
197
206
|
end
|
198
207
|
|
199
208
|
# 处理组件
|
200
209
|
def self.load_module(podspec_file_path)
|
201
210
|
puts "👇👇👇👇👇👇 Start analysis component privacy 👇👇👇👇👇👇"
|
211
|
+
PrivacyLog.clean_result_log()
|
202
212
|
privacy_hash = PrivacyModule.check(podspec_file_path)
|
203
213
|
privacy_hash.each do |privacy_file_path, source_files|
|
214
|
+
PrivacyLog.write_to_result_log("#{privacy_file_path}: \n")
|
204
215
|
data = PrivacyHunter.search_pricacy_apis(source_files)
|
205
216
|
PrivacyHunter.write_to_privacy(data,privacy_file_path) unless data.empty?
|
206
217
|
end
|
218
|
+
PrivacyLog.result_log_tip()
|
207
219
|
puts "👆👆👆👆👆👆 End analysis component privacy 👆👆👆👆👆👆"
|
208
220
|
end
|
209
221
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-privacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youhui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/cocoapods-privacy/gem_version.rb
|
58
58
|
- lib/cocoapods-privacy/privacy/PrivacyConfig.rb
|
59
59
|
- lib/cocoapods-privacy/privacy/PrivacyHunter.rb
|
60
|
+
- lib/cocoapods-privacy/privacy/PrivacyLog.rb
|
60
61
|
- lib/cocoapods-privacy/privacy/PrivacyModule.rb
|
61
62
|
- lib/cocoapods-privacy/privacy/PrivacyUtils.rb
|
62
63
|
- lib/cocoapods-privacy/privacy/privacy_installer_hook.rb
|