brutetools 0.0.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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/brutetools.gemspec +17 -0
- data/lib/brutetools.rb +4 -0
- data/lib/brutetools/base/checker.rb +63 -0
- data/lib/brutetools/base/data_provider.rb +19 -0
- data/lib/brutetools/base/proxy_list.rb +21 -0
- data/lib/brutetools/bruteforce_generator.rb +23 -0
- data/lib/brutetools/version.rb +3 -0
- metadata +58 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 MOZGIII
|
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,29 @@
|
|
1
|
+
# BruteTools
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'brutetools'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install brutetools
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/brutetools.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/brutetools/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["MOZGIII"]
|
6
|
+
gem.email = ["mike-n@narod.ru"]
|
7
|
+
gem.description = %q{Brutetools}
|
8
|
+
gem.summary = %q{Brutetools}
|
9
|
+
gem.homepage = ""
|
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 = "brutetools"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = BruteTools::VERSION
|
17
|
+
end
|
data/lib/brutetools.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
module BruteTools
|
2
|
+
module Checker
|
3
|
+
class Base
|
4
|
+
attr_accessor :data_provider
|
5
|
+
attr_accessor :proxy_list
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
@data_provider = options.delete(:data_provider)
|
10
|
+
@proxy_list = options.delete(:proxy_list)
|
11
|
+
|
12
|
+
@callbacks = {}
|
13
|
+
load_callbacks(options.delete(:callbacks)) if options.key?(:callbacks)
|
14
|
+
|
15
|
+
# Load default config
|
16
|
+
config.merge!({
|
17
|
+
:debug => false
|
18
|
+
})
|
19
|
+
|
20
|
+
# Load options left to config
|
21
|
+
config.merge!(options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Config is used to store configuration
|
25
|
+
def config
|
26
|
+
@config ||= {}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Adds a new callback for specified name
|
30
|
+
# When passed both `proc` and block, two callbacks are added
|
31
|
+
def add_callback(name, proc = nil, &block)
|
32
|
+
name = name.to_sym
|
33
|
+
@callbacks[name] ||= []
|
34
|
+
@callbacks[name].concat([proc, block].compact)
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
# Adds callbacks from hash
|
39
|
+
# { :callback_name => proc { ... } }
|
40
|
+
def load_callbacks(callbacks = {})
|
41
|
+
callbacks.each{ |name, block| add_callback(name, block) }
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
# Can be overwritten by implementation to extend callbacks
|
46
|
+
def get_registered_callbacks(name)
|
47
|
+
@callbacks[name.to_sym]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Calls all callbacks registred for the specific name
|
51
|
+
def run_callback(name, *args)
|
52
|
+
procs = get_registered_callbacks(name)
|
53
|
+
procs.each{ |proc| proc.call(*args) }
|
54
|
+
self
|
55
|
+
end
|
56
|
+
|
57
|
+
# This is where all the work goes
|
58
|
+
def run
|
59
|
+
raise "You must implement this!"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BruteTools
|
2
|
+
module DataProvider
|
3
|
+
class Base
|
4
|
+
|
5
|
+
# Get next data portion (next word from dictionary etc)
|
6
|
+
def next
|
7
|
+
raise "You must implement this!"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Just one step back in data portion queue (one word back in dictionary)
|
11
|
+
# Calling `next`, then `regress`, thn `next` again must return the same value.
|
12
|
+
# Depending on a situation, you may even have to implement a history of `next`s!
|
13
|
+
def regress
|
14
|
+
raise "You must implement this!"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BruteTools
|
2
|
+
module ProxyList
|
3
|
+
class Base
|
4
|
+
|
5
|
+
# TODO: finish this!
|
6
|
+
|
7
|
+
def initialize(proxies)
|
8
|
+
@list = proxies
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(meth, *args, &block)
|
12
|
+
if @list.respond_to? meth
|
13
|
+
@list.send(meth, *args, &block)
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BruteTools
|
2
|
+
class BruteforceGenerator
|
3
|
+
def initialize(alphabet, start = 0)
|
4
|
+
@alphabet = alphabet
|
5
|
+
@alphabet = @alphabet.split('') if @alphabet.kind_of? String
|
6
|
+
@start = start
|
7
|
+
@start = @alphabet[0] * @start if @start.kind_of? Numeric
|
8
|
+
@length = @start.length
|
9
|
+
@buff = @start.split('').map{ |e| @alphabet.index(e) }
|
10
|
+
end
|
11
|
+
|
12
|
+
def next
|
13
|
+
return nil if @buff.all?{ |o| o == @alphabet.size - 1 }
|
14
|
+
|
15
|
+
poped = []
|
16
|
+
poped << @buff.pop while @buff.last == @alphabet.size - 1
|
17
|
+
@buff[-1] += 1
|
18
|
+
@buff += ([0] * poped.length)
|
19
|
+
|
20
|
+
@buff.map{ |i| @alphabet[i] }.join
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brutetools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- MOZGIII
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-28 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Brutetools
|
15
|
+
email:
|
16
|
+
- mike-n@narod.ru
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- brutetools.gemspec
|
27
|
+
- lib/brutetools.rb
|
28
|
+
- lib/brutetools/base/checker.rb
|
29
|
+
- lib/brutetools/base/data_provider.rb
|
30
|
+
- lib/brutetools/base/proxy_list.rb
|
31
|
+
- lib/brutetools/bruteforce_generator.rb
|
32
|
+
- lib/brutetools/version.rb
|
33
|
+
homepage: ''
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.10
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: Brutetools
|
57
|
+
test_files: []
|
58
|
+
has_rdoc:
|