cocoapods-privacy 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11b2bf9e6e9cd3c863067c2e4e4bcf9db70d734b2d3786dfba8c881dcdc58a16
|
4
|
+
data.tar.gz: 4bf64cdce7e18acfef794f43a92371a2633bdcfae75d593a60c7c0e481975235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 228886b2f261e7850e7531ceecdd282fe483589f8abf014c3e27fa933cb652c941c7e50276d7d13f50487cd5e5d97d9c04c47bbc62bb110502e0f573ac59f410
|
7
|
+
data.tar.gz: f2b7d99c39f6cd2e15f1943ac49fa6285595632fdef523504d973cb5e0f652daee9ace8bed17dc1652ae87a8b776c93b920272aae131796718004953aef2c6ee
|
@@ -108,13 +108,11 @@ module PrivacyHunter
|
|
108
108
|
|
109
109
|
# 删除临时文件
|
110
110
|
File.delete(temp_plist)
|
111
|
-
|
112
111
|
end
|
113
112
|
|
114
113
|
|
115
114
|
private
|
116
115
|
|
117
|
-
|
118
116
|
def self.fetch_template_plist_file
|
119
117
|
|
120
118
|
unless File.exist?(PrivacyUtils.cache_config_file)
|
@@ -200,6 +198,8 @@ module PrivacyHunter
|
|
200
198
|
|
201
199
|
#搜索所有子文件夹
|
202
200
|
def self.search_files(folder_paths, apis)
|
201
|
+
#清除上一次log
|
202
|
+
clean_log()
|
203
203
|
|
204
204
|
# 获取文件夹下所有文件(包括子文件夹)
|
205
205
|
all_files = []
|
@@ -218,10 +218,33 @@ module PrivacyHunter
|
|
218
218
|
# 遍历文件进行检索
|
219
219
|
apis_found = {}
|
220
220
|
all_files.uniq.each_with_index do |file_path, index|
|
221
|
-
|
222
|
-
|
221
|
+
api_contains = contains_apis?(file_path, apis)
|
222
|
+
apis_found = apis_found.merge(api_contains)
|
223
|
+
|
224
|
+
unless api_contains.empty?
|
225
|
+
log = "File #{file_path} contains the keyword '#{api_contains.keys}'.\n"
|
226
|
+
write_log(log)
|
227
|
+
end
|
223
228
|
end
|
229
|
+
puts "详细log请查看 #{PrivacyUtils.cache_log_file} 文件"
|
224
230
|
apis_found
|
225
231
|
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
|
226
249
|
end
|
227
250
|
|
@@ -71,6 +71,11 @@ module PrivacyUtils
|
|
71
71
|
config_file = File.join(cache_privacy_fold, 'config.json')
|
72
72
|
end
|
73
73
|
|
74
|
+
# config.json 文件
|
75
|
+
def self.cache_log_file
|
76
|
+
config_file = File.join(cache_privacy_fold, 'privacy.log')
|
77
|
+
end
|
78
|
+
|
74
79
|
# 创建默认隐私协议文件
|
75
80
|
def self.create_privacy_if_empty(file_path)
|
76
81
|
# 文件内容
|