obfu_report 0.0.2.alpha
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +60 -0
- data/Rakefile +2 -0
- data/lib/obfu_report/version.rb +3 -0
- data/lib/obfu_report.rb +48 -0
- data/obfu_report.gemspec +17 -0
- metadata +54 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Alfonso Rush
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# ObfuReport
|
2
|
+
|
3
|
+
This gem receives a string and an array then obfuscates the string based on the array values and counts the frequency of array words that exist in the string.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'obfu_report'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install obfu_report
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
You can test this gem from the command line by copying the following code:
|
22
|
+
|
23
|
+
BEGIN CUT HERE
|
24
|
+
|
25
|
+
require 'obfu_report'
|
26
|
+
|
27
|
+
|
28
|
+
puts "Enter in a string of words"
|
29
|
+
str = gets.chomp
|
30
|
+
puts "Enter in a list of words one at a time followed by the word 'exit' on the last line"
|
31
|
+
i = 0
|
32
|
+
lst = []
|
33
|
+
userword = 'word1'
|
34
|
+
while userword != 'exit'
|
35
|
+
userword = gets.chomp
|
36
|
+
lst[i] = userword
|
37
|
+
i = i + 1
|
38
|
+
if userword == 'exit'
|
39
|
+
lst.pop
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
o = Obfu_report.new
|
44
|
+
o.obfu_report(str,lst)
|
45
|
+
|
46
|
+
END CUT HERE
|
47
|
+
|
48
|
+
Save this code as a file named test.rb.
|
49
|
+
|
50
|
+
Once you've installed this gem locally...from the command line type 'ruby test.rb'
|
51
|
+
Enter in a string and a list as the programs instructions state...then type 'exit'
|
52
|
+
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/obfu_report.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "obfu_report/version"
|
2
|
+
|
3
|
+
module ObfuReport
|
4
|
+
# Your code goes here...
|
5
|
+
def obfu_report(string, list)
|
6
|
+
# "obfuscate" returns the string with all words from the list obfuscated.
|
7
|
+
# obfuscate("big string of big words is bigger", ["big", "words"])
|
8
|
+
# ==> "*** string of *** ***** is bigger"
|
9
|
+
def obfuscate(string, list)
|
10
|
+
# check that input is a string and an array
|
11
|
+
if (string.is_a? String)&&(list.is_a? Array)
|
12
|
+
# iterate each item in the list
|
13
|
+
list.each do |wrd|
|
14
|
+
# look for this word in the string
|
15
|
+
string = string.gsub(/\b#{wrd}\b/, "*")
|
16
|
+
end
|
17
|
+
puts "Obfuscated: #{string}"
|
18
|
+
else
|
19
|
+
puts "bad input, try again."
|
20
|
+
puts "#{string} #{list}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# "report" returns a hash containing the list of words and their associated frequency in the string.
|
24
|
+
# report("big string of big words is bigger", ["big", "words"])
|
25
|
+
# ==> {"big" => 2, "words" => 1}
|
26
|
+
def report(string,list)
|
27
|
+
if (string.is_a? String)&&(list.is_a? Array)
|
28
|
+
puts "Word count: "
|
29
|
+
list.each do |word|
|
30
|
+
test = string.split.count(word)
|
31
|
+
puts word + " => " + test.to_s
|
32
|
+
end
|
33
|
+
else
|
34
|
+
puts "bad input, try again."
|
35
|
+
puts "#{string} #{list}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
puts "Original string: #{string}"
|
40
|
+
puts "Original list: #{list}"
|
41
|
+
obfuscate(string, list)
|
42
|
+
report(string, list)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Obfu_report
|
47
|
+
include ObfuReport
|
48
|
+
end
|
data/obfu_report.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/obfu_report/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Alfonso Rush"]
|
6
|
+
gem.email = ["thefonso@thefonso.com"]
|
7
|
+
gem.description = %q{gem receives a string and an array then obfuscates the string based on the array values and counts the frequency of array words in string}
|
8
|
+
gem.summary = %q{Obfuscation and word count gem}
|
9
|
+
gem.homepage = "https://github.com/thefonso/obfu_report"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "obfu_report"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = ObfuReport::VERSION
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: obfu_report
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2.alpha
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alfonso Rush
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: gem receives a string and an array then obfuscates the string based on
|
15
|
+
the array values and counts the frequency of array words in string
|
16
|
+
email:
|
17
|
+
- thefonso@thefonso.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/obfu_report.rb
|
28
|
+
- lib/obfu_report/version.rb
|
29
|
+
- obfu_report.gemspec
|
30
|
+
homepage: https://github.com/thefonso/obfu_report
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>'
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.1
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.22
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: Obfuscation and word count gem
|
54
|
+
test_files: []
|