whois-parser 0.0.1 → 1.0.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/CHANGELOG.md +20 -0
- data/CONTRIBUTING.md +40 -0
- data/LICENSE.txt +17 -18
- data/README.md +6 -24
- data/lib/whois/parser/contact.rb +56 -0
- data/lib/whois/parser/errors.rb +46 -0
- data/lib/whois/parser/nameserver.rb +39 -0
- data/lib/whois/parser/registrar.rb +25 -0
- data/lib/whois/parser/super_struct.rb +53 -0
- data/lib/whois/parser/version.rb +3 -2
- data/lib/whois/parser.rb +407 -3
- data/lib/whois/parser_extensions/whois.rb +78 -0
- data/lib/whois/parser_extensions/whois_record.rb +222 -0
- data/lib/whois/parser_extensions.rb +9 -0
- data/lib/whois/parsers/base.rb +412 -0
- data/lib/whois/parsers/base_afilias.rb +139 -0
- data/lib/whois/parsers/base_afilias2.rb +140 -0
- data/lib/whois/parsers/base_cocca.rb +97 -0
- data/lib/whois/parsers/base_cocca2.rb +91 -0
- data/lib/whois/parsers/base_icann_compliant.rb +150 -0
- data/lib/whois/parsers/base_icb.rb +92 -0
- data/lib/whois/parsers/base_iisse.rb +113 -0
- data/lib/whois/parsers/base_nic_fr.rb +169 -0
- data/lib/whois/parsers/base_shared1.rb +108 -0
- data/lib/whois/parsers/base_shared2.rb +127 -0
- data/lib/whois/parsers/base_shared3.rb +127 -0
- data/lib/whois/parsers/base_verisign.rb +106 -0
- data/lib/whois/parsers/base_whoisd.rb +145 -0
- data/lib/whois/parsers/blank.rb +35 -0
- data/lib/whois/parsers/capetown-whois.registry.net.za.rb +25 -0
- data/lib/whois/parsers/ccwhois.ksregistry.net.rb +25 -0
- data/lib/whois/parsers/ccwhois.verisign-grs.com.rb +25 -0
- data/lib/whois/parsers/durban-whois.registry.net.za.rb +25 -0
- data/lib/whois/parsers/example.rb +163 -0
- data/lib/whois/parsers/joburg-whois.registry.net.za.rb +25 -0
- data/lib/whois/parsers/kero.yachay.pe.rb +86 -0
- data/lib/whois/parsers/org-whois.registry.net.za.rb +25 -0
- data/lib/whois/parsers/tvwhois.verisign-grs.com.rb +25 -0
- data/lib/whois/parsers/whois.1und1.info.rb +28 -0
- data/lib/whois/parsers/whois.35.com.rb +23 -0
- data/lib/whois/parsers/whois.aeda.net.ae.rb +64 -0
- data/lib/whois/parsers/whois.aero.rb +58 -0
- data/lib/whois/parsers/whois.afilias-grs.info.rb +21 -0
- data/lib/whois/parsers/whois.afilias.net.rb +41 -0
- data/lib/whois/parsers/whois.ai.rb +62 -0
- data/lib/whois/parsers/whois.amnic.net.rb +79 -0
- data/lib/whois/parsers/whois.ascio.com.rb +29 -0
- data/lib/whois/parsers/whois.ati.tn.rb +116 -0
- data/lib/whois/parsers/whois.audns.net.au.rb +118 -0
- data/lib/whois/parsers/whois.ax.rb +64 -0
- data/lib/whois/parsers/whois.biz.rb +25 -0
- data/lib/whois/parsers/whois.bnnic.bn.rb +75 -0
- data/lib/whois/parsers/whois.cat.rb +75 -0
- data/lib/whois/parsers/whois.cctld.by.rb +94 -0
- data/lib/whois/parsers/whois.cctld.uz.rb +79 -0
- data/lib/whois/parsers/whois.centralnic.com.rb +140 -0
- data/lib/whois/parsers/whois.cira.ca.rb +192 -0
- data/lib/whois/parsers/whois.cmc.iq.rb +25 -0
- data/lib/whois/parsers/whois.cnnic.cn.rb +108 -0
- data/lib/whois/parsers/whois.co.ca.rb +74 -0
- data/lib/whois/parsers/whois.co.pl.rb +82 -0
- data/lib/whois/parsers/whois.co.ug.rb +82 -0
- data/lib/whois/parsers/whois.comlaude.com.rb +113 -0
- data/lib/whois/parsers/whois.corporatedomains.com.rb +28 -0
- data/lib/whois/parsers/whois.denic.de.rb +164 -0
- data/lib/whois/parsers/whois.dk-hostmaster.dk.rb +88 -0
- data/lib/whois/parsers/whois.dns.be.rb +120 -0
- data/lib/whois/parsers/whois.dns.hr.rb +97 -0
- data/lib/whois/parsers/whois.dns.lu.rb +126 -0
- data/lib/whois/parsers/whois.dns.pl.rb +151 -0
- data/lib/whois/parsers/whois.dns.pt.rb +77 -0
- data/lib/whois/parsers/whois.domain-registry.nl.rb +123 -0
- data/lib/whois/parsers/whois.domain.kg.rb +76 -0
- data/lib/whois/parsers/whois.domainregistry.ie.rb +121 -0
- data/lib/whois/parsers/whois.domreg.lt.rb +68 -0
- data/lib/whois/parsers/whois.donuts.co.rb +61 -0
- data/lib/whois/parsers/whois.dot.cf.rb +71 -0
- data/lib/whois/parsers/whois.dot.tk.rb +70 -0
- data/lib/whois/parsers/whois.dotgov.gov.rb +61 -0
- data/lib/whois/parsers/whois.dotmobiregistry.net.rb +21 -0
- data/lib/whois/parsers/whois.dotpostregistry.net.rb +25 -0
- data/lib/whois/parsers/whois.dreamhost.com.rb +23 -0
- data/lib/whois/parsers/whois.educause.edu.rb +200 -0
- data/lib/whois/parsers/whois.eenet.ee.rb +72 -0
- data/lib/whois/parsers/whois.enom.com.rb +34 -0
- data/lib/whois/parsers/whois.eu.org.rb +58 -0
- data/lib/whois/parsers/whois.eu.rb +130 -0
- data/lib/whois/parsers/whois.fi.rb +117 -0
- data/lib/whois/parsers/whois.gandi.net.rb +30 -0
- data/lib/whois/parsers/whois.gg.rb +31 -0
- data/lib/whois/parsers/whois.godaddy.com.rb +112 -0
- data/lib/whois/parsers/whois.gov.za.rb +60 -0
- data/lib/whois/parsers/whois.hkirc.hk.rb +70 -0
- data/lib/whois/parsers/whois.iana.org.rb +102 -0
- data/lib/whois/parsers/whois.iis.nu.rb +26 -0
- data/lib/whois/parsers/whois.iis.se.rb +26 -0
- data/lib/whois/parsers/whois.in.ua.rb +75 -0
- data/lib/whois/parsers/whois.inregistry.net.rb +27 -0
- data/lib/whois/parsers/whois.isnic.is.rb +70 -0
- data/lib/whois/parsers/whois.isoc.org.il.rb +75 -0
- data/lib/whois/parsers/whois.ja.net.rb +75 -0
- data/lib/whois/parsers/whois.je.rb +25 -0
- data/lib/whois/parsers/whois.jprs.jp.rb +103 -0
- data/lib/whois/parsers/whois.kenic.or.ke.rb +91 -0
- data/lib/whois/parsers/whois.kr.rb +79 -0
- data/lib/whois/parsers/whois.markmonitor.com.rb +36 -0
- data/lib/whois/parsers/whois.monic.mo.rb +83 -0
- data/lib/whois/parsers/whois.museum.rb +79 -0
- data/lib/whois/parsers/whois.mynic.my.rb +72 -0
- data/lib/whois/parsers/whois.na-nic.com.na.rb +21 -0
- data/lib/whois/parsers/whois.nc.rb +122 -0
- data/lib/whois/parsers/whois.netcom.cm.rb +26 -0
- data/lib/whois/parsers/whois.networksolutions.com.rb +37 -0
- data/lib/whois/parsers/whois.nic.ac.rb +25 -0
- data/lib/whois/parsers/whois.nic.af.rb +25 -0
- data/lib/whois/parsers/whois.nic.ag.rb +21 -0
- data/lib/whois/parsers/whois.nic.as.rb +63 -0
- data/lib/whois/parsers/whois.nic.asia.rb +107 -0
- data/lib/whois/parsers/whois.nic.at.rb +64 -0
- data/lib/whois/parsers/whois.nic.bj.rb +126 -0
- data/lib/whois/parsers/whois.nic.bo.rb +73 -0
- data/lib/whois/parsers/whois.nic.cd.rb +34 -0
- data/lib/whois/parsers/whois.nic.ch.rb +109 -0
- data/lib/whois/parsers/whois.nic.ci.rb +70 -0
- data/lib/whois/parsers/whois.nic.cl.rb +71 -0
- data/lib/whois/parsers/whois.nic.co.rb +25 -0
- data/lib/whois/parsers/whois.nic.college.rb +25 -0
- data/lib/whois/parsers/whois.nic.coop.rb +70 -0
- data/lib/whois/parsers/whois.nic.cx.rb +25 -0
- data/lib/whois/parsers/whois.nic.cz.rb +42 -0
- data/lib/whois/parsers/whois.nic.design.rb +25 -0
- data/lib/whois/parsers/whois.nic.dm.rb +25 -0
- data/lib/whois/parsers/whois.nic.dz.rb +58 -0
- data/lib/whois/parsers/whois.nic.ec.rb +34 -0
- data/lib/whois/parsers/whois.nic.es.rb +105 -0
- data/lib/whois/parsers/whois.nic.fo.rb +43 -0
- data/lib/whois/parsers/whois.nic.fr.rb +25 -0
- data/lib/whois/parsers/whois.nic.gd.rb +31 -0
- data/lib/whois/parsers/whois.nic.gl.rb +25 -0
- data/lib/whois/parsers/whois.nic.gs.rb +31 -0
- data/lib/whois/parsers/whois.nic.hn.rb +25 -0
- data/lib/whois/parsers/whois.nic.ht.rb +25 -0
- data/lib/whois/parsers/whois.nic.hu.rb +78 -0
- data/lib/whois/parsers/whois.nic.im.rb +66 -0
- data/lib/whois/parsers/whois.nic.io.rb +48 -0
- data/lib/whois/parsers/whois.nic.ir.rb +66 -0
- data/lib/whois/parsers/whois.nic.it.rb +159 -0
- data/lib/whois/parsers/whois.nic.jobs.rb +25 -0
- data/lib/whois/parsers/whois.nic.ki.rb +25 -0
- data/lib/whois/parsers/whois.nic.kz.rb +67 -0
- data/lib/whois/parsers/whois.nic.la.rb +25 -0
- data/lib/whois/parsers/whois.nic.li.rb +64 -0
- data/lib/whois/parsers/whois.nic.lk.rb +109 -0
- data/lib/whois/parsers/whois.nic.lv.rb +65 -0
- data/lib/whois/parsers/whois.nic.ly.rb +76 -0
- data/lib/whois/parsers/whois.nic.md.rb +94 -0
- data/lib/whois/parsers/whois.nic.me.rb +85 -0
- data/lib/whois/parsers/whois.nic.mg.rb +31 -0
- data/lib/whois/parsers/whois.nic.ms.rb +25 -0
- data/lib/whois/parsers/whois.nic.mu.rb +25 -0
- data/lib/whois/parsers/whois.nic.mx.rb +79 -0
- data/lib/whois/parsers/whois.nic.name.rb +68 -0
- data/lib/whois/parsers/whois.nic.net.ng.rb +27 -0
- data/lib/whois/parsers/whois.nic.net.sa.rb +70 -0
- data/lib/whois/parsers/whois.nic.net.sb.rb +31 -0
- data/lib/whois/parsers/whois.nic.nf.rb +25 -0
- data/lib/whois/parsers/whois.nic.org.uy.rb +75 -0
- data/lib/whois/parsers/whois.nic.pm.rb +25 -0
- data/lib/whois/parsers/whois.nic.pr.rb +84 -0
- data/lib/whois/parsers/whois.nic.priv.at.rb +62 -0
- data/lib/whois/parsers/whois.nic.pw.rb +25 -0
- data/lib/whois/parsers/whois.nic.re.rb +25 -0
- data/lib/whois/parsers/whois.nic.sh.rb +25 -0
- data/lib/whois/parsers/whois.nic.sl.rb +76 -0
- data/lib/whois/parsers/whois.nic.sm.rb +76 -0
- data/lib/whois/parsers/whois.nic.sn.rb +113 -0
- data/lib/whois/parsers/whois.nic.so.rb +70 -0
- data/lib/whois/parsers/whois.nic.space.rb +25 -0
- data/lib/whois/parsers/whois.nic.st.rb +72 -0
- data/lib/whois/parsers/whois.nic.tc.rb +25 -0
- data/lib/whois/parsers/whois.nic.tech.rb +25 -0
- data/lib/whois/parsers/whois.nic.tel.rb +25 -0
- data/lib/whois/parsers/whois.nic.tl.rb +25 -0
- data/lib/whois/parsers/whois.nic.tm.rb +31 -0
- data/lib/whois/parsers/whois.nic.tr.rb +159 -0
- data/lib/whois/parsers/whois.nic.travel.rb +25 -0
- data/lib/whois/parsers/whois.nic.uk.rb +177 -0
- data/lib/whois/parsers/whois.nic.us.rb +25 -0
- data/lib/whois/parsers/whois.nic.ve.rb +87 -0
- data/lib/whois/parsers/whois.nic.wf.rb +25 -0
- data/lib/whois/parsers/whois.nic.xxx.rb +42 -0
- data/lib/whois/parsers/whois.nic.xyz.rb +25 -0
- data/lib/whois/parsers/whois.norid.no.rb +61 -0
- data/lib/whois/parsers/whois.pairnic.com.rb +28 -0
- data/lib/whois/parsers/whois.pandi.or.id.rb +25 -0
- data/lib/whois/parsers/whois.pir.org.rb +90 -0
- data/lib/whois/parsers/whois.pnina.ps.rb +31 -0
- data/lib/whois/parsers/whois.register.bg.rb +83 -0
- data/lib/whois/parsers/whois.register.com.rb +30 -0
- data/lib/whois/parsers/whois.register.si.rb +73 -0
- data/lib/whois/parsers/whois.registre.ma.rb +63 -0
- data/lib/whois/parsers/whois.registro.br.rb +73 -0
- data/lib/whois/parsers/whois.registry.gy.rb +25 -0
- data/lib/whois/parsers/whois.registry.hm.rb +72 -0
- data/lib/whois/parsers/whois.registry.net.za.rb +139 -0
- data/lib/whois/parsers/whois.registry.om.rb +40 -0
- data/lib/whois/parsers/whois.registry.qa.rb +25 -0
- data/lib/whois/parsers/whois.ripe.net.rb +68 -0
- data/lib/whois/parsers/whois.rnids.rs.rb +134 -0
- data/lib/whois/parsers/whois.rotld.ro.rb +65 -0
- data/lib/whois/parsers/whois.rrpproxy.net.rb +32 -0
- data/lib/whois/parsers/whois.safenames.net.rb +48 -0
- data/lib/whois/parsers/whois.schlund.info.rb +34 -0
- data/lib/whois/parsers/whois.sgnic.sg.rb +87 -0
- data/lib/whois/parsers/whois.sk-nic.sk.rb +101 -0
- data/lib/whois/parsers/whois.smallregistry.net.rb +131 -0
- data/lib/whois/parsers/whois.srs.net.nz.rb +159 -0
- data/lib/whois/parsers/whois.sx.rb +127 -0
- data/lib/whois/parsers/whois.tcinet.ru.rb +114 -0
- data/lib/whois/parsers/whois.thnic.co.th.rb +79 -0
- data/lib/whois/parsers/whois.tld.ee.rb +134 -0
- data/lib/whois/parsers/whois.tld.sy.rb +34 -0
- data/lib/whois/parsers/whois.tonic.to.rb +86 -0
- data/lib/whois/parsers/whois.tucows.com.rb +28 -0
- data/lib/whois/parsers/whois.twnic.net.tw.rb +72 -0
- data/lib/whois/parsers/whois.tznic.or.tz.rb +25 -0
- data/lib/whois/parsers/whois.ua.rb +240 -0
- data/lib/whois/parsers/whois.udag.net.rb +28 -0
- data/lib/whois/parsers/whois.uniregistry.net.rb +61 -0
- data/lib/whois/parsers/whois.usp.ac.fj.rb +72 -0
- data/lib/whois/parsers/whois.verisign-grs.com.rb +49 -0
- data/lib/whois/parsers/whois.website.ws.rb +74 -0
- data/lib/whois/parsers/whois.wildwestdomains.com.rb +37 -0
- data/lib/whois/parsers/whois.yoursrs.com.rb +125 -0
- data/lib/whois/parsers/whois.za.net.rb +72 -0
- data/lib/whois/parsers/whois.za.org.rb +72 -0
- data/lib/whois/parsers/whois1.nic.bi.rb +25 -0
- data/lib/whois/parsers/za_central_registry.rb +68 -0
- data/lib/whois/parsers.rb +4 -0
- data/lib/whois/safe_record.rb +169 -0
- data/lib/whois/scanners/base.rb +116 -0
- data/lib/whois/scanners/base_afilias.rb +51 -0
- data/lib/whois/scanners/base_cocca2.rb +43 -0
- data/lib/whois/scanners/base_icann_compliant.rb +45 -0
- data/lib/whois/scanners/base_iisse.rb +36 -0
- data/lib/whois/scanners/base_shared1.rb +31 -0
- data/lib/whois/scanners/base_shared2.rb +35 -0
- data/lib/whois/scanners/base_shared3.rb +37 -0
- data/lib/whois/scanners/base_whoisd.rb +44 -0
- data/lib/whois/scanners/iana.rb +89 -0
- data/lib/whois/scanners/scannable.rb +65 -0
- data/lib/whois/scanners/verisign.rb +100 -0
- data/lib/whois/scanners/whois.ati.tn.rb +32 -0
- data/lib/whois/scanners/whois.audns.net.au.rb +25 -0
- data/lib/whois/scanners/whois.cctld.by.rb +35 -0
- data/lib/whois/scanners/whois.centralnic.com.rb +32 -0
- data/lib/whois/scanners/whois.cira.ca.rb +72 -0
- data/lib/whois/scanners/whois.cnnic.cn.rb +42 -0
- data/lib/whois/scanners/whois.denic.de.rb +96 -0
- data/lib/whois/scanners/whois.dns.hr.rb +25 -0
- data/lib/whois/scanners/whois.domainregistry.ie.rb +46 -0
- data/lib/whois/scanners/whois.fi.rb +39 -0
- data/lib/whois/scanners/whois.nc.rb +32 -0
- data/lib/whois/scanners/whois.nic.cz.rb +22 -0
- data/lib/whois/scanners/whois.nic.it.rb +92 -0
- data/lib/whois/scanners/whois.pir.org.rb +17 -0
- data/lib/whois/scanners/whois.registry.net.za.rb +92 -0
- data/lib/whois/scanners/whois.rnids.rs.rb +52 -0
- data/lib/whois/scanners/whois.smallregistry.net.rb +50 -0
- data/lib/whois/scanners/whois.srs.net.nz.rb +23 -0
- data/lib/whois/scanners/whois.sx.rb +37 -0
- data/lib/whois/scanners/whois.tld.ee.rb +47 -0
- data/lib/whois/scanners/whois.tucows.com.rb +23 -0
- data/lib/whois/scanners/whois.yoursrs.com.rb +24 -0
- data/lib/whois-parser.rb +10 -0
- data/whois-parser.gemspec +37 -19
- metadata +318 -20
- data/.gitignore +0 -14
- data/Gemfile +0 -4
- data/Rakefile +0 -2
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'strscan'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# The Scannable module tries to emulate a super-simple Abstract Syntax Tree structure
|
7
|
+
# including method for accessing ast nodes.
|
8
|
+
#
|
9
|
+
# == Usage
|
10
|
+
#
|
11
|
+
# Include the Scannable module and set the `self.scanner` value.
|
12
|
+
#
|
13
|
+
# class ParserFoo
|
14
|
+
# include Scannable
|
15
|
+
#
|
16
|
+
# self.scanner = ScannerFoo
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# Now you can access the AST using the <tt>node</tt> method.
|
20
|
+
#
|
21
|
+
# node "created_on"
|
22
|
+
# # => "2009-12-12"
|
23
|
+
#
|
24
|
+
# node? "created_on"
|
25
|
+
# # => true
|
26
|
+
#
|
27
|
+
# node? "created_at"
|
28
|
+
# # => false
|
29
|
+
#
|
30
|
+
module Scannable
|
31
|
+
|
32
|
+
def self.included(base)
|
33
|
+
base.class_attribute :scanner
|
34
|
+
end
|
35
|
+
|
36
|
+
def node(key)
|
37
|
+
if block_given?
|
38
|
+
value = ast[key]
|
39
|
+
value = yield(value) unless value.nil?
|
40
|
+
value
|
41
|
+
else
|
42
|
+
ast[key]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def node?(key)
|
47
|
+
!ast[key].nil?
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse
|
51
|
+
scanner = self.scanner.is_a?(Array) ? self.scanner.first : self.scanner
|
52
|
+
settings = self.scanner.is_a?(Array) ? self.scanner.last : {}
|
53
|
+
scanner.new(settings).parse(content_for_scanner)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def ast
|
59
|
+
@ast ||= parse
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
class Verisign < Base
|
7
|
+
|
8
|
+
self.tokenizers += [
|
9
|
+
:skip_empty_line,
|
10
|
+
:scan_response_unavailable,
|
11
|
+
:scan_available,
|
12
|
+
:scan_disclaimer,
|
13
|
+
:scan_notice,
|
14
|
+
:scan_keyvalue_indented,
|
15
|
+
:skip_ianaservice,
|
16
|
+
:skip_lastupdate,
|
17
|
+
:skip_fuffa,
|
18
|
+
]
|
19
|
+
|
20
|
+
|
21
|
+
tokenizer :scan_response_unavailable do
|
22
|
+
# Check if the string starts with /*
|
23
|
+
# If it does, match until the end of all /* lines
|
24
|
+
# or the end of the file and check for the content.
|
25
|
+
#
|
26
|
+
# Flag the block as visited to force the scanner to ignore this tokenizer
|
27
|
+
# if already used and the content didn't match the unavailable message.
|
28
|
+
if @input.match?(/^\*\n/) && !visited?
|
29
|
+
p = /^[^\*]|\z/
|
30
|
+
y = @input.check_until(p) =~ /^\* Sorry, the Whois database is currently down/
|
31
|
+
|
32
|
+
if y
|
33
|
+
@input.skip_until(p)
|
34
|
+
@ast["response:unavailable"] = true
|
35
|
+
else
|
36
|
+
visited!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
tokenizer :scan_available do
|
42
|
+
if @input.scan(/No match for "(.+?)"\.\n/)
|
43
|
+
@ast["Domain Name"] = @input[1].strip
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
tokenizer :scan_disclaimer do
|
48
|
+
if @input.match?(/^TERMS OF USE:/)
|
49
|
+
@ast["Disclaimer"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
tokenizer :scan_notice do
|
54
|
+
if @input.match?(/^NOTICE:/)
|
55
|
+
@ast["Notice"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
tokenizer :scan_keyvalue_indented do
|
60
|
+
if @input.scan(/\s+(.+?):(.*?)\n/)
|
61
|
+
key, value = @input[1].strip, @input[2].strip
|
62
|
+
if @ast[key].nil?
|
63
|
+
@ast[key] = value
|
64
|
+
else
|
65
|
+
@ast[key] = [@ast[key]] unless @ast[key].is_a?(Array)
|
66
|
+
@ast[key] << value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
tokenizer :skip_lastupdate do
|
72
|
+
@input.skip(/>>>(.+?)<<<\n/)
|
73
|
+
end
|
74
|
+
|
75
|
+
tokenizer :skip_fuffa do
|
76
|
+
@input.scan(/^\S(.+)(?:\n|\z)/)
|
77
|
+
end
|
78
|
+
|
79
|
+
tokenizer :skip_ianaservice do
|
80
|
+
if @input.match?(/IANA Whois Service/)
|
81
|
+
@ast["IANA"] = true
|
82
|
+
@input.terminate
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def visited?
|
89
|
+
!!@tmp["visited:#{@input.pos}"]
|
90
|
+
end
|
91
|
+
|
92
|
+
def visited!
|
93
|
+
@tmp["visited:#{@input.pos}"] = true
|
94
|
+
nil
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.ati.tn record.
|
7
|
+
class WhoisAtiTn < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_available,
|
12
|
+
:scan_disclaimer,
|
13
|
+
:scan_keyvalue,
|
14
|
+
]
|
15
|
+
|
16
|
+
|
17
|
+
tokenizer :scan_available do
|
18
|
+
if @input.skip(/^Domain (.+) not found/)
|
19
|
+
@ast["status:available"] = true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
tokenizer :scan_disclaimer do
|
24
|
+
if @input.match?(/^All rights reserved/)
|
25
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/(.+)\n/).join("\n")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.audns.net.au record.
|
7
|
+
class WhoisAudnsNetAu < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_available,
|
12
|
+
:scan_keyvalue,
|
13
|
+
]
|
14
|
+
|
15
|
+
|
16
|
+
tokenizer :scan_available do
|
17
|
+
if @input.skip(/^No Data Found\n/)
|
18
|
+
@ast["status:available"] = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.cctld.by server.
|
7
|
+
#
|
8
|
+
# @author Aliaksei Kliuchnikau <aliaksei.kliuchnikau@gmail.com>
|
9
|
+
class WhoisCctldBy < Base
|
10
|
+
|
11
|
+
self.tokenizers += [
|
12
|
+
:skip_empty_line,
|
13
|
+
:skip_dash_line,
|
14
|
+
:scan_available,
|
15
|
+
:scan_keyvalue,
|
16
|
+
:skip_provider_signature,
|
17
|
+
]
|
18
|
+
|
19
|
+
tokenizer :scan_available do
|
20
|
+
if @input.skip(/^Object does not exist/)
|
21
|
+
@ast["status:available"] = true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
tokenizer :skip_dash_line do
|
26
|
+
@input.skip(/^-+\n/)
|
27
|
+
end
|
28
|
+
|
29
|
+
tokenizer :skip_provider_signature do
|
30
|
+
@input.scan(/^(.+)\n/)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.centralnic.com record.
|
7
|
+
class WhoisCentralnicCom < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_available,
|
12
|
+
:scan_disclaimer,
|
13
|
+
:scan_keyvalue,
|
14
|
+
]
|
15
|
+
|
16
|
+
|
17
|
+
tokenizer :scan_available do
|
18
|
+
if @input.skip(/^DOMAIN NOT FOUND\n/)
|
19
|
+
@ast["status:available"] = true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
tokenizer :scan_disclaimer do
|
24
|
+
if @input.match?(/^\S([^:]+)\n/)
|
25
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.cira.ca record.
|
7
|
+
class WhoisCiraCa < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_disclaimer,
|
12
|
+
:skip_comment,
|
13
|
+
:scan_header,
|
14
|
+
:scan_keyvalue,
|
15
|
+
:scan_nameserver,
|
16
|
+
]
|
17
|
+
|
18
|
+
|
19
|
+
tokenizer :scan_disclaimer do
|
20
|
+
if @input.match?(/^% Use of CIRA/)
|
21
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/^%(.*)\n/).join("\n")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
tokenizer :scan_header do
|
26
|
+
if @input.scan(/^(.+?):\n/)
|
27
|
+
@tmp["group"] = @input[1]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
tokenizer :scan_keyvalue do
|
32
|
+
if @input.scan(/^(.+?):(.*?)\n/)
|
33
|
+
start = @input[1]
|
34
|
+
key, value = start.strip, @input[2].strip
|
35
|
+
|
36
|
+
# This is a nested key
|
37
|
+
target = if start.index(" ") == 0
|
38
|
+
error!("Expected group.") if @tmp["group"].nil?
|
39
|
+
@ast[@tmp["group"]] ||= {}
|
40
|
+
@ast[@tmp["group"]]
|
41
|
+
else
|
42
|
+
@tmp.delete("group")
|
43
|
+
@ast
|
44
|
+
end
|
45
|
+
|
46
|
+
more = _scan_lines_to_array(/^\s{#{start.size}}(.+)\n/)
|
47
|
+
value = more.unshift(value).join("\n") unless more.empty?
|
48
|
+
|
49
|
+
if target[key].nil?
|
50
|
+
target[key] = value
|
51
|
+
else
|
52
|
+
target[key] = Array.wrap(target[key])
|
53
|
+
target[key] << value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
tokenizer :scan_nameserver do
|
59
|
+
if @input.scan(/^\s+(.+?)\n/) && @tmp["group"] == "Name servers"
|
60
|
+
@ast["field:nameservers"] ||= []
|
61
|
+
@ast["field:nameservers"] << @input[1].strip
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
tokenizer :skip_comment do
|
66
|
+
@input.skip(/^%.*\n/)
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.cnnic.cn record.
|
7
|
+
class WhoisCnnicCn < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_reserved,
|
12
|
+
:scan_reserved_list,
|
13
|
+
:scan_available,
|
14
|
+
:scan_keyvalue,
|
15
|
+
]
|
16
|
+
|
17
|
+
|
18
|
+
tokenizer :scan_available do
|
19
|
+
if @input.match?(/^no matching record/)
|
20
|
+
@ast["status:available"] = true
|
21
|
+
@input.scan_until(/\n/)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
tokenizer :scan_reserved do
|
26
|
+
if @input.match?(/^The domain you requested is prohibited/)
|
27
|
+
@ast["status:reserved"] = true
|
28
|
+
@input.scan_until(/\n/)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
tokenizer :scan_reserved_list do
|
33
|
+
if @input.scan(/^Sorry, The domain you requested is in the reserved list/)
|
34
|
+
@ast["status:reserved"] = true
|
35
|
+
@input.scan_until(/\n/)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
class WhoisDenicDe < Base
|
7
|
+
|
8
|
+
self.tokenizers += [
|
9
|
+
:skip_empty_line,
|
10
|
+
:scan_response_throttled,
|
11
|
+
:scan_response_error,
|
12
|
+
:scan_disclaimer,
|
13
|
+
:scan_pair,
|
14
|
+
:scan_contact,
|
15
|
+
:skip_db_time,
|
16
|
+
]
|
17
|
+
|
18
|
+
|
19
|
+
tokenizer :scan_response_throttled do
|
20
|
+
if @input.match?(/^% Error: 55000000002/)
|
21
|
+
@ast["response:throttled"] = true
|
22
|
+
@input.skip(/^.+\n/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
tokenizer :scan_response_error do
|
27
|
+
if @input.match?(/^% Error: 55000000010/)
|
28
|
+
@ast["response:error"] = true
|
29
|
+
@input.skip(/^.+\n/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
tokenizer :scan_disclaimer do
|
34
|
+
if @input.match?(/% Copyright \(c\) *\d{4} by DENIC\n/)
|
35
|
+
@input.scan_until(/% Terms and Conditions of Use\n/)
|
36
|
+
lines = []
|
37
|
+
while @input.match?(/%/) && @input.scan(/%(.*)\n/)
|
38
|
+
lines << @input[1].strip unless @input[1].strip == ""
|
39
|
+
end
|
40
|
+
@ast["Disclaimer"] = lines.join(" ")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
tokenizer :scan_pair do
|
45
|
+
parse_pair(@ast)
|
46
|
+
end
|
47
|
+
|
48
|
+
tokenizer :scan_contact do
|
49
|
+
if @input.scan(/\[(.*)\]\n/)
|
50
|
+
contact_name = @input[1]
|
51
|
+
contact = {}
|
52
|
+
while parse_pair(contact)
|
53
|
+
end
|
54
|
+
@ast[contact_name] = {
|
55
|
+
"id" => nil,
|
56
|
+
"name" => contact['Name'],
|
57
|
+
"organization" => contact['Organisation'],
|
58
|
+
"address" => contact['Address'],
|
59
|
+
"city" => contact['City'],
|
60
|
+
"zip" => contact['PostalCode'],
|
61
|
+
"state" => nil,
|
62
|
+
"country" => contact['Country'],
|
63
|
+
"country_code" => contact['CountryCode'],
|
64
|
+
"phone" => contact['Phone'],
|
65
|
+
"fax" => contact['Fax'],
|
66
|
+
"email" => contact['Email'],
|
67
|
+
"created_on" => nil,
|
68
|
+
"updated_on" => contact['Changed']
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
tokenizer :skip_db_time do
|
74
|
+
@input.skip(/^% DB time is (.+)\n/)
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def parse_pair(store)
|
81
|
+
if @input.scan(/([^ \[]*):(.*)\n/)
|
82
|
+
key, value = @input[1].strip, @input[2].strip
|
83
|
+
if store[key].nil?
|
84
|
+
store[key] = value
|
85
|
+
else
|
86
|
+
store[key].is_a?(Array) || store[key] = [store[key]]
|
87
|
+
store[key] << value
|
88
|
+
end
|
89
|
+
store
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.dns.hr record.
|
7
|
+
class WhoisDnsHr < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_available,
|
12
|
+
:scan_keyvalue,
|
13
|
+
]
|
14
|
+
|
15
|
+
|
16
|
+
tokenizer :scan_available do
|
17
|
+
if @input.skip(/^%ERROR: no entries found\n/)
|
18
|
+
@ast["status:available"] = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.domainregistry.ie server.
|
7
|
+
class WhoisDomainregistryIe < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_disclaimer,
|
12
|
+
:scan_contact,
|
13
|
+
:scan_keyvalue,
|
14
|
+
:scan_available,
|
15
|
+
:skip_application_pending,
|
16
|
+
]
|
17
|
+
|
18
|
+
tokenizer :scan_available do
|
19
|
+
if @input.skip(/^% Not Registered - .+\n/)
|
20
|
+
@ast["status:available"] = true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
tokenizer :scan_disclaimer do
|
25
|
+
if @input.match?(/^% Rights restricted by copyright/)
|
26
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/^%(.+)\n/).join("\n")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
tokenizer :scan_contact do
|
31
|
+
if @input.match?(/^person:/)
|
32
|
+
lines = _scan_lines_to_hash(/(.+?):(.*?)\n/)
|
33
|
+
@ast["field:#{lines['nic-hdl']}"] = lines
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
tokenizer :skip_application_pending do
|
38
|
+
if @input.match?(/^% Application Pending/)
|
39
|
+
_scan_lines_to_array(/^%(.+)\n/)
|
40
|
+
@ast["status:pending"] = true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.fi record.
|
7
|
+
class WhoisFi < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:scan_available,
|
12
|
+
:scan_disclaimer,
|
13
|
+
:scan_keyvalue,
|
14
|
+
:scan_reserved
|
15
|
+
]
|
16
|
+
|
17
|
+
|
18
|
+
tokenizer :scan_available do
|
19
|
+
if @input.skip(/^Domain not found/)
|
20
|
+
@ast["status:available"] = true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
tokenizer :scan_reserved do
|
25
|
+
if @input.skip(/^Domain not available/)
|
26
|
+
@ast["status:reserved"] = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
tokenizer :scan_disclaimer do
|
31
|
+
if @input.match?(/^More information/)
|
32
|
+
@ast["field:disclaimer"] = @input.scan_until(/(.*)\n\n/).strip
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
# Scanner for the whois.nc record.
|
7
|
+
class WhoisNc < Base
|
8
|
+
|
9
|
+
self.tokenizers += [
|
10
|
+
:skip_empty_line,
|
11
|
+
:skip_more,
|
12
|
+
:scan_available,
|
13
|
+
:scan_keyvalue,
|
14
|
+
]
|
15
|
+
|
16
|
+
|
17
|
+
MORES = ['Whois \.NC', 'more details on']
|
18
|
+
|
19
|
+
tokenizer :scan_available do
|
20
|
+
if @input.skip(/^No entries found .+\n/)
|
21
|
+
@ast["status:available"] = true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
tokenizer :skip_more do
|
26
|
+
MORES.any? { |more| @input.skip(/^#{more}.*\n/) }
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'base_whoisd'
|
2
|
+
|
3
|
+
module Whois
|
4
|
+
module Scanners
|
5
|
+
|
6
|
+
class WhoisNicCz < BaseWhoisd
|
7
|
+
|
8
|
+
self.tokenizers += [
|
9
|
+
:scan_response_throttled,
|
10
|
+
]
|
11
|
+
|
12
|
+
tokenizer :scan_response_throttled do
|
13
|
+
if @input.match?(/Your connection limit exceeded\. Please slow down and try again later/)
|
14
|
+
@ast["response:throttled"] = true
|
15
|
+
@input.skip(/^.+\n/)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|