codeobscure 0.1.6.2 → 0.1.6.3

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: cf6549cfa1984c9002c7c558a47e8f8f231fb8be2470e41a9ad74d7f38fe8f1a
4
- data.tar.gz: b8ff29b1897c25de827f1111216eb478ae7191cd41f38edef9a6d1b8cd18813b
3
+ metadata.gz: 656ad40428791163c0a6b154ea66172753244c7a983d0ea934c1d22d85740818
4
+ data.tar.gz: 737a69b35d646fddeb00e216e5271e3b4f035258178cc44a7b92858d95b224f6
5
5
  SHA512:
6
- metadata.gz: 1ee7e44521b2b4bd767a8c2e1d4617adbef39aee0521db52a65ce655e13209474a05b19adf1434ceb9fc81148641fc5d4f03a2411b7887efd2ef98b3253aa109
7
- data.tar.gz: 622d33937e01d8fafeb011dc950be17f0e4cf03ee994f6f66d341181bf00bc79c3161f91156e13d367853c70af076606cf69fe2f0f6f30528502023b057edba1
6
+ metadata.gz: e7f0f82b1a85a206f02a5289e66bab3ef6b0fd3e2286978563812bac65787460432a55f0184153b4b2248f0db07e3ef61803c7c7311966ce98ef2b299df38d3b
7
+ data.tar.gz: 1828a5d2fa756c05711db0caf8005ee4492df9994a08e6b699835d17593c3eeff89b464fc3b6e6e0094bdb79603a554cf96e4ac6cb1ba038e517fbef645d5586
@@ -1,19 +1,22 @@
1
1
  module FuncList
2
2
 
3
3
  require_relative "filtSymbols.rb"
4
+ require 'pathname'
4
5
 
5
6
  # @@func_regex = /\s*(\w+)\s*:\s*\(\s*\w*\s*\s*\w+\s*\*?\s*\)\s*\w+\s*/
6
7
  @@func_regex = /\s*[-\+]\s*(\w+)\s*:\s*\(\s*\w*\s*\s*\w+\s*\*?\s*\)\s*\w+\s*/
7
8
  @@func_simple_regex = /\s*[-\+]\s*\(\s*\w+\s*\*?\)\s*(\w+)\s*;*/
8
- @@hcls_regex = /@interface\s+(\w+)\s*/
9
+ @@hcls_regex = /@interface\s+(\w+)\s*:\s*(\w+)/
9
10
  @@mcls_regex = /@implementation\s+(\w+)\s*/
10
11
  @@property_regex = /\s*@property\s*\(.*?getter=(\w+).*?\)\s*\w+\s*\*?\s*\w+\s*.*;/
11
12
  @@property_regex2 = /\s*@property\s*\(.*?\)\s*\w+\s*\*?\s*(\w+)\s*.*;/
12
13
  @@property_regex3 = /\s*@property\s*\(.*?\)\s*\w+\s*<.*>\s*\*?\s*(\w+)\s*.*;/
13
14
  #---------------filter regex----------------
15
+ @@storyboard_filt_regex = /customClass="(\w+)"/
14
16
  @@value_for_key_filte_regex = /\[\w*\s+setValue\s*:\s*.*\s* forKey\s*:\s*@\"(.*)\"\]/
15
17
  @@class_from_str_regex = /NSClassFromString\(\s*@"(\w+)"\s*\)/
16
18
  @@func_filt_keys = ["IBAction"]
19
+ @@cls_filt_keys = ["NSManagedObject"]
17
20
 
18
21
  def self.validate?(str, type)
19
22
  for filt_key in @@func_filt_keys
@@ -28,9 +31,26 @@ module FuncList
28
31
  str.encode("UTF-8", 'binary', invalid: :replace, undef: :replace, replace: '')
29
32
  end
30
33
 
31
- def self.capture(content_str,type = "m",fetch_types=["p","f","c"])
32
- results = []
34
+ def self.capture(content_str,type = "m",fetch_types=["p","f","c"],file_path=nil,is_need_filt=false)
33
35
  str = to_utf8 content_str
36
+
37
+ #filter file
38
+ if file_path.include? ".storyboard"
39
+ str.scan @@storyboard_filt_regex do |curr_match|
40
+ md = Regexp.last_match
41
+ whole_match = md[0]
42
+ captures = md.captures
43
+
44
+ captures.each do |capture|
45
+ FiltSymbols.insertValue capture
46
+ p "过滤的#{File.basename(file_path)}数据:#{capture}"
47
+ end
48
+ end
49
+ return []
50
+ end
51
+
52
+ # begin capture
53
+ results = []
34
54
  if fetch_types.include? "f"
35
55
  str.scan @@func_regex do |curr_match|
36
56
  md = Regexp.last_match
@@ -76,6 +96,14 @@ module FuncList
76
96
  captures = md.captures
77
97
 
78
98
  captures.each do |capture|
99
+ if is_need_filt
100
+ if @@cls_filt_keys.include? capture
101
+ puts "过滤类#{capture}..."
102
+ if file_path
103
+ FiltSymbols.loadFiltSymbols file_path
104
+ end
105
+ end
106
+ end
79
107
  results << "c:#{capture}"
80
108
  #p [whole_match, capture]
81
109
  p "c:[#{capture}]"
@@ -118,7 +146,6 @@ module FuncList
118
146
  end
119
147
  end
120
148
  end
121
-
122
149
  #---------------记录可能引起崩溃的字段----------------
123
150
  str.scan @@value_for_key_filte_regex do |curr_match|
124
151
  md = Regexp.last_match
@@ -131,7 +158,6 @@ module FuncList
131
158
  end
132
159
  end
133
160
 
134
-
135
161
  str.scan @@class_from_str_regex do |curr_match|
136
162
  md = Regexp.last_match
137
163
  whole_match = md[0]
@@ -142,7 +168,6 @@ module FuncList
142
168
  p "过滤的[NSClassFromString]数据:#{capture}"
143
169
  end
144
170
  end
145
-
146
171
  results
147
172
  end
148
173
 
@@ -150,6 +175,9 @@ module FuncList
150
175
  capture_methods = []
151
176
  p_methods = []
152
177
  funclist_path = "#{path}/func.list"
178
+ if File.file?(path)
179
+ funclist_path = "#{File.dirname(path)}/func.list"
180
+ end
153
181
  file = File.open(funclist_path, "w")
154
182
  file_pathes = []
155
183
  if type == "h" || type == "m"
@@ -158,9 +186,11 @@ module FuncList
158
186
  file_pathes += `find #{path} -name "*.h" -d`.split "\n"
159
187
  file_pathes += `find #{path} -name "*.m" -d`.split "\n"
160
188
  end
189
+ file_pathes += `find #{path} -name "*.storyboard" -d`.split "\n"
190
+
161
191
  file_pathes.each do |file_path|
162
192
  content = File.read file_path
163
- captures = capture content , type , fetch_types
193
+ captures = capture content , type , fetch_types, file_path, need_filt
164
194
  captures.each do |capture_method|
165
195
  method_type = capture_method.split(":").first
166
196
  method_content = capture_method.split(":").last
@@ -1,3 +1,3 @@
1
1
  module Codeobscure
2
- VERSION = "0.1.6.2"
2
+ VERSION = "0.1.6.3"
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.2
4
+ version: 0.1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-07 00:00:00.000000000 Z
11
+ date: 2018-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler