codeobscure 0.1.7.0 → 0.1.7.2
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 +4 -4
- data/lib/codeobscure.rb +1 -1
- data/lib/codeobscure/obscure.rb +13 -2
- data/lib/codeobscure/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986bb36e0be56d60b586b367c496d739701956872b9fd753a6e12e6cf34fcd30
|
4
|
+
data.tar.gz: e753ae869c4525db8298c1680d3cb5e8d56f3c0e5ecafc843e25725bc6d34d4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ab20b1efc7d5e7e23a52570a61752230c4c2fce9248974215a9e4f1d81007c6b2aabbaf204c0ad45b50eb7daffce2e29b1c8c5946e436e910ecc5147be25a5
|
7
|
+
data.tar.gz: 853c6035e6d2dc77e197b7b3eae0ed010b5520a67b8235319cf8952798ee1c4d10c0a491debac6a971932cb8d529606575292f70869f5ef11a2241206e47ab2b
|
data/lib/codeobscure.rb
CHANGED
@@ -49,7 +49,7 @@ module Codeobscure
|
|
49
49
|
options[:type] = v
|
50
50
|
end
|
51
51
|
|
52
|
-
opts.on("-s", "--strict", "strict mode. It will filter all string") do |v|
|
52
|
+
opts.on("-s", "--strict", "strict mode. It will filter all string. If there are many kvo in code, please add -s.") do |v|
|
53
53
|
options[:strict] = true
|
54
54
|
end
|
55
55
|
|
data/lib/codeobscure/obscure.rb
CHANGED
@@ -12,9 +12,12 @@ module Obscure
|
|
12
12
|
|
13
13
|
@@STRING_SYMBOL_FILE="func.list"
|
14
14
|
@@IGNORE_NAME="ignoresymbols"
|
15
|
+
#保留项目特征,避免过度混淆被识别
|
16
|
+
@@PROJECT_TRAIT = ["Model", "View", "Field", "Label", "Item", "ViewModel", "Cell", "Button", "ViewController", "TableView", "CollectionView", "Control", "Entity", "Delegate"]
|
15
17
|
|
16
18
|
#type 1 :随机字符, 2 : 随机单词, 3 : 自定义单词替换
|
17
|
-
|
19
|
+
#reference_content 原来准备替换的内容, 避免过度混淆
|
20
|
+
def self.ramdomString(var_type , replace_type = 1, reference_content = nil)
|
18
21
|
result = ""
|
19
22
|
case replace_type
|
20
23
|
when 1
|
@@ -38,6 +41,14 @@ module Obscure
|
|
38
41
|
raise "c选项功能暂未实现,下一版本中加入!"
|
39
42
|
end
|
40
43
|
|
44
|
+
for trait in @@PROJECT_TRAIT do
|
45
|
+
if reference_content
|
46
|
+
if reference_content.end_with? trait
|
47
|
+
result += trait
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
41
52
|
|
42
53
|
result
|
43
54
|
end
|
@@ -90,7 +101,7 @@ module Obscure
|
|
90
101
|
line_content = line.rstrip.split(":").last
|
91
102
|
result = FiltSymbols.query(line_content)
|
92
103
|
if result.nil? || result.empty?
|
93
|
-
ramdom = ramdomString line_type , replace_type
|
104
|
+
ramdom = ramdomString line_type , replace_type, line_content
|
94
105
|
if line_type == "p"
|
95
106
|
result = FiltSymbols.query("set#{line_content.upcase_first_letter}")
|
96
107
|
if result.nil? || result.empty?
|
data/lib/codeobscure/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeobscure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.7.
|
4
|
+
version: 0.1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|