codeobscure 0.1.6.8 → 0.1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dc2505adac3a671a3d9d7a0ac40d5ded9c889c0743571bd67c09b9d3168251f
4
- data.tar.gz: eba21714785456047e95ee685f9716b648bc3c487c93d14a59c5f5fdc94b1c66
3
+ metadata.gz: 0f1b01768fb2baf4d35749fd2eec703cb75894129880cc7fd1f9173d90fd9076
4
+ data.tar.gz: c54a646d78044c0bf807a5f427943b2cab510b462a400ccb47db77b190742556
5
5
  SHA512:
6
- metadata.gz: ca1fb1c0eb363479d0ab96453b405f89032ef5c5f2fb77f9229101be1047979c266e7800f0fcd6a6142fea25ee22b5f1e0188f1c16db96ab711297b1486d40e8
7
- data.tar.gz: 7f14733c56f28f5741cec6a61c8c5124f80df70a99ec429c63ba5b8d2d1bb821184ce747b5619b1ccc848d4bb912363546f71e2590ffbfb72fe319c4f459c8ab
6
+ metadata.gz: 14473fb52cb52f8e0f307ef02110056e6276658f6ee791509e5c54e1507ca25e8cf8a4f7614bc94d43c8cbcc7836e2b99c8ff1acb15896e03969cee19aedcffe
7
+ data.tar.gz: 13801f1937b282ca68011811338f415ea7ba4d5ece518043c57d89b2758fb36318eb294a495e74b97ce62c3a7c000037180e89c3867c5f306e903d91daa1aed5
@@ -37,7 +37,7 @@ module Codeobscure
37
37
  options[:reset] = true
38
38
  end
39
39
 
40
- opts.on("-f", "--fetch type1,type2,type3", "fetch and replace type,default type is [c,p,f,i].c for class,p for property,f for function") do |v|
40
+ opts.on("-f", "--fetch type1,type2,type3", "fetch and replace type,default type is [c,p,f,i]. c for class, p for property, f for function") do |v|
41
41
  options[:fetch] = v
42
42
  end
43
43
 
@@ -49,6 +49,10 @@ 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|
53
+ options[:strict] = true
54
+ end
55
+
52
56
  end.parse!
53
57
 
54
58
  if options[:reset]
@@ -88,12 +92,17 @@ module Codeobscure
88
92
  fetch_types = options[:fetch]
89
93
  end
90
94
 
95
+
91
96
  if options[:obscure]
92
97
 
93
98
  xpj_path = options[:obscure]
94
99
  if File.exist? xpj_path
95
100
  root_dir = xpj_path.split("/")[0...-1].join "/"
96
101
  ImageMix.mix root_dir
102
+ if options[:strict]
103
+ FiltSymbols.loadStrictMode root_dir
104
+ puts "准备严格模式完成!".colorize(:green)
105
+ end
97
106
  FuncList.genFuncList root_dir , "h", true, fetch_types
98
107
  header_file = Obscure.run root_dir , options[:type]
99
108
  project = Xcodeproj::Project.open xpj_path
@@ -5,7 +5,7 @@ module FiltSymbols
5
5
  @@db = nil
6
6
  @@filt_db_path = "#{File.expand_path '../../..', __FILE__}/filtSymbols"
7
7
  @@table_name = "symbols"
8
- @@key_words = ["interface","NSInteger","BOOL","Class","free","M_PI_2","abort","change","top","bottom","NSUIntegerMax","intoString"]
8
+ @@key_words = ["interface","NSInteger","BOOL","Class","free","M_PI_2","abort","change","top","bottom","NSUIntegerMax","intoString","readonly"]
9
9
 
10
10
  def self.open_db
11
11
  if @@db.nil? || @@db.closed?
@@ -58,4 +58,17 @@ module FiltSymbols
58
58
 
59
59
  end
60
60
 
61
+
62
+ def self.loadStrictMode(path)
63
+ file_pathes = []
64
+ file_pathes += `find #{path} -name "*.h" -d`.split "\n"
65
+ file_pathes += `find #{path} -name "*.m" -d`.split "\n"
66
+
67
+ file_pathes.each do |file_path|
68
+ content = File.read file_path
69
+ FuncList.loadStrictSymbols content
70
+ end
71
+
72
+ end
73
+
61
74
  end
@@ -12,6 +12,7 @@ module FuncList
12
12
  @@property_regex2 = /\s*@property\s*\(.*?\)\s*\w+\s*\*?\s*(\w+)\s*.*;/
13
13
  @@property_regex3 = /\s*@property\s*\(.*?\)\s*\w+\s*<.*>\s*\*?\s*(\w+)\s*.*;/
14
14
  #---------------filter regex----------------
15
+ @@strict_filt_regex = /@"(\w+?)"/
15
16
  @@storyboard_filt_regex = /customClass="(\w+)"/
16
17
  @@value_for_key_filte_regex = /\[\w*\s+setValue\s*:\s*.*\s* forKey\s*:\s*@\"(.*)\"\]/
17
18
  @@class_from_str_regex = /NSClassFromString\(\s*@"(\w+)"\s*\)/
@@ -230,6 +231,21 @@ module FuncList
230
231
  file.close
231
232
  funclist_path
232
233
  end
234
+
235
+
236
+ def self.loadStrictSymbols(content_str)
237
+ str = to_utf8 content_str
238
+ str.scan @@strict_filt_regex do |curr_match|
239
+ md = Regexp.last_match
240
+ whole_match = md[0]
241
+ captures = md.captures
242
+
243
+ captures.each do |capture|
244
+ FiltSymbols.insertValue capture
245
+ p "执行严格模式过滤:#{capture}"
246
+ end
247
+ end
248
+ end
233
249
 
234
250
  end
235
251
 
@@ -1,3 +1,3 @@
1
1
  module Codeobscure
2
- VERSION = "0.1.6.8"
2
+ VERSION = "0.1.7.0"
3
3
  end
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.6.8
4
+ version: 0.1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler