wmap 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +141 -0
- data/LICENSE.txt +15 -0
- data/README.rdoc +98 -0
- data/TODO +13 -0
- data/bin/deprime +21 -0
- data/bin/distrust +38 -0
- data/bin/googleBot +23 -0
- data/bin/prime +21 -0
- data/bin/refresh +26 -0
- data/bin/run_tests +16 -0
- data/bin/spiderBot +26 -0
- data/bin/trust +38 -0
- data/bin/updateAll +57 -0
- data/bin/wadd +25 -0
- data/bin/wadds +26 -0
- data/bin/wcheck +28 -0
- data/bin/wdel +25 -0
- data/bin/wdump +21 -0
- data/bin/wmap +151 -0
- data/bin/wscan +32 -0
- data/data/cidrs +2 -0
- data/data/deactivated_sites +1 -0
- data/data/domains +2 -0
- data/data/hosts +1 -0
- data/data/prime_hosts +1 -0
- data/data/sites +2 -0
- data/data/sub_domains +2 -0
- data/demos/bruter.rb +27 -0
- data/demos/dns_brutes.rb +28 -0
- data/demos/filter_cidr.rb +18 -0
- data/demos/filter_crawls.rb +5 -0
- data/demos/filter_domain.rb +25 -0
- data/demos/filter_geoip.rb +26 -0
- data/demos/filter_known_services.rb +59 -0
- data/demos/filter_netinfo.rb +23 -0
- data/demos/filter_prime.rb +25 -0
- data/demos/filter_profiler.rb +3 -0
- data/demos/filter_redirection.rb +19 -0
- data/demos/filter_site.rb +40 -0
- data/demos/filter_siteip.rb +31 -0
- data/demos/filter_status.rb +17 -0
- data/demos/filter_timestamp.rb +23 -0
- data/demos/filter_url.rb +19 -0
- data/demos/new_fnd.rb +66 -0
- data/demos/nmap_parser.pl +138 -0
- data/demos/site_format.rb +18 -0
- data/demos/whois_domain.rb +78 -0
- data/dicts/GeoIP.dat +0 -0
- data/dicts/GeoIPASNum.dat +0 -0
- data/dicts/GeoLiteCity.dat +0 -0
- data/dicts/ccsld.txt +2646 -0
- data/dicts/cctld.txt +243 -0
- data/dicts/gtld.txt +25 -0
- data/dicts/hostnames-dict.big +1402 -0
- data/dicts/hostnames-dict.txt +101 -0
- data/lib/wmap/cidr_tracker.rb +327 -0
- data/lib/wmap/dns_bruter.rb +308 -0
- data/lib/wmap/domain_tracker/sub_domain.rb +142 -0
- data/lib/wmap/domain_tracker.rb +342 -0
- data/lib/wmap/geoip_tracker.rb +72 -0
- data/lib/wmap/google_search_scraper.rb +177 -0
- data/lib/wmap/host_tracker/primary_host.rb +130 -0
- data/lib/wmap/host_tracker.rb +550 -0
- data/lib/wmap/network_profiler.rb +144 -0
- data/lib/wmap/port_scanner.rb +208 -0
- data/lib/wmap/site_tracker/deactivated_site.rb +85 -0
- data/lib/wmap/site_tracker.rb +937 -0
- data/lib/wmap/url_checker.rb +314 -0
- data/lib/wmap/url_crawler.rb +381 -0
- data/lib/wmap/utils/domain_root.rb +184 -0
- data/lib/wmap/utils/logger.rb +53 -0
- data/lib/wmap/utils/url_magic.rb +343 -0
- data/lib/wmap/utils/utils.rb +333 -0
- data/lib/wmap/whois.rb +76 -0
- data/lib/wmap.rb +227 -0
- data/logs/wmap.log +17 -0
- data/ruby_whois_patches/base_cocca2.rb +149 -0
- data/ruby_whois_patches/kero.yachay.pe.rb +120 -0
- data/ruby_whois_patches/whois.PublicDomainRegistry.com.rb +124 -0
- data/ruby_whois_patches/whois.above.com.rb +61 -0
- data/ruby_whois_patches/whois.adamsnames.tc.rb +107 -0
- data/ruby_whois_patches/whois.aeda.net.ae.rb +105 -0
- data/ruby_whois_patches/whois.ai.rb +112 -0
- data/ruby_whois_patches/whois.arnes.si.rb +121 -0
- data/ruby_whois_patches/whois.ascio.com.rb +91 -0
- data/ruby_whois_patches/whois.cnnic.cn.rb +123 -0
- data/ruby_whois_patches/whois.corporatedomains.com.rb +67 -0
- data/ruby_whois_patches/whois.crsnic.net.rb +108 -0
- data/ruby_whois_patches/whois.denic.de.rb +174 -0
- data/ruby_whois_patches/whois.dk-hostmaster.dk.rb +120 -0
- data/ruby_whois_patches/whois.dns.be.rb +134 -0
- data/ruby_whois_patches/whois.dns.lu.rb +129 -0
- data/ruby_whois_patches/whois.dns.pl.rb +150 -0
- data/ruby_whois_patches/whois.dns.pt.rb +119 -0
- data/ruby_whois_patches/whois.domain.kg.rb +126 -0
- data/ruby_whois_patches/whois.domainregistry.my.rb +123 -0
- data/ruby_whois_patches/whois.domreg.lt.rb +110 -0
- data/ruby_whois_patches/whois.dot.tk.rb +140 -0
- data/ruby_whois_patches/whois.hkirc.hk.rb +121 -0
- data/ruby_whois_patches/whois.isnic.is.rb +130 -0
- data/ruby_whois_patches/whois.je.rb +119 -0
- data/ruby_whois_patches/whois.jprs.jp.rb +137 -0
- data/ruby_whois_patches/whois.kenic.or.ke.rb +140 -0
- data/ruby_whois_patches/whois.markmonitor.com.rb +118 -0
- data/ruby_whois_patches/whois.melbourneit.com.rb +58 -0
- data/ruby_whois_patches/whois.nic.as.rb +96 -0
- data/ruby_whois_patches/whois.nic.at.rb +109 -0
- data/ruby_whois_patches/whois.nic.ch.rb +141 -0
- data/ruby_whois_patches/whois.nic.cl.rb +117 -0
- data/ruby_whois_patches/whois.nic.ec.rb +157 -0
- data/ruby_whois_patches/whois.nic.im.rb +120 -0
- data/ruby_whois_patches/whois.nic.it.rb +170 -0
- data/ruby_whois_patches/whois.nic.lv.rb +116 -0
- data/ruby_whois_patches/whois.nic.ly.rb +127 -0
- data/ruby_whois_patches/whois.nic.mu.rb +27 -0
- data/ruby_whois_patches/whois.nic.mx.rb +123 -0
- data/ruby_whois_patches/whois.nic.net.sa.rb +111 -0
- data/ruby_whois_patches/whois.nic.or.kr.rb +101 -0
- data/ruby_whois_patches/whois.nic.tel.rb +129 -0
- data/ruby_whois_patches/whois.nic.tr.rb +133 -0
- data/ruby_whois_patches/whois.nic.us.rb +129 -0
- data/ruby_whois_patches/whois.nic.ve.rb +135 -0
- data/ruby_whois_patches/whois.norid.no.rb +127 -0
- data/ruby_whois_patches/whois.pandi.or.id.rb +118 -0
- data/ruby_whois_patches/whois.psi-usa.info.rb +63 -0
- data/ruby_whois_patches/whois.registro.br.rb +109 -0
- data/ruby_whois_patches/whois.registrygate.com.rb +55 -0
- data/ruby_whois_patches/whois.rrpproxy.net.rb +61 -0
- data/ruby_whois_patches/whois.sgnic.sg.rb +130 -0
- data/ruby_whois_patches/whois.srs.net.nz.rb +166 -0
- data/ruby_whois_patches/whois.tucows.com.rb +70 -0
- data/ruby_whois_patches/whois.twnic.net.tw.rb +133 -0
- data/settings/discovery_ports +24 -0
- data/settings/google_keywords.txt +9 -0
- data/settings/google_locator.txt +23 -0
- data/test/domain_tracker_test.rb +31 -0
- data/test/utils_test.rb +168 -0
- data/version.txt +13 -0
- data/wmap.gemspec +49 -0
- metadata +202 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
# Parser for the whois.hkirc.hk server.
|
18
|
+
#
|
19
|
+
# @note This parser is just a stub and provides only a few basic methods
|
20
|
+
# to check for domain availability and get domain status.
|
21
|
+
# Please consider to contribute implementing missing methods.
|
22
|
+
#
|
23
|
+
# @see Whois::Record::Parser::Example
|
24
|
+
# The Example parser for the list of all available methods.
|
25
|
+
#
|
26
|
+
class WhoisHkircHk < Base
|
27
|
+
|
28
|
+
property_supported :status do
|
29
|
+
if available?
|
30
|
+
:available
|
31
|
+
else
|
32
|
+
:registered
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
property_supported :available? do
|
37
|
+
content_for_scanner.strip == 'Domain Not Found'
|
38
|
+
end
|
39
|
+
|
40
|
+
property_supported :registered? do
|
41
|
+
!available?
|
42
|
+
end
|
43
|
+
|
44
|
+
property_supported :created_on do
|
45
|
+
if content_for_scanner =~ /Domain Name Commencement Date:\s(.+?)\n/
|
46
|
+
Time.parse($1)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
property_not_supported :updated_on
|
51
|
+
|
52
|
+
property_supported :expires_on do
|
53
|
+
if content_for_scanner =~ /Expiry Date:\s(.+?)\n/
|
54
|
+
time = $1.strip
|
55
|
+
Time.parse(time) unless time == 'null'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
property_supported :nameservers do
|
60
|
+
if content_for_scanner =~ /Name Servers Information:\n\n((.+\n)+)\n/
|
61
|
+
$1.split("\n").map do |name|
|
62
|
+
Record::Nameserver.new(:name => name.strip.downcase)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# The following methods are implemented by Yang Li on 01/23/2013
|
68
|
+
# ----------------------------------------------------------------------------
|
69
|
+
property_supported :domain do
|
70
|
+
return $1 if content_for_scanner =~ /Domain Name:\s+(.*)\n/i
|
71
|
+
end
|
72
|
+
|
73
|
+
property_not_supported :domain_id
|
74
|
+
|
75
|
+
property_supported :registrar do
|
76
|
+
reg=Record::Registrar.new
|
77
|
+
content_for_scanner.scan(/^(Registrar.*?):\s+(.+)\n/).map do |entry|
|
78
|
+
reg["name"] = entry[1] if entry[0] =~ /Registrar\sName$/i
|
79
|
+
reg["url"] = entry[1] if entry[0] =~ /Registrar\sContact/i
|
80
|
+
end
|
81
|
+
return reg
|
82
|
+
end
|
83
|
+
|
84
|
+
property_supported :registrant_contacts do
|
85
|
+
build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
|
86
|
+
end
|
87
|
+
|
88
|
+
property_supported :admin_contacts do
|
89
|
+
build_contact("Administrative", Whois::Record::Contact::TYPE_ADMIN)
|
90
|
+
end
|
91
|
+
|
92
|
+
property_supported :technical_contacts do
|
93
|
+
build_contact("Technical", Whois::Record::Contact::TYPE_TECHNICAL)
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def build_contact(element,type)
|
99
|
+
reg=Record::Contact.new(:type => type)
|
100
|
+
if content_for_scanner.gsub(/(\(|\)|\/)/,' ') =~ /^(#{element}\sContact\sInformation\:\n\n((.+\n)+)\n\n\n)/i
|
101
|
+
values=$1
|
102
|
+
lines=values.split(%r{\n}).delete_if {|x| x !~ /:/}
|
103
|
+
lines.each do |ent|
|
104
|
+
entry=ent.split(':')
|
105
|
+
reg["name"]=entry[1] if entry[0] =~ /Company\s(|English\s*)Name/i
|
106
|
+
reg["email"]=entry[1] if entry[0]=~ /Email/i
|
107
|
+
reg["address"]=entry[1] if entry[0]=~ /Address/i
|
108
|
+
reg["country_code"]=entry[1] if entry[0]=~ /Country/i
|
109
|
+
reg["phone"]=entry[1] if entry[0]=~ /Phone/i
|
110
|
+
reg["fax"]=entry[1] if entry[0]=~ /Fax/i
|
111
|
+
end
|
112
|
+
end
|
113
|
+
return reg
|
114
|
+
end
|
115
|
+
|
116
|
+
# ----------------------------------------------------------------------------
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
#
|
18
|
+
# = whois.isnic.is parser
|
19
|
+
#
|
20
|
+
# Parser for the whois.isnic.is server.
|
21
|
+
#
|
22
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
23
|
+
# to check for domain availability and get domain status.
|
24
|
+
# Please consider to contribute implementing missing methods.
|
25
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
26
|
+
# and examples.
|
27
|
+
#
|
28
|
+
class WhoisIsnicIs < Base
|
29
|
+
|
30
|
+
property_supported :status do
|
31
|
+
if available?
|
32
|
+
:available
|
33
|
+
else
|
34
|
+
:registered
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
property_supported :available? do
|
39
|
+
!!(content_for_scanner =~ /No entries found for query/)
|
40
|
+
end
|
41
|
+
|
42
|
+
property_supported :registered? do
|
43
|
+
!available?
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
property_supported :created_on do
|
48
|
+
if content_for_scanner =~ /created:\s+(.*)\n/
|
49
|
+
Time.parse($1)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
property_not_supported :updated_on
|
54
|
+
|
55
|
+
property_supported :expires_on do
|
56
|
+
if content_for_scanner =~ /expires:\s+(.*)\n/
|
57
|
+
Time.parse($1)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
property_supported :nameservers do
|
63
|
+
content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |name|
|
64
|
+
Record::Nameserver.new(:name => name)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# The following methods are implemented by Yang Li on 02/11/2013
|
69
|
+
# ----------------------------------------------------------------------------
|
70
|
+
property_supported :domain do
|
71
|
+
return $1 if content_for_scanner =~ /^domain:\s+(.*)\n/i
|
72
|
+
end
|
73
|
+
|
74
|
+
property_not_supported :domain_id
|
75
|
+
|
76
|
+
property_supported :registrar do
|
77
|
+
reg=Record::Registrar.new
|
78
|
+
content_for_scanner.scan(/((.+\n)+)\n/)[5].flatten.join('').scan(/^(.+):\s+(.+)\n/).map do |entry|
|
79
|
+
reg["id"] = entry[1] if entry[0] =~ /nic\-hdl/i
|
80
|
+
reg["name"] = entry[1] if entry[0] =~ /role/i
|
81
|
+
reg["organization"] = entry[1] if entry[0] =~ /role/i
|
82
|
+
reg["email"] = entry[1] if entry[0] =~ /e\-mail/i
|
83
|
+
end
|
84
|
+
return reg
|
85
|
+
end
|
86
|
+
|
87
|
+
property_supported :registrant_contacts do
|
88
|
+
build_contact(1, Whois::Record::Contact::TYPE_REGISTRANT)
|
89
|
+
end
|
90
|
+
|
91
|
+
property_supported :admin_contacts do
|
92
|
+
build_contact(3, Whois::Record::Contact::TYPE_ADMIN)
|
93
|
+
end
|
94
|
+
|
95
|
+
property_supported :technical_contacts do
|
96
|
+
build_contact(4, Whois::Record::Contact::TYPE_TECHNICAL)
|
97
|
+
end
|
98
|
+
|
99
|
+
property_supported :billing_contacts do
|
100
|
+
build_contact(2, Whois::Record::Contact::TYPE_BILLING)
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
def build_contact(element, type)
|
106
|
+
reg=Record::Contact.new(:type => type)
|
107
|
+
content_for_scanner.scan(/((.+\n)+)\n/)[element].flatten.join('').scan(/^(.+):\s+(.+)\n/).map do |entry|
|
108
|
+
reg["id"]=entry[1] if entry[0] =~ /nic\-hdl/i
|
109
|
+
reg["name"]=entry[1] if entry[0] =~ /(person|role)/i
|
110
|
+
reg["organization"]=entry[1] if entry[0]=~ /(person|role)/i
|
111
|
+
if entry[0]=~ /(address|descr)/i
|
112
|
+
if reg["address"].nil?
|
113
|
+
reg["address"]=entry[1]
|
114
|
+
else
|
115
|
+
reg["address"]=reg["address"]+", "+entry[1]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
reg["phone"]=entry[1] if entry[0]=~ /phone/i
|
119
|
+
reg["fax"]=entry[1] if entry[0]=~ /fax/i
|
120
|
+
reg["email"]=entry[1] if entry[0]=~ /e\-mail/i
|
121
|
+
end
|
122
|
+
return reg
|
123
|
+
end
|
124
|
+
# ----------------------------------------------------------------------------
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
#
|
18
|
+
# = whois.je parser
|
19
|
+
#
|
20
|
+
# Parser for the whois.je server.
|
21
|
+
#
|
22
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
23
|
+
# to check for domain availability and get domain status.
|
24
|
+
# Please consider to contribute implementing missing methods.
|
25
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
26
|
+
# and examples.
|
27
|
+
#
|
28
|
+
class WhoisJe < Base
|
29
|
+
|
30
|
+
property_supported :status do
|
31
|
+
if content_for_scanner =~ /Status:\s+(.+?)\n/
|
32
|
+
case $1.downcase
|
33
|
+
when "active"
|
34
|
+
:registered
|
35
|
+
when "not registered"
|
36
|
+
:available
|
37
|
+
else
|
38
|
+
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
|
39
|
+
end
|
40
|
+
else
|
41
|
+
Whois.bug!(ParserError, "Unable to parse status.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
property_supported :available? do
|
46
|
+
(status == :available)
|
47
|
+
end
|
48
|
+
|
49
|
+
property_supported :registered? do
|
50
|
+
!available?
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
property_supported :created_on do
|
55
|
+
if content_for_scanner =~ /Created:\s+(.+?)\n/
|
56
|
+
Time.parse($1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
property_supported :updated_on do
|
61
|
+
if content_for_scanner =~ /Modified:\s+(.+?)\n/
|
62
|
+
Time.parse($1)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
property_not_supported :expires_on
|
67
|
+
|
68
|
+
property_supported :nameservers do
|
69
|
+
if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
|
70
|
+
$1.split("\n").map do |name|
|
71
|
+
Record::Nameserver.new(:name => name.strip)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# The following methods are implemented by Yang Li on 02/27/2013
|
77
|
+
# ----------------------------------------------------------------------------
|
78
|
+
property_supported :domain do
|
79
|
+
return $1 if content_for_scanner =~ /^Query:\s+(.*)\n/i
|
80
|
+
end
|
81
|
+
|
82
|
+
property_not_supported :domain_id
|
83
|
+
|
84
|
+
property_supported :registrar do
|
85
|
+
reg=Record::Registrar.new
|
86
|
+
reg["name"] = $1 if content_for_scanner =~ /^Registrar Name:(.+)\n/i
|
87
|
+
reg["organization"] = $1 if content_for_scanner =~ /^Registrar Name:(.+)\n/i
|
88
|
+
reg["url"] = $1 if content_for_scanner =~ /^Registration URL:(.+)\n/i
|
89
|
+
return reg
|
90
|
+
end
|
91
|
+
|
92
|
+
property_supported :registrant_contacts do
|
93
|
+
build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
|
94
|
+
end
|
95
|
+
|
96
|
+
property_not_supported :admin_contacts
|
97
|
+
|
98
|
+
property_not_supported :technical_contacts
|
99
|
+
|
100
|
+
property_not_supported :billing_contacts
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def build_contact(element, type)
|
105
|
+
reg=Record::Contact.new(:type => type)
|
106
|
+
if content_for_scanner =~ /#{element}:\n((.+\n)+)\n/
|
107
|
+
$1.scan(/(.+):\s+(.+)\n/).map do |entry|
|
108
|
+
reg["name"]=entry[1] if entry[0] =~ /Name/i
|
109
|
+
reg["organization"]=entry[1] if entry[0]=~ /Organisation/i
|
110
|
+
end
|
111
|
+
end
|
112
|
+
return reg
|
113
|
+
end
|
114
|
+
# ----------------------------------------------------------------------------
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
# Parser for the whois.jprs.jp server.
|
18
|
+
#
|
19
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
20
|
+
# to check for domain availability and get domain status.
|
21
|
+
# Please consider to contribute implementing missing methods.
|
22
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
23
|
+
# and examples.
|
24
|
+
#
|
25
|
+
class WhoisJprsJp < Base
|
26
|
+
|
27
|
+
property_supported :status do
|
28
|
+
if content_for_scanner =~ /\[Status\]\s+(.+)\n/
|
29
|
+
case $1.downcase
|
30
|
+
when "active"
|
31
|
+
:registered
|
32
|
+
when "reserved"
|
33
|
+
:reserved
|
34
|
+
when "to be suspended"
|
35
|
+
:redemption
|
36
|
+
when "suspended"
|
37
|
+
:expired
|
38
|
+
else
|
39
|
+
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
|
40
|
+
end
|
41
|
+
elsif content_for_scanner =~ /\[State\]\s+(.+)\n/
|
42
|
+
case $1.split(" ").first.downcase
|
43
|
+
when "connected"
|
44
|
+
:registered
|
45
|
+
else
|
46
|
+
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
|
47
|
+
end
|
48
|
+
else
|
49
|
+
:available
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
property_supported :available? do
|
54
|
+
!!(content_for_scanner =~ /No match!!/)
|
55
|
+
end
|
56
|
+
|
57
|
+
property_supported :registered? do
|
58
|
+
!available?
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
# TODO: timezone ('Asia/Tokyo')
|
63
|
+
property_supported :created_on do
|
64
|
+
if content_for_scanner =~ /\[(?:Created on|Registered Date)\][ \t]+(.*)\n/
|
65
|
+
($1.empty?) ? nil : Time.parse($1)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# TODO: timezone ('Asia/Tokyo')
|
70
|
+
property_supported :updated_on do
|
71
|
+
if content_for_scanner =~ /\[Last Updated?\][ \t]+(.*)\n/
|
72
|
+
($1.empty?) ? nil : Time.parse($1)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# TODO: timezone ('Asia/Tokyo')
|
77
|
+
property_supported :expires_on do
|
78
|
+
if content_for_scanner =~ /\[Expires on\][ \t]+(.*)\n/
|
79
|
+
($1.empty?) ? nil : Time.parse($1)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
property_supported :nameservers do
|
85
|
+
content_for_scanner.scan(/\[Name Server\][\s\t]+([^\s\n]+?)\n/).flatten.map do |name|
|
86
|
+
Record::Nameserver.new(:name => name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# The following methods are implemented by Yang Li on 01/28/2013
|
91
|
+
# ----------------------------------------------------------------------------
|
92
|
+
property_supported :domain do
|
93
|
+
return $1 if content_for_scanner =~ /Domain Name\]\s+(.*)\n/i
|
94
|
+
end
|
95
|
+
|
96
|
+
property_not_supported :domain_id
|
97
|
+
|
98
|
+
property_not_supported :registrar
|
99
|
+
|
100
|
+
property_not_supported :admin_contacts
|
101
|
+
|
102
|
+
property_supported :registrant_contacts do
|
103
|
+
build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
|
104
|
+
end
|
105
|
+
|
106
|
+
property_not_supported :technical_contacts
|
107
|
+
|
108
|
+
property_not_supported :billing_contacts
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def build_contact(element, type)
|
113
|
+
reg=Record::Contact.new(:type => type)
|
114
|
+
reg["organization"]=$1.strip if content_for_scanner =~ /\[Registrant\](.*)\n/i
|
115
|
+
reg["name"] = $1.strip if content_for_scanner =~ /\[Name\](.*)\n/i
|
116
|
+
reg["url"] = $1.strip if content_for_scanner =~ /\[Web\sPage\](.*)\n/i
|
117
|
+
reg["email"] = $1.strip if content_for_scanner =~ /\[Email\](.*)\n/i
|
118
|
+
reg["zip"] = $1.strip if content_for_scanner =~ /\[Postal\scode\](.*)\n/i
|
119
|
+
reg["phone"] = $1.strip if content_for_scanner =~ /\[Phone\](.*)\n/i
|
120
|
+
reg["fax"] = $1.strip if content_for_scanner =~ /\[Fax\](.*)\n/i
|
121
|
+
if content_for_scanner =~ /\[Postal\sAddress\](.*)\n((.+\n)+)\n/
|
122
|
+
reg["address"]=$1.strip
|
123
|
+
line_num=1
|
124
|
+
$2.split(%r{\n}).each do |line|
|
125
|
+
reg["city"]=line.strip if line_num==1
|
126
|
+
reg["state"]=line.strip if line_num==2
|
127
|
+
line_num=line_num+1
|
128
|
+
end
|
129
|
+
end
|
130
|
+
return reg
|
131
|
+
end
|
132
|
+
# ----------------------------------------------------------------------------
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
#
|
18
|
+
# = whois.kenic.or.ke parser
|
19
|
+
#
|
20
|
+
# Parser for the whois.kenic.or.ke server.
|
21
|
+
#
|
22
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
23
|
+
# to check for domain availability and get domain status.
|
24
|
+
# Please consider to contribute implementing missing methods.
|
25
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
26
|
+
# and examples.
|
27
|
+
#
|
28
|
+
class WhoisKenicOrKe < Base
|
29
|
+
|
30
|
+
property_supported :status do
|
31
|
+
if content_for_scanner =~ /Status:\s+(.+?)\n/
|
32
|
+
case $1.downcase
|
33
|
+
when "active"
|
34
|
+
:registered
|
35
|
+
when "not registered"
|
36
|
+
:available
|
37
|
+
else
|
38
|
+
Whois.bug!(ParserError, "Unknown status `#{$1}'.")
|
39
|
+
end
|
40
|
+
else
|
41
|
+
Whois.bug!(ParserError, "Unable to parse status.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
property_supported :available? do
|
46
|
+
status == :available
|
47
|
+
end
|
48
|
+
|
49
|
+
property_supported :registered? do
|
50
|
+
!available?
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
property_supported :created_on do
|
55
|
+
if content_for_scanner =~ /Created:\s+(.+?)\n/
|
56
|
+
Time.parse($1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
property_supported :updated_on do
|
61
|
+
if content_for_scanner =~ /Modified:\s+(.+?)\n/
|
62
|
+
Time.parse($1)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
property_supported :expires_on do
|
67
|
+
if content_for_scanner =~ /Expires:\s+(.+?)\n/
|
68
|
+
Time.parse($1)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
property_supported :nameservers do
|
73
|
+
if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
|
74
|
+
$1.split("\n").map do |name|
|
75
|
+
Record::Nameserver.new(:name => name.strip)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# The following methods are implemented by Yang Li on 01/29/2013
|
81
|
+
# ----------------------------------------------------------------------------
|
82
|
+
property_not_supported :domain
|
83
|
+
|
84
|
+
property_not_supported :domain_id
|
85
|
+
|
86
|
+
property_supported :registrar do
|
87
|
+
reg=Record::Registrar.new
|
88
|
+
content_for_scanner.scan(/^.*Registrar(.*):(.+)\n/).map do |entry|
|
89
|
+
reg["name"] = entry[1].strip if entry[0] =~ /Name/i
|
90
|
+
reg["organization"] = entry[1].strip if entry[0] =~ /Name/i
|
91
|
+
end
|
92
|
+
return reg
|
93
|
+
end
|
94
|
+
|
95
|
+
property_supported :admin_contacts do
|
96
|
+
build_contact("Admin Contact", Whois::Record::Contact::TYPE_ADMIN)
|
97
|
+
end
|
98
|
+
|
99
|
+
property_supported :registrant_contacts do
|
100
|
+
build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
|
101
|
+
end
|
102
|
+
|
103
|
+
property_supported :technical_contacts do
|
104
|
+
build_contact("Technical Contact", Whois::Record::Contact::TYPE_TECHNICAL)
|
105
|
+
end
|
106
|
+
|
107
|
+
property_supported :billing_contacts do
|
108
|
+
build_contact("Billing Contact", Whois::Record::Contact::TYPE_BILLING)
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def build_contact(element, type)
|
114
|
+
reg=Record::Contact.new(:type => type)
|
115
|
+
if content_for_scanner =~ /\n\n#{element}:\n((.+\n)+)\n/i
|
116
|
+
con2=$1
|
117
|
+
con1=$1.split(%r{\n}).delete_if { |x| x !~ /(.+):(.+)/ }
|
118
|
+
addr=con2.split(%r{\n}).delete_if { |x| x =~ /(.+):(.+)/ }
|
119
|
+
con1.join("\n").scan(/(.+):(.+)\n/).map do |entry|
|
120
|
+
reg["name"]=entry[1].strip if entry[0]=~/Name/i
|
121
|
+
reg["organization"]=entry[1].strip if entry[0]=~/Organisation/i
|
122
|
+
reg["email"]=entry[1].strip if entry[0]=~ /Email/i
|
123
|
+
reg["phone"]=entry[1].strip if entry[0]=~ /Phone/i
|
124
|
+
end
|
125
|
+
line_num=1
|
126
|
+
addr.each do |line|
|
127
|
+
reg["address"]=line.strip if line_num==2
|
128
|
+
reg["city"]=line.strip if line_num==3
|
129
|
+
reg["country"]=line.strip if line_num==4
|
130
|
+
line_num=line_num+1
|
131
|
+
end
|
132
|
+
end
|
133
|
+
return reg
|
134
|
+
end
|
135
|
+
# ----------------------------------------------------------------------------
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|