bitter_domain 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +95 -0
- data/Guardfile +72 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/bitter_domain +32 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bitter_domain.gemspec +49 -0
- data/lib/bitter_domain/bit_shifter.rb +51 -0
- data/lib/bitter_domain/domain_checker.rb +73 -0
- data/lib/bitter_domain/version.rb +3 -0
- data/lib/bitter_domain.rb +5 -0
- metadata +189 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5648f4c353c1bd404ffe48dac0d496c908544ec42ad7683385a5c7b36653f65b
|
|
4
|
+
data.tar.gz: 411b8eae843f42168ce7e7e538e7c32c564a059177dad0532ce155cfc01ab7b1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f34d05508e9019453ad7b09c98fe523be8ee5beb206811caf22ca743b53113025cc33a1b7595a0821c0a059ba4bb715cd843d585113f2d6656b0092a4c0cf9fd
|
|
7
|
+
data.tar.gz: aa0da73a4ab66b582dd49571b28d365cbe706192668a5680ad381ad60b836b4a7a3b034c759bd2a1b13d3b0bb86cdf859ae1dc9df950b65e64fcd07843029eb7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
bitter_domain (0.1.0)
|
|
5
|
+
colorize
|
|
6
|
+
whois (~> 4.0.8)
|
|
7
|
+
whois-parser (~> 1.1.0)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
activesupport (5.2.3)
|
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
|
+
i18n (>= 0.7, < 2)
|
|
15
|
+
minitest (~> 5.1)
|
|
16
|
+
tzinfo (~> 1.1)
|
|
17
|
+
byebug (11.0.1)
|
|
18
|
+
coderay (1.1.2)
|
|
19
|
+
colorize (0.8.1)
|
|
20
|
+
concurrent-ruby (1.1.5)
|
|
21
|
+
diff-lcs (1.3)
|
|
22
|
+
ffi (1.10.0)
|
|
23
|
+
formatador (0.2.5)
|
|
24
|
+
guard (2.15.0)
|
|
25
|
+
formatador (>= 0.2.4)
|
|
26
|
+
listen (>= 2.7, < 4.0)
|
|
27
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
28
|
+
nenv (~> 0.1)
|
|
29
|
+
notiffany (~> 0.0)
|
|
30
|
+
pry (>= 0.9.12)
|
|
31
|
+
shellany (~> 0.0)
|
|
32
|
+
thor (>= 0.18.1)
|
|
33
|
+
guard-compat (1.2.1)
|
|
34
|
+
guard-rspec (4.6.5)
|
|
35
|
+
guard (~> 2.1)
|
|
36
|
+
guard-compat (~> 1.1)
|
|
37
|
+
rspec (>= 2.99.0, < 4.0)
|
|
38
|
+
i18n (1.6.0)
|
|
39
|
+
concurrent-ruby (~> 1.0)
|
|
40
|
+
listen (3.1.5)
|
|
41
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
42
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
43
|
+
ruby_dep (~> 1.2)
|
|
44
|
+
lumberjack (1.0.13)
|
|
45
|
+
method_source (0.9.2)
|
|
46
|
+
minitest (5.11.3)
|
|
47
|
+
nenv (0.3.0)
|
|
48
|
+
notiffany (0.1.1)
|
|
49
|
+
nenv (~> 0.1)
|
|
50
|
+
shellany (~> 0.0)
|
|
51
|
+
pry (0.12.2)
|
|
52
|
+
coderay (~> 1.1.0)
|
|
53
|
+
method_source (~> 0.9.0)
|
|
54
|
+
rake (10.5.0)
|
|
55
|
+
rb-fsevent (0.10.3)
|
|
56
|
+
rb-inotify (0.10.0)
|
|
57
|
+
ffi (~> 1.0)
|
|
58
|
+
rspec (3.8.0)
|
|
59
|
+
rspec-core (~> 3.8.0)
|
|
60
|
+
rspec-expectations (~> 3.8.0)
|
|
61
|
+
rspec-mocks (~> 3.8.0)
|
|
62
|
+
rspec-core (3.8.0)
|
|
63
|
+
rspec-support (~> 3.8.0)
|
|
64
|
+
rspec-expectations (3.8.2)
|
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
|
+
rspec-support (~> 3.8.0)
|
|
67
|
+
rspec-mocks (3.8.0)
|
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
+
rspec-support (~> 3.8.0)
|
|
70
|
+
rspec-support (3.8.0)
|
|
71
|
+
ruby_dep (1.5.0)
|
|
72
|
+
shellany (0.0.1)
|
|
73
|
+
thor (0.20.3)
|
|
74
|
+
thread_safe (0.3.6)
|
|
75
|
+
tzinfo (1.2.5)
|
|
76
|
+
thread_safe (~> 0.1)
|
|
77
|
+
whois (4.0.8)
|
|
78
|
+
whois-parser (1.1.0)
|
|
79
|
+
activesupport (>= 4)
|
|
80
|
+
whois (>= 4.0.6)
|
|
81
|
+
|
|
82
|
+
PLATFORMS
|
|
83
|
+
ruby
|
|
84
|
+
|
|
85
|
+
DEPENDENCIES
|
|
86
|
+
bitter_domain!
|
|
87
|
+
bundler (~> 1.17)
|
|
88
|
+
byebug (~> 11.0.1)
|
|
89
|
+
guard (~> 2.15.0)
|
|
90
|
+
guard-rspec (~> 4.6.0)
|
|
91
|
+
rake (~> 10.0)
|
|
92
|
+
rspec (~> 3.0)
|
|
93
|
+
|
|
94
|
+
BUNDLED WITH
|
|
95
|
+
1.17.2
|
data/Guardfile
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
|
5
|
+
directories %w(app lib config test spec features) \
|
|
6
|
+
.select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
|
7
|
+
|
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
11
|
+
#
|
|
12
|
+
# $ mkdir config
|
|
13
|
+
# $ mv Guardfile config/
|
|
14
|
+
# $ ln -s config/Guardfile .
|
|
15
|
+
#
|
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
17
|
+
|
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
|
20
|
+
# * bundler: 'bundle exec rspec'
|
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
|
23
|
+
# installed the spring binstubs per the docs)
|
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
|
25
|
+
# * 'just' rspec: 'rspec'
|
|
26
|
+
|
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
|
28
|
+
require "guard/rspec/dsl"
|
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
30
|
+
|
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
|
32
|
+
|
|
33
|
+
# RSpec files
|
|
34
|
+
rspec = dsl.rspec
|
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
37
|
+
watch(rspec.spec_files)
|
|
38
|
+
|
|
39
|
+
# Ruby files
|
|
40
|
+
ruby = dsl.ruby
|
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
42
|
+
|
|
43
|
+
watch(ruby.lib_files) { rspec.spec_dir }
|
|
44
|
+
|
|
45
|
+
# Rails files
|
|
46
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
|
47
|
+
dsl.watch_spec_files_for(rails.app_files)
|
|
48
|
+
dsl.watch_spec_files_for(rails.views)
|
|
49
|
+
|
|
50
|
+
watch(rails.controllers) do |m|
|
|
51
|
+
[
|
|
52
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
|
53
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
|
54
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
|
55
|
+
]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Rails config changes
|
|
59
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
|
60
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
|
61
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
|
62
|
+
|
|
63
|
+
# Capybara features specs
|
|
64
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
|
65
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
|
66
|
+
|
|
67
|
+
# Turnip features and steps
|
|
68
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
|
69
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
|
70
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
|
71
|
+
end
|
|
72
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 drake
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# BitterDomain
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bitter_domain`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'bitter_domain'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install bitter_domain
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/axylos/bitter_domain.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/bitter_domain
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'bitter_domain'
|
|
5
|
+
|
|
6
|
+
class CLI < Thor
|
|
7
|
+
default_task :gen_shifts
|
|
8
|
+
package_name "Bitter Domain"
|
|
9
|
+
|
|
10
|
+
desc "get a list of bit flipped domains", "Generate a list of domains 1 bit away from a given domain and check availability with whois"
|
|
11
|
+
method_option "retry".to_sym, aliases: ['-r'], desc: 'retry any domain that errored out; usually due to a connection reset', type: :boolean, default: false
|
|
12
|
+
method_option "flips-only".to_sym, aliases: ['-s'], desc: 'limit output to just flips', type: :boolean, default: false
|
|
13
|
+
method_option :url, aliases: ['-u'], desc: 'url to generate shifts for', required: true
|
|
14
|
+
method_option :verbose, aliases: ['-v'], desc: 'print verbose output'
|
|
15
|
+
def gen_shifts()
|
|
16
|
+
host, ext = options[:url].split(".")
|
|
17
|
+
shifter = BitterDomain::BitShifter.new(host)
|
|
18
|
+
shifted_domains = shifter.get_shifted_domains()
|
|
19
|
+
.map { |dom| "#{dom}.#{ext}" }
|
|
20
|
+
|
|
21
|
+
if options["flips-only".to_sym]
|
|
22
|
+
shifted_domains.each { |shift| $stdout.puts "#{shift}" }
|
|
23
|
+
else
|
|
24
|
+
checker = BitterDomain::DomainChecker.new(shifted_domains)
|
|
25
|
+
checker.test_domains
|
|
26
|
+
checker.retry if options[:retry]
|
|
27
|
+
options[:verbose] ? checker.print_verbose : checker.print_available
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
CLI.start
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "bitter_domain"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "bitter_domain/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "bitter_domain"
|
|
8
|
+
spec.version = BitterDomain::VERSION
|
|
9
|
+
spec.authors = ["axylos"]
|
|
10
|
+
spec.email = ["="]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Generate urls with a single bit flipped for researching bit squatting}
|
|
13
|
+
spec.description = %q{Get a list of available domains 1 bit away from a given domain}
|
|
14
|
+
spec.homepage = "https://github.com/Axylos/squat_logs"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
|
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/Axylos/squat_logs"
|
|
24
|
+
#spec.metadata["changelog_uri"] = "none"
|
|
25
|
+
else
|
|
26
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
27
|
+
"public gem pushes."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
34
|
+
end
|
|
35
|
+
spec.bindir = "bin"
|
|
36
|
+
spec.executables = ['bitter_domain']
|
|
37
|
+
spec.require_paths = ["lib"]
|
|
38
|
+
|
|
39
|
+
spec.add_dependency "colorize"
|
|
40
|
+
spec.add_dependency "whois", "~> 4.0.8"
|
|
41
|
+
spec.add_dependency "whois-parser", "~> 1.1.0"
|
|
42
|
+
|
|
43
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
44
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
45
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
46
|
+
spec.add_development_dependency "guard", "~> 2.15.0"
|
|
47
|
+
spec.add_development_dependency "guard-rspec", "~> 4.6.0"
|
|
48
|
+
spec.add_development_dependency "byebug", "~> 11.0.1"
|
|
49
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module BitterDomain
|
|
2
|
+
class BitShifter
|
|
3
|
+
# accept alphanumeric chars and hyphens
|
|
4
|
+
# but no hyphens at the beginning or end of the domain
|
|
5
|
+
PATTERN = /^[A-Za-z0-9]-?[A-Za-z0-9]+$/
|
|
6
|
+
|
|
7
|
+
def initialize(domain)
|
|
8
|
+
@domain = domain
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def valid_domain?(domain)
|
|
12
|
+
domain.match?(PATTERN) && domain != @domain
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def gen_shifts(byte)
|
|
16
|
+
# left-shift 1 through each bit of the byte
|
|
17
|
+
# and XOR to flip a single one at each position
|
|
18
|
+
shifts = []
|
|
19
|
+
8.times do |i|
|
|
20
|
+
shifted = byte ^ (1 << i)
|
|
21
|
+
shifts.push(shifted)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
shifts
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_shifted_domains
|
|
28
|
+
bytes = @domain.bytes
|
|
29
|
+
domains = []
|
|
30
|
+
|
|
31
|
+
# iterate over a byte array for the original domain
|
|
32
|
+
# get a set of flips for each byte, swap each new byte
|
|
33
|
+
# and then stringify
|
|
34
|
+
bytes.each.with_index do |byte, idx|
|
|
35
|
+
shifts = gen_shifts(byte)
|
|
36
|
+
swapped_domains = shifts.map do |byte|
|
|
37
|
+
copied_bytes = bytes.dup
|
|
38
|
+
copied_bytes[idx] = byte
|
|
39
|
+
copied_bytes
|
|
40
|
+
.map(&:chr)
|
|
41
|
+
.join("")
|
|
42
|
+
.downcase
|
|
43
|
+
end
|
|
44
|
+
domains.concat(swapped_domains)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# kick out anything that doesn't match the pattern above
|
|
48
|
+
domains.keep_if { |domain| valid_domain?(domain) }.uniq
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require 'whois'
|
|
2
|
+
require 'whois-parser'
|
|
3
|
+
require 'colorize'
|
|
4
|
+
|
|
5
|
+
module BitterDomain
|
|
6
|
+
class DomainChecker
|
|
7
|
+
attr_reader :available, :errors, :tested
|
|
8
|
+
def initialize(domains)
|
|
9
|
+
@domains = domains
|
|
10
|
+
@available = []
|
|
11
|
+
@errors = []
|
|
12
|
+
@tested = []
|
|
13
|
+
@whois = Whois::Client.new
|
|
14
|
+
@error_msgs = []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def print_verbose
|
|
18
|
+
puts "\n\nHere are all the tested domains\n".blue
|
|
19
|
+
@tested.each { |domain| puts domain }
|
|
20
|
+
|
|
21
|
+
if @errors.any?
|
|
22
|
+
puts "\n\nHere are all of the domains that errored out\n".red
|
|
23
|
+
@errors.each { |domain| puts domain }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
if @error_msgs.any?
|
|
27
|
+
puts "\n\nHere are the error messages\n".red
|
|
28
|
+
@error_msgs.each { |msg| puts msg }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
rejected = @tested - @available
|
|
32
|
+
if rejected.any?
|
|
33
|
+
puts "\n\nHere are the rejected domains".yellow
|
|
34
|
+
rejected.each { |dom| puts dom }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
puts "\n\nHere are the available domains\n".green
|
|
38
|
+
print_available
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def print_available
|
|
42
|
+
@available.each { |domain| puts domain }
|
|
43
|
+
puts "No available domains" if @available.empty?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_domains
|
|
47
|
+
query_domains(@domains)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def retry
|
|
51
|
+
copies = @errors.dup
|
|
52
|
+
@errors = []
|
|
53
|
+
query_domains(copies)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def query_domains(domains)
|
|
60
|
+
domains.each do |url|
|
|
61
|
+
begin
|
|
62
|
+
record = @whois.lookup(url)
|
|
63
|
+
@tested.push(url)
|
|
64
|
+
is_available = record.parser.available?
|
|
65
|
+
@available.push(url) if is_available
|
|
66
|
+
rescue Exception => boom
|
|
67
|
+
@error_msgs.push(boom)
|
|
68
|
+
@errors.push(url)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bitter_domain
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- axylos
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-04-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: colorize
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: whois
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 4.0.8
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 4.0.8
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: whois-parser
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.1.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.1.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bundler
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.17'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.17'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rake
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '10.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '10.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: guard
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 2.15.0
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 2.15.0
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: guard-rspec
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 4.6.0
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 4.6.0
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: byebug
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: 11.0.1
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: 11.0.1
|
|
139
|
+
description: Get a list of available domains 1 bit away from a given domain
|
|
140
|
+
email:
|
|
141
|
+
- '='
|
|
142
|
+
executables:
|
|
143
|
+
- bitter_domain
|
|
144
|
+
extensions: []
|
|
145
|
+
extra_rdoc_files: []
|
|
146
|
+
files:
|
|
147
|
+
- ".gitignore"
|
|
148
|
+
- ".rspec"
|
|
149
|
+
- ".travis.yml"
|
|
150
|
+
- Gemfile
|
|
151
|
+
- Gemfile.lock
|
|
152
|
+
- Guardfile
|
|
153
|
+
- LICENSE.txt
|
|
154
|
+
- README.md
|
|
155
|
+
- Rakefile
|
|
156
|
+
- bin/bitter_domain
|
|
157
|
+
- bin/console
|
|
158
|
+
- bin/setup
|
|
159
|
+
- bitter_domain.gemspec
|
|
160
|
+
- lib/bitter_domain.rb
|
|
161
|
+
- lib/bitter_domain/bit_shifter.rb
|
|
162
|
+
- lib/bitter_domain/domain_checker.rb
|
|
163
|
+
- lib/bitter_domain/version.rb
|
|
164
|
+
homepage: https://github.com/Axylos/squat_logs
|
|
165
|
+
licenses:
|
|
166
|
+
- MIT
|
|
167
|
+
metadata:
|
|
168
|
+
homepage_uri: https://github.com/Axylos/squat_logs
|
|
169
|
+
source_code_uri: https://github.com/Axylos/squat_logs
|
|
170
|
+
post_install_message:
|
|
171
|
+
rdoc_options: []
|
|
172
|
+
require_paths:
|
|
173
|
+
- lib
|
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
|
+
requirements:
|
|
176
|
+
- - ">="
|
|
177
|
+
- !ruby/object:Gem::Version
|
|
178
|
+
version: '0'
|
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
|
+
requirements:
|
|
181
|
+
- - ">="
|
|
182
|
+
- !ruby/object:Gem::Version
|
|
183
|
+
version: '0'
|
|
184
|
+
requirements: []
|
|
185
|
+
rubygems_version: 3.0.3
|
|
186
|
+
signing_key:
|
|
187
|
+
specification_version: 4
|
|
188
|
+
summary: Generate urls with a single bit flipped for researching bit squatting
|
|
189
|
+
test_files: []
|