wmap 2.7.2 → 2.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -16
- data/bin/refresh +5 -5
- data/lib/wmap.rb +1 -1
- data/lib/wmap/site_tracker.rb +1 -4
- data/lib/wmap/{wp_tracker.rb → site_tracker/wp_tracker.rb} +41 -4
- data/lib/wmap/url_crawler.rb +1 -1
- data/version.txt +2 -2
- data/wmap.gemspec +2 -2
- metadata +4 -59
- data/ruby_whois_patches/base_cocca2.rb +0 -149
- data/ruby_whois_patches/kero.yachay.pe.rb +0 -120
- data/ruby_whois_patches/whois.PublicDomainRegistry.com.rb +0 -124
- data/ruby_whois_patches/whois.above.com.rb +0 -61
- data/ruby_whois_patches/whois.adamsnames.tc.rb +0 -107
- data/ruby_whois_patches/whois.aeda.net.ae.rb +0 -105
- data/ruby_whois_patches/whois.ai.rb +0 -112
- data/ruby_whois_patches/whois.arnes.si.rb +0 -121
- data/ruby_whois_patches/whois.ascio.com.rb +0 -91
- data/ruby_whois_patches/whois.cnnic.cn.rb +0 -123
- data/ruby_whois_patches/whois.corporatedomains.com.rb +0 -67
- data/ruby_whois_patches/whois.crsnic.net.rb +0 -108
- data/ruby_whois_patches/whois.denic.de.rb +0 -174
- data/ruby_whois_patches/whois.dk-hostmaster.dk.rb +0 -120
- data/ruby_whois_patches/whois.dns.be.rb +0 -134
- data/ruby_whois_patches/whois.dns.lu.rb +0 -129
- data/ruby_whois_patches/whois.dns.pl.rb +0 -150
- data/ruby_whois_patches/whois.dns.pt.rb +0 -119
- data/ruby_whois_patches/whois.domain.kg.rb +0 -126
- data/ruby_whois_patches/whois.domainregistry.my.rb +0 -123
- data/ruby_whois_patches/whois.domreg.lt.rb +0 -110
- data/ruby_whois_patches/whois.dot.tk.rb +0 -140
- data/ruby_whois_patches/whois.hkirc.hk.rb +0 -121
- data/ruby_whois_patches/whois.isnic.is.rb +0 -130
- data/ruby_whois_patches/whois.je.rb +0 -119
- data/ruby_whois_patches/whois.jprs.jp.rb +0 -137
- data/ruby_whois_patches/whois.kenic.or.ke.rb +0 -140
- data/ruby_whois_patches/whois.markmonitor.com.rb +0 -118
- data/ruby_whois_patches/whois.melbourneit.com.rb +0 -58
- data/ruby_whois_patches/whois.nic.as.rb +0 -96
- data/ruby_whois_patches/whois.nic.at.rb +0 -109
- data/ruby_whois_patches/whois.nic.ch.rb +0 -141
- data/ruby_whois_patches/whois.nic.cl.rb +0 -117
- data/ruby_whois_patches/whois.nic.ec.rb +0 -157
- data/ruby_whois_patches/whois.nic.im.rb +0 -120
- data/ruby_whois_patches/whois.nic.it.rb +0 -170
- data/ruby_whois_patches/whois.nic.lv.rb +0 -116
- data/ruby_whois_patches/whois.nic.ly.rb +0 -127
- data/ruby_whois_patches/whois.nic.mu.rb +0 -27
- data/ruby_whois_patches/whois.nic.mx.rb +0 -123
- data/ruby_whois_patches/whois.nic.net.sa.rb +0 -111
- data/ruby_whois_patches/whois.nic.or.kr.rb +0 -101
- data/ruby_whois_patches/whois.nic.tel.rb +0 -129
- data/ruby_whois_patches/whois.nic.tr.rb +0 -133
- data/ruby_whois_patches/whois.nic.us.rb +0 -129
- data/ruby_whois_patches/whois.nic.ve.rb +0 -135
- data/ruby_whois_patches/whois.norid.no.rb +0 -127
- data/ruby_whois_patches/whois.pandi.or.id.rb +0 -118
- data/ruby_whois_patches/whois.psi-usa.info.rb +0 -63
- data/ruby_whois_patches/whois.registro.br.rb +0 -109
- data/ruby_whois_patches/whois.registrygate.com.rb +0 -55
- data/ruby_whois_patches/whois.rrpproxy.net.rb +0 -61
- data/ruby_whois_patches/whois.sgnic.sg.rb +0 -130
- data/ruby_whois_patches/whois.srs.net.nz.rb +0 -166
- data/ruby_whois_patches/whois.tucows.com.rb +0 -70
- data/ruby_whois_patches/whois.twnic.net.tw.rb +0 -133
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f2c900ee2ac330d411f3f6496868ea519dd322b236cd00be0b5f3d1d8d43db
|
4
|
+
data.tar.gz: 054a534426e0b9b99730ac6252a9b0e2424866df914d02f6f7f1bdb925588bc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c591b085614ec050ff8637750dfff57c3238ccf42c2fce9cab985ccd0f3e4761ed085632a9db7f4af87be39e2921b33d330c890c1af87213a134bdd37f43553d
|
7
|
+
data.tar.gz: 414720066fee25c30b41beb9c7529f7bfffda513e01e1bf4445cfefcd9ecbf2c421aa64db931a4d489845d664705ededb2474c3240750ad12cd2423b21078987
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ You can try out the complete [demo web app](http://wmap.io/) deployed in the Dig
|
|
27
27
|
## Installation
|
28
28
|
To take full power of this program, you would need an *nix flavor machine with direct Internet access. I have installed it successfully on both Mac and Linux machines. You'll also need the Ruby environment being setup properly. The easiest way to install OWASP Web Mapper is by using Ruby Gems. You can install it from command line:
|
29
29
|
```sh
|
30
|
-
|
30
|
+
$ gem install wmap
|
31
31
|
```
|
32
32
|
|
33
33
|
### Specific Installation Problem with Nokogiri
|
@@ -54,30 +54,24 @@ In addition, the following Ruby GEM dependency are needed by different features
|
|
54
54
|
|
55
55
|
In case you want to install the above gems separately, use the command below:
|
56
56
|
```sh
|
57
|
-
|
57
|
+
$ gem install dnsruby geoip minitest net-ping netaddr nokogiri css_parser open_uri_redirections openssl parallel whois httpclient
|
58
58
|
```
|
59
59
|
|
60
|
-
|
61
|
-
### Ruby-whois Gem Patches
|
62
|
-
This software depends on a patched version of Ruby gem ruby-whois (http://www.ruby-whois.org/) for the domain whois lookup feature. For better result, you could manually add the patches into your local whois gem installation directory as shown below:
|
63
|
-
```sh
|
64
|
-
cp whois_patches/* [Your_ruby_whois_gem_path]/whois/lib/whois/record/parser/
|
65
|
-
```
|
66
|
-
|
67
|
-
Or you can directly download the branched whois gem from this repository - https://github.com/yangsec888/whois
|
68
|
-
|
69
|
-
|
70
60
|
### Before Using This Program
|
71
61
|
You need to define a scope for the program to run successful. The scope includes both your legitimate Internet domain, and your public
|
72
62
|
network block in the CIDR format.
|
73
63
|
|
74
64
|
To add your Internet domain into the scope, use the build-in shell command below:
|
75
65
|
```sh
|
76
|
-
|
66
|
+
$ trust --target XYZ.COM
|
77
67
|
```
|
78
68
|
To add your public network block into the scope (note current support of IPv4 only):
|
79
69
|
```sh
|
80
|
-
|
70
|
+
$ trust --target x.x.x.x/x
|
71
|
+
```
|
72
|
+
Use command switch '--help' for more information
|
73
|
+
```sh
|
74
|
+
$ trust --help
|
81
75
|
```
|
82
76
|
|
83
77
|
### Automatic Discovery and Tracking
|
@@ -94,7 +88,7 @@ The above utility is intelligent enough to take argument as either a seed file,
|
|
94
88
|
### Dump Out Discovery Database
|
95
89
|
You can dump out the program output by using the build-in utility 'wdump' as shown below:
|
96
90
|
```sh
|
97
|
-
|
91
|
+
$ wdump [output file name from you]
|
98
92
|
```
|
99
93
|
The above utility will dump out the discovery database into a single file as program output. Currently, the supported file format is Comma-separated Value (.csv) and Extensible Markup Language (.xml)
|
100
94
|
|
@@ -114,7 +108,7 @@ The latest release is version [2.6.5+](version.txt). as of fall 2019. Please ref
|
|
114
108
|
|
115
109
|
|
116
110
|
## Author Contact
|
117
|
-
This program is designed and developed by Yang Li. You can reach him by Email: <yang.li@owasp.org>
|
111
|
+
This program is designed and developed by Sam (Yang) Li. You can reach him by Email: <yang.li@owasp.org>
|
118
112
|
## Bug Report or Feature Request?
|
119
113
|
Contact the author Sam (Yang) Li directly at email 'yang.li@owasp.org'.
|
120
114
|
|
data/bin/refresh
CHANGED
@@ -37,11 +37,11 @@ store.verbose = true
|
|
37
37
|
# Preparing - check out the working logs directory
|
38
38
|
if options[:data_dir]
|
39
39
|
# Log to the instance running directory
|
40
|
-
Log_dir = Pathname.new(options[:data_dir]).join('logs')
|
40
|
+
Log_dir = Pathname.new(options[:data_dir]).join('/../logs')
|
41
41
|
store.data_dir = options[:data_dir]
|
42
|
-
sites_file = options[:data_dir] + '/' + 'sites'
|
42
|
+
store.sites_file = options[:data_dir] + '/' + 'sites'
|
43
43
|
#puts "sites_file: #{sites_file}"
|
44
|
-
store.load_site_stores_from_file(sites_file)
|
44
|
+
store.load_site_stores_from_file(store.sites_file)
|
45
45
|
else
|
46
46
|
# Log the command entry
|
47
47
|
Log_dir=Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('logs')
|
@@ -50,7 +50,7 @@ end
|
|
50
50
|
puts Wmap.banner
|
51
51
|
print_usage
|
52
52
|
# Log_dir=File.dirname(__FILE__)+'/../logs/'
|
53
|
-
Wmap.wlog("Execute the command: refresh #{ARGV[0]}","refresh",Log_dir+"wmap.log")
|
53
|
+
Wmap.wlog("Execute the command: refresh #{ARGV[0]}","refresh",Log_dir.to_s+"wmap.log")
|
54
54
|
|
55
55
|
#puts "Captured command argument"
|
56
56
|
if options[:target]
|
@@ -66,7 +66,7 @@ end
|
|
66
66
|
|
67
67
|
# please
|
68
68
|
if options[:data_dir]
|
69
|
-
store.save!(sites_file)
|
69
|
+
store.save!(store.sites_file)
|
70
70
|
else
|
71
71
|
store.save!
|
72
72
|
end
|
data/lib/wmap.rb
CHANGED
@@ -16,7 +16,6 @@ require 'wmap/host_tracker'
|
|
16
16
|
require 'wmap/host_tracker/primary_host'
|
17
17
|
require 'wmap/whois'
|
18
18
|
require 'wmap/url_checker'
|
19
|
-
require 'wmap/wp_tracker'
|
20
19
|
require 'wmap/network_profiler'
|
21
20
|
require 'wmap/port_scanner'
|
22
21
|
require 'wmap/url_crawler'
|
@@ -24,6 +23,7 @@ require 'wmap/url_crawler/adware_tag'
|
|
24
23
|
require 'wmap/dns_bruter'
|
25
24
|
require 'wmap/site_tracker'
|
26
25
|
require 'wmap/site_tracker/deactivated_site'
|
26
|
+
require 'wmap/site_tracker/wp_tracker'
|
27
27
|
require 'wmap/geoip_tracker'
|
28
28
|
require 'wmap/google_search_scraper'
|
29
29
|
|
data/lib/wmap/site_tracker.rb
CHANGED
@@ -189,13 +189,11 @@ class Wmap::SiteTracker
|
|
189
189
|
old_ip=host_tracker.local_host_2_ip(host)
|
190
190
|
if old_ip != ip
|
191
191
|
host_tracker.refresh(host)
|
192
|
-
host_tracker.save!
|
193
192
|
else
|
194
193
|
puts "Host resolve to the same IP #{ip} - no need to update the local host table." if @verbose
|
195
194
|
end
|
196
195
|
else
|
197
196
|
host_tracker.add(host)
|
198
|
-
host_tracker.save!
|
199
197
|
end
|
200
198
|
end
|
201
199
|
else
|
@@ -214,13 +212,11 @@ class Wmap::SiteTracker
|
|
214
212
|
old_ip=host_tracker.local_host_2_ip(host)
|
215
213
|
if old_ip != ip
|
216
214
|
host_tracker.refresh(host)
|
217
|
-
host_tracker.save!
|
218
215
|
else
|
219
216
|
# Skip - no need to update the local hosts table
|
220
217
|
end
|
221
218
|
else
|
222
219
|
host_tracker.add(host)
|
223
|
-
host_tracker.save!
|
224
220
|
end
|
225
221
|
end
|
226
222
|
deact=nil
|
@@ -229,6 +225,7 @@ class Wmap::SiteTracker
|
|
229
225
|
else
|
230
226
|
puts "Problem found: untrusted Internet domain or IP. Skip #{site}"
|
231
227
|
deact=nil
|
228
|
+
host_tracker.save!
|
232
229
|
host_tracker=nil
|
233
230
|
return nil
|
234
231
|
end
|
@@ -12,9 +12,10 @@ require "open_uri_redirections"
|
|
12
12
|
require "nokogiri"
|
13
13
|
require "css_parser"
|
14
14
|
|
15
|
+
module Wmap
|
16
|
+
class SiteTracker
|
15
17
|
|
16
|
-
|
17
|
-
class Wmap::WpTracker
|
18
|
+
class WpTracker < Wmap::SiteTracker
|
18
19
|
include Wmap::Utils
|
19
20
|
#include Singleton
|
20
21
|
|
@@ -24,7 +25,7 @@ class Wmap::WpTracker
|
|
24
25
|
# WordPress checker instance default variables
|
25
26
|
def initialize (params = {})
|
26
27
|
@verbose=params.fetch(:verbose, false)
|
27
|
-
@data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'
|
28
|
+
@data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')
|
28
29
|
Dir.mkdir(@data_dir) unless Dir.exist?(@data_dir)
|
29
30
|
@sites_wp=params.fetch(:sites_wp, @data_dir+"wp_sites")
|
30
31
|
@http_timeout=params.fetch(:http_timeout, 5000)
|
@@ -116,6 +117,41 @@ class Wmap::WpTracker
|
|
116
117
|
puts "Exception on method #{__method__}: #{ee}: #{url}" if @verbose
|
117
118
|
end
|
118
119
|
|
120
|
+
# Method to load wp sites in parallel
|
121
|
+
def bulk_add(list,num=@max_parallel,use_cache=true)
|
122
|
+
puts "Add entries to the local wp_site store from list:\n #{list}"
|
123
|
+
results=Hash.new
|
124
|
+
list = list - [nil,""]
|
125
|
+
if list.size > 0
|
126
|
+
puts "Start parallel adding on the sites:\n #{list}"
|
127
|
+
Parallel.map(list, :in_processes => num) { |target|
|
128
|
+
add(target,use_cache)
|
129
|
+
}.each do |process|
|
130
|
+
if process.nil?
|
131
|
+
next
|
132
|
+
elsif process.empty?
|
133
|
+
next #do nothing
|
134
|
+
else
|
135
|
+
results[process['site']]=Hash.new
|
136
|
+
results[process['site']]=process
|
137
|
+
end
|
138
|
+
end
|
139
|
+
@known_wp_sites.merge!(results)
|
140
|
+
else
|
141
|
+
puts "Error: no entry is added. Please check your list and try again."
|
142
|
+
end
|
143
|
+
puts "Done adding site entries."
|
144
|
+
if results.size>0
|
145
|
+
puts "New entries added: #{results}"
|
146
|
+
else
|
147
|
+
puts "No new entry added. "
|
148
|
+
end
|
149
|
+
return results
|
150
|
+
rescue => ee
|
151
|
+
puts "Exception on method #{__method__}: #{ee}" if @verbose
|
152
|
+
end
|
153
|
+
alias_method :adds, :bulk_add
|
154
|
+
|
119
155
|
# logic to determin if it's a wordpress site
|
120
156
|
def is_wp?(url)
|
121
157
|
site=url_2_site(url)
|
@@ -375,5 +411,6 @@ class Wmap::WpTracker
|
|
375
411
|
return nil
|
376
412
|
end
|
377
413
|
|
378
|
-
|
414
|
+
end
|
415
|
+
end
|
379
416
|
end
|
data/lib/wmap/url_crawler.rb
CHANGED
@@ -41,7 +41,7 @@ class Wmap::UrlCrawler
|
|
41
41
|
@crawl_start=Hash.new
|
42
42
|
@crawl_done=Hash.new
|
43
43
|
Dir.mkdir(@data_dir) unless Dir.exist?(@data_dir)
|
44
|
-
@log_file=@data_dir + "crawler.log"
|
44
|
+
@log_file=@data_dir + "/../logs/crawler.log"
|
45
45
|
end
|
46
46
|
|
47
47
|
# Pre-crawl profiler, to be used for network profiling to maximum the crawler performance.
|
data/version.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
###############################################################################
|
4
4
|
package = wmap
|
5
5
|
# wmap version 2.0 == web_discovery version 1.5.3
|
6
|
-
version = 2.7.
|
7
|
-
date = 2020-03-
|
6
|
+
version = 2.7.6
|
7
|
+
date = 2020-03-20
|
8
8
|
|
9
9
|
author = Sam (Yang) Li
|
10
10
|
email = yang.li@owasp.org
|
data/wmap.gemspec
CHANGED
@@ -35,10 +35,10 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.date = info["date"]
|
36
36
|
s.description = "wmap is written to perform Internet web application / service discovery. The discovery results are designed to be automatically tracked by the software."
|
37
37
|
s.email = info["email"]
|
38
|
-
s.executables = ["wmap","wscan","wadd","wadds","wdel","wcheck","wdump","spiderBot","googleBot","updateAll","prime","deprime","refresh","trust","distrust","run_tests"]
|
38
|
+
s.executables = ["wmap","wscan","wadd","wadds","wdel","wcheck","wdump","spiderBot","googleBot","updateAll","prime","deprime","refresh","trust","trusts","distrust","run_tests"]
|
39
39
|
s.files = ["CHANGELOG.md", "TODO", "settings/discovery_ports","data/","LICENSE.txt",
|
40
40
|
"version.txt","README.md", "wmap.gemspec"]
|
41
|
-
s.files += Dir['lib/*.rb'] + Dir['lib/wmap/*.rb'] + Dir['lib/wmap/**/*'] + Dir['bin/*'] + Dir['settings/*'] + Dir['demos/*'] + Dir['test/*'] + Dir['
|
41
|
+
s.files += Dir['lib/*.rb'] + Dir['lib/wmap/*.rb'] + Dir['lib/wmap/**/*'] + Dir['bin/*'] + Dir['settings/*'] + Dir['demos/*'] + Dir['test/*'] + Dir['dicts/*']
|
42
42
|
#s.homepage = "none"
|
43
43
|
s.post_install_message = "*"*80 + "\n\nThank you for installing the wmap gem - a pure Ruby library for Internet web \napplication discovery and tracking. Please refer to the README.md for more \ninformation of using this gem. \n\n" + "*"*80 + "\n"
|
44
44
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam (Yang) Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnsruby
|
@@ -224,6 +224,7 @@ executables:
|
|
224
224
|
- deprime
|
225
225
|
- refresh
|
226
226
|
- trust
|
227
|
+
- trusts
|
227
228
|
- distrust
|
228
229
|
- run_tests
|
229
230
|
extensions: []
|
@@ -294,6 +295,7 @@ files:
|
|
294
295
|
- lib/wmap/port_scanner.rb
|
295
296
|
- lib/wmap/site_tracker.rb
|
296
297
|
- lib/wmap/site_tracker/deactivated_site.rb
|
298
|
+
- lib/wmap/site_tracker/wp_tracker.rb
|
297
299
|
- lib/wmap/url_checker.rb
|
298
300
|
- lib/wmap/url_crawler.rb
|
299
301
|
- lib/wmap/url_crawler/adware_tag.rb
|
@@ -302,63 +304,6 @@ files:
|
|
302
304
|
- lib/wmap/utils/url_magic.rb
|
303
305
|
- lib/wmap/utils/utils.rb
|
304
306
|
- lib/wmap/whois.rb
|
305
|
-
- lib/wmap/wp_tracker.rb
|
306
|
-
- ruby_whois_patches/base_cocca2.rb
|
307
|
-
- ruby_whois_patches/kero.yachay.pe.rb
|
308
|
-
- ruby_whois_patches/whois.PublicDomainRegistry.com.rb
|
309
|
-
- ruby_whois_patches/whois.above.com.rb
|
310
|
-
- ruby_whois_patches/whois.adamsnames.tc.rb
|
311
|
-
- ruby_whois_patches/whois.aeda.net.ae.rb
|
312
|
-
- ruby_whois_patches/whois.ai.rb
|
313
|
-
- ruby_whois_patches/whois.arnes.si.rb
|
314
|
-
- ruby_whois_patches/whois.ascio.com.rb
|
315
|
-
- ruby_whois_patches/whois.cnnic.cn.rb
|
316
|
-
- ruby_whois_patches/whois.corporatedomains.com.rb
|
317
|
-
- ruby_whois_patches/whois.crsnic.net.rb
|
318
|
-
- ruby_whois_patches/whois.denic.de.rb
|
319
|
-
- ruby_whois_patches/whois.dk-hostmaster.dk.rb
|
320
|
-
- ruby_whois_patches/whois.dns.be.rb
|
321
|
-
- ruby_whois_patches/whois.dns.lu.rb
|
322
|
-
- ruby_whois_patches/whois.dns.pl.rb
|
323
|
-
- ruby_whois_patches/whois.dns.pt.rb
|
324
|
-
- ruby_whois_patches/whois.domain.kg.rb
|
325
|
-
- ruby_whois_patches/whois.domainregistry.my.rb
|
326
|
-
- ruby_whois_patches/whois.domreg.lt.rb
|
327
|
-
- ruby_whois_patches/whois.dot.tk.rb
|
328
|
-
- ruby_whois_patches/whois.hkirc.hk.rb
|
329
|
-
- ruby_whois_patches/whois.isnic.is.rb
|
330
|
-
- ruby_whois_patches/whois.je.rb
|
331
|
-
- ruby_whois_patches/whois.jprs.jp.rb
|
332
|
-
- ruby_whois_patches/whois.kenic.or.ke.rb
|
333
|
-
- ruby_whois_patches/whois.markmonitor.com.rb
|
334
|
-
- ruby_whois_patches/whois.melbourneit.com.rb
|
335
|
-
- ruby_whois_patches/whois.nic.as.rb
|
336
|
-
- ruby_whois_patches/whois.nic.at.rb
|
337
|
-
- ruby_whois_patches/whois.nic.ch.rb
|
338
|
-
- ruby_whois_patches/whois.nic.cl.rb
|
339
|
-
- ruby_whois_patches/whois.nic.ec.rb
|
340
|
-
- ruby_whois_patches/whois.nic.im.rb
|
341
|
-
- ruby_whois_patches/whois.nic.it.rb
|
342
|
-
- ruby_whois_patches/whois.nic.lv.rb
|
343
|
-
- ruby_whois_patches/whois.nic.ly.rb
|
344
|
-
- ruby_whois_patches/whois.nic.mu.rb
|
345
|
-
- ruby_whois_patches/whois.nic.mx.rb
|
346
|
-
- ruby_whois_patches/whois.nic.net.sa.rb
|
347
|
-
- ruby_whois_patches/whois.nic.or.kr.rb
|
348
|
-
- ruby_whois_patches/whois.nic.tel.rb
|
349
|
-
- ruby_whois_patches/whois.nic.tr.rb
|
350
|
-
- ruby_whois_patches/whois.nic.us.rb
|
351
|
-
- ruby_whois_patches/whois.nic.ve.rb
|
352
|
-
- ruby_whois_patches/whois.norid.no.rb
|
353
|
-
- ruby_whois_patches/whois.pandi.or.id.rb
|
354
|
-
- ruby_whois_patches/whois.psi-usa.info.rb
|
355
|
-
- ruby_whois_patches/whois.registro.br.rb
|
356
|
-
- ruby_whois_patches/whois.registrygate.com.rb
|
357
|
-
- ruby_whois_patches/whois.rrpproxy.net.rb
|
358
|
-
- ruby_whois_patches/whois.sgnic.sg.rb
|
359
|
-
- ruby_whois_patches/whois.srs.net.nz.rb
|
360
|
-
- ruby_whois_patches/whois.tucows.com.rb
|
361
|
-
- ruby_whois_patches/whois.twnic.net.tw.rb
|
362
307
|
- settings/discovery_ports
|
363
308
|
- settings/google_keywords.txt
|
364
309
|
- settings/google_locator.txt
|
@@ -1,149 +0,0 @@
|
|
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
|
-
# Base parser for CoCCA servers.
|
18
|
-
#
|
19
|
-
# @abstract
|
20
|
-
class BaseCocca2 < Base
|
21
|
-
|
22
|
-
property_supported :domain do
|
23
|
-
content_for_scanner =~ /Domain Name: (.+)\n/
|
24
|
-
$1 || Whois.bug!(ParserError, "Unable to parse domain.")
|
25
|
-
end
|
26
|
-
|
27
|
-
property_not_supported :domain_id
|
28
|
-
|
29
|
-
# TODO: /pending delete/ => :redemption
|
30
|
-
# TODO: /pending purge/ => :redemption
|
31
|
-
property_supported :status do
|
32
|
-
list = statuses
|
33
|
-
case
|
34
|
-
when list.empty?
|
35
|
-
Whois.bug!(ParserError, "Unable to parse status.")
|
36
|
-
when list.include?("available")
|
37
|
-
:available
|
38
|
-
when list.include?("ok")
|
39
|
-
:registered
|
40
|
-
else
|
41
|
-
Whois.bug!(ParserError, "Unknown status `#{list.join(", ")}'.")
|
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 =~ /Creation Date: (.+?)\n/
|
56
|
-
parse_time($1)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
property_supported :updated_on do
|
61
|
-
if content_for_scanner =~ /Updated Date: (.+?)\n/
|
62
|
-
parse_time($1)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
property_supported :expires_on do
|
67
|
-
if content_for_scanner =~ /Registry Expiry Date: (.+?)\n/
|
68
|
-
parse_time($1)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
property_supported :registrar do
|
73
|
-
if content_for_scanner =~ /Sponsoring Registrar: (.+?)\n/
|
74
|
-
Record::Registrar.new(
|
75
|
-
:name => $1,
|
76
|
-
:organization => nil,
|
77
|
-
:url => content_for_scanner.slice(/Sponsoring Registrar URL: (.+)\n/, 1)
|
78
|
-
)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
property_supported :nameservers do
|
83
|
-
content_for_scanner.scan(/Name Server: (.+)\n/).flatten.map do |name|
|
84
|
-
Record::Nameserver.new(:name => name)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def statuses
|
89
|
-
content_for_scanner.scan(/Domain Status: (.+)\n/).flatten.map(&:downcase)
|
90
|
-
end
|
91
|
-
|
92
|
-
# The following methods are implemented by Yang Li on 01/24/2013
|
93
|
-
# ----------------------------------------------------------------------------
|
94
|
-
|
95
|
-
property_supported :domain_id do
|
96
|
-
return $1 if content_for_scanner =~ /Domain ID:\s+(.*)\n/i
|
97
|
-
end
|
98
|
-
|
99
|
-
property_supported :registrant_contacts do
|
100
|
-
build_contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
|
101
|
-
end
|
102
|
-
|
103
|
-
property_supported :admin_contacts do
|
104
|
-
build_contact("Admin", Whois::Record::Contact::TYPE_ADMIN)
|
105
|
-
end
|
106
|
-
|
107
|
-
property_supported :technical_contacts do
|
108
|
-
build_contact("Tech", Whois::Record::Contact::TYPE_TECHNICAL)
|
109
|
-
end
|
110
|
-
|
111
|
-
property_supported :billing_contacts do
|
112
|
-
build_contact("Billing", Whois::Record::Contact::TYPE_BILLING)
|
113
|
-
end
|
114
|
-
|
115
|
-
private
|
116
|
-
|
117
|
-
def parse_time(value)
|
118
|
-
# Hack to remove usec. Do you know a better way?
|
119
|
-
Time.utc(*Time.parse(value).to_a)
|
120
|
-
end
|
121
|
-
|
122
|
-
def build_contact(element, type)
|
123
|
-
reg=Record::Contact.new(:type => type)
|
124
|
-
strs=''
|
125
|
-
content_cleanup=content_for_scanner.split(%r{/n}).delete_if { |x| x !~ /(.+):(.+)/ }
|
126
|
-
content_cleanup.join('\n').scan(/^#{element}(.+):(.+)\n/).map do |entry|
|
127
|
-
reg["id"]=entry[1].strip if entry[0] =~ /ID/i
|
128
|
-
reg["name"]=entry[1].strip if entry[0] =~ /Name/i
|
129
|
-
reg["organization"]=entry[1].strip if entry[0]=~ /Organization/i
|
130
|
-
if (entry[0]=~ /Street/i)
|
131
|
-
strs=strs+entry[1].strip+", "
|
132
|
-
end
|
133
|
-
reg["address"]=strs
|
134
|
-
reg["city"]= entry[1].strip if entry[0]=~ /City/i
|
135
|
-
reg["zip"]=entry[1].strip if entry[0]=~ /Postal\sCode/i
|
136
|
-
reg["state"]=entry[1].strip if entry[0]=~ /State\/Province/i
|
137
|
-
reg["country_code"]=entry[1].strip if entry[0]=~ /Country/i
|
138
|
-
reg["email"]=entry[1].strip if entry[0]=~ /Email/i
|
139
|
-
reg["phone"]=entry[1].strip if entry[0] =~ /Phone$/i
|
140
|
-
reg["fax"]=entry[1].strip if (entry[0] =~ /Fax$/i)
|
141
|
-
end
|
142
|
-
return reg
|
143
|
-
end
|
144
|
-
# ----------------------------------------------------------------------------
|
145
|
-
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|