objc-obfuscator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/obfuscator.rb +46 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTE2ZmNmOTAzOWQ2NDMzNDljYThiN2I0NWM1NDRiYWEyM2EwYzdiMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDg1YjVlZGZmNDg1YTJkOGZjNDk5ZGVlODk2NWUzYmI5MTg1ODU0Mg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWU4YzIzYmQ2ZDRlODRjMzJlYzY1OGVhNTZmYWJmYmI1YjVjYWVhYWUwNmQw
|
10
|
+
M2E3ZGU5NjM0ZDEwNzAzZjllZDg5ZmY5NDNjZTU3OTQ4ZTg1ZWZkMmQxZmU4
|
11
|
+
MmI1NTQ0ZWQ5YWI5YWRkZTE4MzQ5NjI1MDJmN2RkYWVjZTRlYjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmY3ZjQ4MjJkZGVlN2MwZGVmMjU1YTU0MzZhNmU4NGVhNzQ1ZmU0NGY2NGQz
|
14
|
+
ODY4ZmY3NDY2OTUxNWVmNmNkNDhjYzg5MTk0ZTBiYTRmMjIwODljMGY1MmY3
|
15
|
+
NjYzMDIzYTY2YWNjMDJhYTZiMWYzZmMwZmZmZDYwYzkwZGVkZjQ=
|
data/lib/obfuscator.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'encryptor'
|
3
|
+
require 'digest/sha2'
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
abort "USAGE: obfuscator [encryption_key] [filename]" if(ARGV.size < 2)
|
7
|
+
|
8
|
+
key = ARGV[0]
|
9
|
+
|
10
|
+
salt = Time.now.to_i.to_s
|
11
|
+
iv = OpenSSL::Cipher::Cipher.new('aes-256-cbc').random_iv
|
12
|
+
Encryptor.default_options.merge!(:key => key, :iv => iv, :salt => salt)
|
13
|
+
|
14
|
+
keyword = '__obfuscated'
|
15
|
+
|
16
|
+
source_file_path = ARGV[1]
|
17
|
+
temp_file_path = "#{source_file_path}.tmp"
|
18
|
+
abort "FATAL: File #{source_file_path} not found!" unless File.exist? source_file_path
|
19
|
+
File.delete(temp_file_path) if File.exist?(temp_file_path)
|
20
|
+
|
21
|
+
source_file = File.open(source_file_path, 'r')
|
22
|
+
dest_file = File.open(temp_file_path, 'w')
|
23
|
+
|
24
|
+
while !source_file.eof?
|
25
|
+
line = source_file.readline
|
26
|
+
if line.include? keyword
|
27
|
+
unencrypted_string = line.scan(/@"(.*)"\s*;/).last.first
|
28
|
+
if unencrypted_string.empty?
|
29
|
+
puts "ERROR: Found occurence of __obfuscated string but can't replace!!!"
|
30
|
+
else
|
31
|
+
puts "INFO: File: #{source_file_path}"
|
32
|
+
puts "INFO: Found occurence of __obfuscated string: '#{unencrypted_string}'. Replacing..."
|
33
|
+
end
|
34
|
+
encrypted = "#{Base64.strict_encode64(unencrypted_string.encrypt)}-#{Base64.strict_encode64(iv)}-#{Base64.strict_encode64(salt)}"
|
35
|
+
line.slice! keyword
|
36
|
+
line = line.gsub(unencrypted_string, encrypted)
|
37
|
+
end
|
38
|
+
dest_file.puts line
|
39
|
+
end
|
40
|
+
source_file.close
|
41
|
+
dest_file.close
|
42
|
+
|
43
|
+
FileUtils.mv source_file_path, "#{source_file_path}.bak"
|
44
|
+
FileUtils.mv temp_file_path, source_file_path
|
45
|
+
|
46
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: objc-obfuscator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabio Gallonetto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple obfuscator that encrypts strings in source files
|
14
|
+
email: fabio@futureworkshops.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/obfuscator.rb
|
20
|
+
homepage: http://github.com/FutureWorkshops/Obfuscator-ruby
|
21
|
+
licenses:
|
22
|
+
- BSD
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.7
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A simple obfuscator that encrypts strings in source files
|
44
|
+
test_files: []
|