my_obfuscate 0.2.0 → 0.2.1
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.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/my_obfuscate.rb +7 -2
- data/my_obfuscate.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -36,8 +36,8 @@ Make an obfuscator.rb script:
|
|
36
36
|
:invite_requests => :truncate,
|
37
37
|
|
38
38
|
:relationships => {
|
39
|
-
:account_id => { :type => :string, :length => 8, :chars =>
|
40
|
-
:code => { :type => :string, :length => 8, :chars =>
|
39
|
+
:account_id => { :type => :string, :length => 8, :chars => MyObfuscate::NUMBER_CHARS },
|
40
|
+
:code => { :type => :string, :length => 8, :chars => MyObfuscate::USERNAME_CHARS }
|
41
41
|
}
|
42
42
|
})
|
43
43
|
obfuscator.obfuscate(STDIN, STDOUT)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/my_obfuscate.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
# This can parse mysqldump outputs when the dumps have option -c, which includes column names in the insert statements.
|
2
1
|
require 'jcode'
|
3
2
|
|
3
|
+
# Class for obfuscating MySQL dumps. This can parse mysqldump outputs when using the -c option, which includes
|
4
|
+
# column names in the insert statements.
|
4
5
|
class MyObfuscate
|
5
6
|
attr_accessor :config
|
6
7
|
|
@@ -9,12 +10,16 @@ class MyObfuscate
|
|
9
10
|
USERNAME_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" + NUMBER_CHARS
|
10
11
|
SENSIBLE_CHARS = USERNAME_CHARS + '+-=[{]}/?|!@#$%^&*()`~'
|
11
12
|
|
13
|
+
# Make a new MyObfuscate object. Pass in a configuration structure to define how the obfuscation should be
|
14
|
+
# performed. See the README.rdoc file for more information.
|
12
15
|
def initialize(configuration = {})
|
13
16
|
@config = configuration
|
14
17
|
end
|
15
18
|
|
16
|
-
#
|
19
|
+
# Read an input stream and dump out an obfuscated output stream. These streams could be StringIO objects, Files,
|
20
|
+
# or STDIN and STDOUT.
|
17
21
|
def obfuscate(input_io, output_io)
|
22
|
+
# We assume that every INSERT INTO line occupies one line in the file, with no internal linebreaks.
|
18
23
|
input_io.each do |line|
|
19
24
|
if regex_result = INSERT_REGEX.match(line)
|
20
25
|
table_name = regex_result[1].to_sym
|
data/my_obfuscate.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{my_obfuscate}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cantino", "Dave Willett", "Mike Grafton", "Mason Glaves"]
|