codeobscure 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: f6725f7275c6170bb48f4551f9bf7075aa8ec1d6
4
- data.tar.gz: 2f45a299cc5ba9fc866718291e5241ee308fcd7e
3
+ metadata.gz: cc46c29d16431aa5724127eb45ff735d61616676
4
+ data.tar.gz: a2d88e7530509c538456faf34689e3a4bd83b52a
5
5
  SHA512:
6
- metadata.gz: 9c7f0b3e7d0ee4c2836ff5de2a2a2d073cb598fee981284e9dd3da28c160976ec295f1031c66f740c87366fffbe9fe2285dbf55f37c839c0e74af1bcb652a6a4
7
- data.tar.gz: 9a4abce7dfc40103ae69d914272da4d77e65d076a951aaf9391466ec400d7a95b01b12c8a3d340acfc38f0d83387ef19d8955650ad6bff7e3c4d89c86532712e
6
+ metadata.gz: 50342df74fc000230cf46a163ca7a8f10027465d7b42ef7fc9dd8a25e12d59989b29cd071fe7ceed11521f07d24afa0fc124ab353d4a318429000f91303238de
7
+ data.tar.gz: 7afa08ca24f4e388f133b8c953fcd24b5e8d7642cdf81f680c5be6b5f7b20c34fe45eea806eb23e45be44b81ec6a81523348f354f96502baa534971157a7afa4
data/lib/codeobscure.rb CHANGED
@@ -9,6 +9,8 @@ require 'optparse'
9
9
 
10
10
  module Codeobscure
11
11
 
12
+ @@ignore_symbols_path = "ignoresymbols"
13
+
12
14
  def self.root
13
15
  File.dirname __dir__
14
16
  end
@@ -36,6 +38,10 @@ module Codeobscure
36
38
  options[:fetch] = v
37
39
  end
38
40
 
41
+ opts.on("-i", "--ignore XcodeprojPath", "create a ignore file, you can write your filt symbols in it.eg:name,age ...") do |v|
42
+ options[:ignore] = v
43
+ end
44
+
39
45
  end.parse!
40
46
 
41
47
  if options[:reset]
@@ -43,6 +49,17 @@ module Codeobscure
43
49
  `cp #{root_dir}/filtSymbols_standard #{root_dir}/filtSymbols`
44
50
  end
45
51
 
52
+ if options[:ignore]
53
+ xpj_path = options[:ignore]
54
+ if File.exist? xpj_path
55
+ root_dir = xpj_path.split("/")[0...-1].join "/"
56
+ ignore_path = "#{root_dir}/#{@@ignore_symbols_path}"
57
+ if !File.exist? ignore_path
58
+ `touch #{ignore_path}`
59
+ end
60
+ end
61
+ end
62
+
46
63
  #only load, execute load only
47
64
  #only obscure, execute obscure only
48
65
  #load and obscure at same time,load firt,then obscure.That's mean you can get rid of some directoies.
@@ -88,7 +105,7 @@ module Codeobscure
88
105
  elsif prefix_header.include? "codeObfuscation.h"
89
106
  puts "#{target.name}:#{build_config}配置文件已配置完成".colorize(:green)
90
107
  else
91
- puts "请在#{prefix_header.class.name}中#import \"codeObfuscation.h\"".colorize(:green)
108
+ puts "请在#{prefix_header}中#import \"codeObfuscation.h\"".colorize(:green)
92
109
  end
93
110
  end
94
111
  end
@@ -12,6 +12,7 @@ module Obscure
12
12
  @@TABLENAME="symbols"
13
13
  @@SYMBOL_DB_FILE="symbols"
14
14
  @@STRING_SYMBOL_FILE="func.list"
15
+ @@IGNORE_NAME="ignoresymbols"
15
16
 
16
17
  #维护数据库方便日后作排重
17
18
  def self.createTable
@@ -38,6 +39,13 @@ module Obscure
38
39
  @@HEAD_FILE="#{root_dir}/codeObfuscation.h"
39
40
  @@SYMBOL_DB_FILE = "#{root_dir}/#{@@SYMBOL_DB_FILE}"
40
41
  @@STRING_SYMBOL_FILE = "#{root_dir}/#{@@STRING_SYMBOL_FILE}"
42
+
43
+ ignore_symbols = []
44
+ ignore_path = "#{root_dir}/#{@@IGNORE_NAME}"
45
+ if File.exist? ignore_path
46
+ ignore_content = File.read ignore_path
47
+ ignore_symbols = ignore_content.gsub(" " , "").split "\n"
48
+ end
41
49
 
42
50
  if File.exist? @@SYMBOL_DB_FILE
43
51
  `rm -f #{@@SYMBOL_DB_FILE}`
@@ -64,12 +72,16 @@ module Obscure
64
72
  if line_type == "p"
65
73
  result = FiltSymbols.query("set#{line_content.upcase_first_letter}")
66
74
  if result.nil? || result.empty?
67
- file.puts "#define #{line_content} #{ramdom}"
68
- file.puts "#define _#{line_content} _#{ramdom}"
69
- file.puts "#define set#{line_content.upcase_first_letter} set#{ramdom.upcase_first_letter}"
75
+ if !ignore_symbols.include?(line_content)
76
+ file.puts "#define #{line_content} #{ramdom}"
77
+ file.puts "#define _#{line_content} _#{ramdom}"
78
+ file.puts "#define set#{line_content.upcase_first_letter} set#{ramdom.upcase_first_letter}"
79
+ end
70
80
  end
71
81
  else
72
- file.puts "#define #{line_content} #{ramdom}"
82
+ if !ignore_symbols.include?(line_content)
83
+ file.puts "#define #{line_content} #{ramdom}"
84
+ end
73
85
  end
74
86
  end
75
87
  end
@@ -1,3 +1,3 @@
1
1
  module Codeobscure
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-02 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler