bulkdom 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Nicholas Brochu
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,77 @@
1
+ h1. Bulkdom
2
+
3
+ "http://github.com/nbrochu/bulkdom":http://github.com/nbrochu/bulkdom
4
+
5
+ h2. Summary
6
+
7
+ An efficient domain name availability bulk checker.
8
+
9
+ h2. Description
10
+
11
+ Bulkdom is an efficient domain name availability bulk checker that looks for the presence of DNS Records before querying the Whois Server to save on requests and lower the chance of temporarily getting IP banned. Multiple TLDs can be checked at the same time and available results It was extracted out of the awesome and upcoming domain name generator over at "DomainWhirl":http://domainwhirl.com.
12
+
13
+ Note that you could still technically get IP banned by the Whois Server if you decide to do something stupid like checking 10000 domains at once... Be smart!
14
+
15
+ h2. Installation
16
+
17
+ <pre>
18
+ gem install bulkdom
19
+ </pre>
20
+
21
+ h2. How to use
22
+
23
+ <pre>
24
+ require 'rubygems'
25
+ require 'bulkdom'
26
+
27
+ domains_to_check = %w(github domainwhirl nicholasbrochu githubqwerty56)
28
+
29
+ @dl = Bulkdom::DomainList.new
30
+
31
+ @dl.list = domains_to_check
32
+ @dl.tlds = [".com", ".net", ".org"]
33
+
34
+ @dl.process
35
+ #Let it process for a while... @dl.processed will be set to true when done!
36
+
37
+ @dl.return_available(".com")
38
+ @dl.return_available(".net")
39
+ </pre>
40
+
41
+ This is the output you would get in this example:
42
+
43
+ <pre>
44
+ ruby-1.8.7-p302 > @dl.return_available(".com")
45
+ => ["githubqwerty56.com"]
46
+
47
+ ruby-1.8.7-p302 > @dl.return_available(".net")
48
+ => ["domainwhirl.net", "nicholasbrochu.net", "githubqwerty56.net"]
49
+ </pre>
50
+
51
+ h2. Credits
52
+
53
+ * Simone Carletti for the amazing Ruby Whois library.
54
+ * Whoever is responsible for Resolv in the Ruby STDLIB.
55
+
56
+ h2. LICENSE
57
+
58
+ Copyright (c) 2010 - Nicholas Brochu
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining
61
+ a copy of this software and associated documentation files (the
62
+ 'Software'), to deal in the Software without restriction, including
63
+ without limitation the rights to use, copy, modify, merge, publish,
64
+ distribute, sublicense, and/or sell copies of the Software, and to
65
+ permit persons to whom the Software is furnished to do so, subject to
66
+ the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be
69
+ included in all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirname(__FILE__))
2
+
3
+ require 'resolv'
4
+ require 'whois'
5
+
6
+ require 'bulkdom/domain_list.rb'
7
+
8
+ module Bulkdom
9
+ VERSION = "0.1.0"
10
+ end
@@ -0,0 +1,87 @@
1
+ module Bulkdom
2
+ class DomainList
3
+ attr_accessor :list, :tlds, :results, :processed
4
+
5
+ def initialize()
6
+ @list, @tlds = ["example"], [".com"]
7
+ @processed = false
8
+ end
9
+
10
+ def process
11
+ self.results = whois_check(dns_record_check(generate_results_hash(self.list, self.tlds), self.tlds), self.tlds)
12
+ self.processed = true
13
+ end
14
+
15
+ def return_available(tld)
16
+ process unless self.processed
17
+
18
+ available_domains = []
19
+
20
+ self.results.each do |i|
21
+ available_domains << "#{i[:domain]}#{tld}" if i[:tlds]["#{tld.split('.')[1]}_available"] == "y"
22
+ end
23
+
24
+ return available_domains
25
+ end
26
+
27
+ private
28
+
29
+ def generate_results_hash(list, tlds)
30
+ results = []
31
+
32
+ list.each do |d|
33
+ item = {}
34
+ item[:domain] = d
35
+ item[:tlds] = {}
36
+
37
+ tlds.each do |tld|
38
+ item[:tlds]["#{tld.split('.')[1]}_available"] = "u"
39
+ end
40
+
41
+ results << item
42
+ end
43
+
44
+ return results
45
+ end
46
+
47
+ def dns_record_check(results, tlds)
48
+ results.each do |i|
49
+ tlds.each do |tld|
50
+ begin
51
+ Resolv.getaddress("#{i[:domain]}#{tld}")
52
+ i[:tlds]["#{tld.split('.')[1]}_available"] = "n"
53
+ rescue Resolv::ResolvError
54
+ i[:tlds]["#{tld.split('.')[1]}_available"] = "u"
55
+ end
56
+ end
57
+ end
58
+
59
+ return results
60
+ end
61
+
62
+ def whois_check(results, tlds)
63
+ @wc = Whois::Client.new
64
+ @wc.timeout = nil
65
+
66
+ results.each do |i|
67
+ tlds.each do |tld|
68
+ if i[:tlds]["#{tld.split('.')[1]}_available"] == "u"
69
+ begin
70
+ d = @wc.query("#{i[:domain]}#{tld}")
71
+ if d.available?
72
+ i[:tlds]["#{tld.split('.')[1]}_available"] = "y"
73
+ else
74
+ i[:tlds]["#{tld.split('.')[1]}_available"] = "n"
75
+ end
76
+ rescue Exception => e
77
+ i[:tlds]["#{tld.split('.')[1]}_available"] = "u"
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ return results
84
+ end
85
+
86
+ end
87
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bulkdom
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Nicholas Brochu
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-25 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: whois
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 1
30
+ segments:
31
+ - 1
32
+ - 5
33
+ - 1
34
+ version: 1.5.1
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: An efficient domain name availability bulk checker that looks for the presence of DNS Records before querying the Whois Server to save on requests and lower the chance of temporarily getting IP banned.
38
+ email: info@nicholasbrochu.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.textile
46
+ files:
47
+ - LICENSE
48
+ - VERSION
49
+ - lib/bulkdom.rb
50
+ - lib/bulkdom/domain_list.rb
51
+ - README.textile
52
+ has_rdoc: true
53
+ homepage: http://github.com/nbrochu/bulkdom
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --charset=UTF-8
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: An efficient domain name availability bulk checker
86
+ test_files: []
87
+