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.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/CHANGELOG.md +20 -0
  4. data/CONTRIBUTING.md +40 -0
  5. data/LICENSE.txt +17 -18
  6. data/README.md +6 -24
  7. data/lib/whois/parser/contact.rb +56 -0
  8. data/lib/whois/parser/errors.rb +46 -0
  9. data/lib/whois/parser/nameserver.rb +39 -0
  10. data/lib/whois/parser/registrar.rb +25 -0
  11. data/lib/whois/parser/super_struct.rb +53 -0
  12. data/lib/whois/parser/version.rb +3 -2
  13. data/lib/whois/parser.rb +407 -3
  14. data/lib/whois/parser_extensions/whois.rb +78 -0
  15. data/lib/whois/parser_extensions/whois_record.rb +222 -0
  16. data/lib/whois/parser_extensions.rb +9 -0
  17. data/lib/whois/parsers/base.rb +412 -0
  18. data/lib/whois/parsers/base_afilias.rb +139 -0
  19. data/lib/whois/parsers/base_afilias2.rb +140 -0
  20. data/lib/whois/parsers/base_cocca.rb +97 -0
  21. data/lib/whois/parsers/base_cocca2.rb +91 -0
  22. data/lib/whois/parsers/base_icann_compliant.rb +150 -0
  23. data/lib/whois/parsers/base_icb.rb +92 -0
  24. data/lib/whois/parsers/base_iisse.rb +113 -0
  25. data/lib/whois/parsers/base_nic_fr.rb +169 -0
  26. data/lib/whois/parsers/base_shared1.rb +108 -0
  27. data/lib/whois/parsers/base_shared2.rb +127 -0
  28. data/lib/whois/parsers/base_shared3.rb +127 -0
  29. data/lib/whois/parsers/base_verisign.rb +106 -0
  30. data/lib/whois/parsers/base_whoisd.rb +145 -0
  31. data/lib/whois/parsers/blank.rb +35 -0
  32. data/lib/whois/parsers/capetown-whois.registry.net.za.rb +25 -0
  33. data/lib/whois/parsers/ccwhois.ksregistry.net.rb +25 -0
  34. data/lib/whois/parsers/ccwhois.verisign-grs.com.rb +25 -0
  35. data/lib/whois/parsers/durban-whois.registry.net.za.rb +25 -0
  36. data/lib/whois/parsers/example.rb +163 -0
  37. data/lib/whois/parsers/joburg-whois.registry.net.za.rb +25 -0
  38. data/lib/whois/parsers/kero.yachay.pe.rb +86 -0
  39. data/lib/whois/parsers/org-whois.registry.net.za.rb +25 -0
  40. data/lib/whois/parsers/tvwhois.verisign-grs.com.rb +25 -0
  41. data/lib/whois/parsers/whois.1und1.info.rb +28 -0
  42. data/lib/whois/parsers/whois.35.com.rb +23 -0
  43. data/lib/whois/parsers/whois.aeda.net.ae.rb +64 -0
  44. data/lib/whois/parsers/whois.aero.rb +58 -0
  45. data/lib/whois/parsers/whois.afilias-grs.info.rb +21 -0
  46. data/lib/whois/parsers/whois.afilias.net.rb +41 -0
  47. data/lib/whois/parsers/whois.ai.rb +62 -0
  48. data/lib/whois/parsers/whois.amnic.net.rb +79 -0
  49. data/lib/whois/parsers/whois.ascio.com.rb +29 -0
  50. data/lib/whois/parsers/whois.ati.tn.rb +116 -0
  51. data/lib/whois/parsers/whois.audns.net.au.rb +118 -0
  52. data/lib/whois/parsers/whois.ax.rb +64 -0
  53. data/lib/whois/parsers/whois.biz.rb +25 -0
  54. data/lib/whois/parsers/whois.bnnic.bn.rb +75 -0
  55. data/lib/whois/parsers/whois.cat.rb +75 -0
  56. data/lib/whois/parsers/whois.cctld.by.rb +94 -0
  57. data/lib/whois/parsers/whois.cctld.uz.rb +79 -0
  58. data/lib/whois/parsers/whois.centralnic.com.rb +140 -0
  59. data/lib/whois/parsers/whois.cira.ca.rb +192 -0
  60. data/lib/whois/parsers/whois.cmc.iq.rb +25 -0
  61. data/lib/whois/parsers/whois.cnnic.cn.rb +108 -0
  62. data/lib/whois/parsers/whois.co.ca.rb +74 -0
  63. data/lib/whois/parsers/whois.co.pl.rb +82 -0
  64. data/lib/whois/parsers/whois.co.ug.rb +82 -0
  65. data/lib/whois/parsers/whois.comlaude.com.rb +113 -0
  66. data/lib/whois/parsers/whois.corporatedomains.com.rb +28 -0
  67. data/lib/whois/parsers/whois.denic.de.rb +164 -0
  68. data/lib/whois/parsers/whois.dk-hostmaster.dk.rb +88 -0
  69. data/lib/whois/parsers/whois.dns.be.rb +120 -0
  70. data/lib/whois/parsers/whois.dns.hr.rb +97 -0
  71. data/lib/whois/parsers/whois.dns.lu.rb +126 -0
  72. data/lib/whois/parsers/whois.dns.pl.rb +151 -0
  73. data/lib/whois/parsers/whois.dns.pt.rb +77 -0
  74. data/lib/whois/parsers/whois.domain-registry.nl.rb +123 -0
  75. data/lib/whois/parsers/whois.domain.kg.rb +76 -0
  76. data/lib/whois/parsers/whois.domainregistry.ie.rb +121 -0
  77. data/lib/whois/parsers/whois.domreg.lt.rb +68 -0
  78. data/lib/whois/parsers/whois.donuts.co.rb +61 -0
  79. data/lib/whois/parsers/whois.dot.cf.rb +71 -0
  80. data/lib/whois/parsers/whois.dot.tk.rb +70 -0
  81. data/lib/whois/parsers/whois.dotgov.gov.rb +61 -0
  82. data/lib/whois/parsers/whois.dotmobiregistry.net.rb +21 -0
  83. data/lib/whois/parsers/whois.dotpostregistry.net.rb +25 -0
  84. data/lib/whois/parsers/whois.dreamhost.com.rb +23 -0
  85. data/lib/whois/parsers/whois.educause.edu.rb +200 -0
  86. data/lib/whois/parsers/whois.eenet.ee.rb +72 -0
  87. data/lib/whois/parsers/whois.enom.com.rb +34 -0
  88. data/lib/whois/parsers/whois.eu.org.rb +58 -0
  89. data/lib/whois/parsers/whois.eu.rb +130 -0
  90. data/lib/whois/parsers/whois.fi.rb +117 -0
  91. data/lib/whois/parsers/whois.gandi.net.rb +30 -0
  92. data/lib/whois/parsers/whois.gg.rb +31 -0
  93. data/lib/whois/parsers/whois.godaddy.com.rb +112 -0
  94. data/lib/whois/parsers/whois.gov.za.rb +60 -0
  95. data/lib/whois/parsers/whois.hkirc.hk.rb +70 -0
  96. data/lib/whois/parsers/whois.iana.org.rb +102 -0
  97. data/lib/whois/parsers/whois.iis.nu.rb +26 -0
  98. data/lib/whois/parsers/whois.iis.se.rb +26 -0
  99. data/lib/whois/parsers/whois.in.ua.rb +75 -0
  100. data/lib/whois/parsers/whois.inregistry.net.rb +27 -0
  101. data/lib/whois/parsers/whois.isnic.is.rb +70 -0
  102. data/lib/whois/parsers/whois.isoc.org.il.rb +75 -0
  103. data/lib/whois/parsers/whois.ja.net.rb +75 -0
  104. data/lib/whois/parsers/whois.je.rb +25 -0
  105. data/lib/whois/parsers/whois.jprs.jp.rb +103 -0
  106. data/lib/whois/parsers/whois.kenic.or.ke.rb +91 -0
  107. data/lib/whois/parsers/whois.kr.rb +79 -0
  108. data/lib/whois/parsers/whois.markmonitor.com.rb +36 -0
  109. data/lib/whois/parsers/whois.monic.mo.rb +83 -0
  110. data/lib/whois/parsers/whois.museum.rb +79 -0
  111. data/lib/whois/parsers/whois.mynic.my.rb +72 -0
  112. data/lib/whois/parsers/whois.na-nic.com.na.rb +21 -0
  113. data/lib/whois/parsers/whois.nc.rb +122 -0
  114. data/lib/whois/parsers/whois.netcom.cm.rb +26 -0
  115. data/lib/whois/parsers/whois.networksolutions.com.rb +37 -0
  116. data/lib/whois/parsers/whois.nic.ac.rb +25 -0
  117. data/lib/whois/parsers/whois.nic.af.rb +25 -0
  118. data/lib/whois/parsers/whois.nic.ag.rb +21 -0
  119. data/lib/whois/parsers/whois.nic.as.rb +63 -0
  120. data/lib/whois/parsers/whois.nic.asia.rb +107 -0
  121. data/lib/whois/parsers/whois.nic.at.rb +64 -0
  122. data/lib/whois/parsers/whois.nic.bj.rb +126 -0
  123. data/lib/whois/parsers/whois.nic.bo.rb +73 -0
  124. data/lib/whois/parsers/whois.nic.cd.rb +34 -0
  125. data/lib/whois/parsers/whois.nic.ch.rb +109 -0
  126. data/lib/whois/parsers/whois.nic.ci.rb +70 -0
  127. data/lib/whois/parsers/whois.nic.cl.rb +71 -0
  128. data/lib/whois/parsers/whois.nic.co.rb +25 -0
  129. data/lib/whois/parsers/whois.nic.college.rb +25 -0
  130. data/lib/whois/parsers/whois.nic.coop.rb +70 -0
  131. data/lib/whois/parsers/whois.nic.cx.rb +25 -0
  132. data/lib/whois/parsers/whois.nic.cz.rb +42 -0
  133. data/lib/whois/parsers/whois.nic.design.rb +25 -0
  134. data/lib/whois/parsers/whois.nic.dm.rb +25 -0
  135. data/lib/whois/parsers/whois.nic.dz.rb +58 -0
  136. data/lib/whois/parsers/whois.nic.ec.rb +34 -0
  137. data/lib/whois/parsers/whois.nic.es.rb +105 -0
  138. data/lib/whois/parsers/whois.nic.fo.rb +43 -0
  139. data/lib/whois/parsers/whois.nic.fr.rb +25 -0
  140. data/lib/whois/parsers/whois.nic.gd.rb +31 -0
  141. data/lib/whois/parsers/whois.nic.gl.rb +25 -0
  142. data/lib/whois/parsers/whois.nic.gs.rb +31 -0
  143. data/lib/whois/parsers/whois.nic.hn.rb +25 -0
  144. data/lib/whois/parsers/whois.nic.ht.rb +25 -0
  145. data/lib/whois/parsers/whois.nic.hu.rb +78 -0
  146. data/lib/whois/parsers/whois.nic.im.rb +66 -0
  147. data/lib/whois/parsers/whois.nic.io.rb +48 -0
  148. data/lib/whois/parsers/whois.nic.ir.rb +66 -0
  149. data/lib/whois/parsers/whois.nic.it.rb +159 -0
  150. data/lib/whois/parsers/whois.nic.jobs.rb +25 -0
  151. data/lib/whois/parsers/whois.nic.ki.rb +25 -0
  152. data/lib/whois/parsers/whois.nic.kz.rb +67 -0
  153. data/lib/whois/parsers/whois.nic.la.rb +25 -0
  154. data/lib/whois/parsers/whois.nic.li.rb +64 -0
  155. data/lib/whois/parsers/whois.nic.lk.rb +109 -0
  156. data/lib/whois/parsers/whois.nic.lv.rb +65 -0
  157. data/lib/whois/parsers/whois.nic.ly.rb +76 -0
  158. data/lib/whois/parsers/whois.nic.md.rb +94 -0
  159. data/lib/whois/parsers/whois.nic.me.rb +85 -0
  160. data/lib/whois/parsers/whois.nic.mg.rb +31 -0
  161. data/lib/whois/parsers/whois.nic.ms.rb +25 -0
  162. data/lib/whois/parsers/whois.nic.mu.rb +25 -0
  163. data/lib/whois/parsers/whois.nic.mx.rb +79 -0
  164. data/lib/whois/parsers/whois.nic.name.rb +68 -0
  165. data/lib/whois/parsers/whois.nic.net.ng.rb +27 -0
  166. data/lib/whois/parsers/whois.nic.net.sa.rb +70 -0
  167. data/lib/whois/parsers/whois.nic.net.sb.rb +31 -0
  168. data/lib/whois/parsers/whois.nic.nf.rb +25 -0
  169. data/lib/whois/parsers/whois.nic.org.uy.rb +75 -0
  170. data/lib/whois/parsers/whois.nic.pm.rb +25 -0
  171. data/lib/whois/parsers/whois.nic.pr.rb +84 -0
  172. data/lib/whois/parsers/whois.nic.priv.at.rb +62 -0
  173. data/lib/whois/parsers/whois.nic.pw.rb +25 -0
  174. data/lib/whois/parsers/whois.nic.re.rb +25 -0
  175. data/lib/whois/parsers/whois.nic.sh.rb +25 -0
  176. data/lib/whois/parsers/whois.nic.sl.rb +76 -0
  177. data/lib/whois/parsers/whois.nic.sm.rb +76 -0
  178. data/lib/whois/parsers/whois.nic.sn.rb +113 -0
  179. data/lib/whois/parsers/whois.nic.so.rb +70 -0
  180. data/lib/whois/parsers/whois.nic.space.rb +25 -0
  181. data/lib/whois/parsers/whois.nic.st.rb +72 -0
  182. data/lib/whois/parsers/whois.nic.tc.rb +25 -0
  183. data/lib/whois/parsers/whois.nic.tech.rb +25 -0
  184. data/lib/whois/parsers/whois.nic.tel.rb +25 -0
  185. data/lib/whois/parsers/whois.nic.tl.rb +25 -0
  186. data/lib/whois/parsers/whois.nic.tm.rb +31 -0
  187. data/lib/whois/parsers/whois.nic.tr.rb +159 -0
  188. data/lib/whois/parsers/whois.nic.travel.rb +25 -0
  189. data/lib/whois/parsers/whois.nic.uk.rb +177 -0
  190. data/lib/whois/parsers/whois.nic.us.rb +25 -0
  191. data/lib/whois/parsers/whois.nic.ve.rb +87 -0
  192. data/lib/whois/parsers/whois.nic.wf.rb +25 -0
  193. data/lib/whois/parsers/whois.nic.xxx.rb +42 -0
  194. data/lib/whois/parsers/whois.nic.xyz.rb +25 -0
  195. data/lib/whois/parsers/whois.norid.no.rb +61 -0
  196. data/lib/whois/parsers/whois.pairnic.com.rb +28 -0
  197. data/lib/whois/parsers/whois.pandi.or.id.rb +25 -0
  198. data/lib/whois/parsers/whois.pir.org.rb +90 -0
  199. data/lib/whois/parsers/whois.pnina.ps.rb +31 -0
  200. data/lib/whois/parsers/whois.register.bg.rb +83 -0
  201. data/lib/whois/parsers/whois.register.com.rb +30 -0
  202. data/lib/whois/parsers/whois.register.si.rb +73 -0
  203. data/lib/whois/parsers/whois.registre.ma.rb +63 -0
  204. data/lib/whois/parsers/whois.registro.br.rb +73 -0
  205. data/lib/whois/parsers/whois.registry.gy.rb +25 -0
  206. data/lib/whois/parsers/whois.registry.hm.rb +72 -0
  207. data/lib/whois/parsers/whois.registry.net.za.rb +139 -0
  208. data/lib/whois/parsers/whois.registry.om.rb +40 -0
  209. data/lib/whois/parsers/whois.registry.qa.rb +25 -0
  210. data/lib/whois/parsers/whois.ripe.net.rb +68 -0
  211. data/lib/whois/parsers/whois.rnids.rs.rb +134 -0
  212. data/lib/whois/parsers/whois.rotld.ro.rb +65 -0
  213. data/lib/whois/parsers/whois.rrpproxy.net.rb +32 -0
  214. data/lib/whois/parsers/whois.safenames.net.rb +48 -0
  215. data/lib/whois/parsers/whois.schlund.info.rb +34 -0
  216. data/lib/whois/parsers/whois.sgnic.sg.rb +87 -0
  217. data/lib/whois/parsers/whois.sk-nic.sk.rb +101 -0
  218. data/lib/whois/parsers/whois.smallregistry.net.rb +131 -0
  219. data/lib/whois/parsers/whois.srs.net.nz.rb +159 -0
  220. data/lib/whois/parsers/whois.sx.rb +127 -0
  221. data/lib/whois/parsers/whois.tcinet.ru.rb +114 -0
  222. data/lib/whois/parsers/whois.thnic.co.th.rb +79 -0
  223. data/lib/whois/parsers/whois.tld.ee.rb +134 -0
  224. data/lib/whois/parsers/whois.tld.sy.rb +34 -0
  225. data/lib/whois/parsers/whois.tonic.to.rb +86 -0
  226. data/lib/whois/parsers/whois.tucows.com.rb +28 -0
  227. data/lib/whois/parsers/whois.twnic.net.tw.rb +72 -0
  228. data/lib/whois/parsers/whois.tznic.or.tz.rb +25 -0
  229. data/lib/whois/parsers/whois.ua.rb +240 -0
  230. data/lib/whois/parsers/whois.udag.net.rb +28 -0
  231. data/lib/whois/parsers/whois.uniregistry.net.rb +61 -0
  232. data/lib/whois/parsers/whois.usp.ac.fj.rb +72 -0
  233. data/lib/whois/parsers/whois.verisign-grs.com.rb +49 -0
  234. data/lib/whois/parsers/whois.website.ws.rb +74 -0
  235. data/lib/whois/parsers/whois.wildwestdomains.com.rb +37 -0
  236. data/lib/whois/parsers/whois.yoursrs.com.rb +125 -0
  237. data/lib/whois/parsers/whois.za.net.rb +72 -0
  238. data/lib/whois/parsers/whois.za.org.rb +72 -0
  239. data/lib/whois/parsers/whois1.nic.bi.rb +25 -0
  240. data/lib/whois/parsers/za_central_registry.rb +68 -0
  241. data/lib/whois/parsers.rb +4 -0
  242. data/lib/whois/safe_record.rb +169 -0
  243. data/lib/whois/scanners/base.rb +116 -0
  244. data/lib/whois/scanners/base_afilias.rb +51 -0
  245. data/lib/whois/scanners/base_cocca2.rb +43 -0
  246. data/lib/whois/scanners/base_icann_compliant.rb +45 -0
  247. data/lib/whois/scanners/base_iisse.rb +36 -0
  248. data/lib/whois/scanners/base_shared1.rb +31 -0
  249. data/lib/whois/scanners/base_shared2.rb +35 -0
  250. data/lib/whois/scanners/base_shared3.rb +37 -0
  251. data/lib/whois/scanners/base_whoisd.rb +44 -0
  252. data/lib/whois/scanners/iana.rb +89 -0
  253. data/lib/whois/scanners/scannable.rb +65 -0
  254. data/lib/whois/scanners/verisign.rb +100 -0
  255. data/lib/whois/scanners/whois.ati.tn.rb +32 -0
  256. data/lib/whois/scanners/whois.audns.net.au.rb +25 -0
  257. data/lib/whois/scanners/whois.cctld.by.rb +35 -0
  258. data/lib/whois/scanners/whois.centralnic.com.rb +32 -0
  259. data/lib/whois/scanners/whois.cira.ca.rb +72 -0
  260. data/lib/whois/scanners/whois.cnnic.cn.rb +42 -0
  261. data/lib/whois/scanners/whois.denic.de.rb +96 -0
  262. data/lib/whois/scanners/whois.dns.hr.rb +25 -0
  263. data/lib/whois/scanners/whois.domainregistry.ie.rb +46 -0
  264. data/lib/whois/scanners/whois.fi.rb +39 -0
  265. data/lib/whois/scanners/whois.nc.rb +32 -0
  266. data/lib/whois/scanners/whois.nic.cz.rb +22 -0
  267. data/lib/whois/scanners/whois.nic.it.rb +92 -0
  268. data/lib/whois/scanners/whois.pir.org.rb +17 -0
  269. data/lib/whois/scanners/whois.registry.net.za.rb +92 -0
  270. data/lib/whois/scanners/whois.rnids.rs.rb +52 -0
  271. data/lib/whois/scanners/whois.smallregistry.net.rb +50 -0
  272. data/lib/whois/scanners/whois.srs.net.nz.rb +23 -0
  273. data/lib/whois/scanners/whois.sx.rb +37 -0
  274. data/lib/whois/scanners/whois.tld.ee.rb +47 -0
  275. data/lib/whois/scanners/whois.tucows.com.rb +23 -0
  276. data/lib/whois/scanners/whois.yoursrs.com.rb +24 -0
  277. data/lib/whois-parser.rb +10 -0
  278. data/whois-parser.gemspec +37 -19
  279. metadata +318 -20
  280. data/.gitignore +0 -14
  281. data/Gemfile +0 -4
  282. data/Rakefile +0 -2
@@ -0,0 +1,101 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+
12
+
13
+ module Whois
14
+ class Parsers
15
+
16
+ #
17
+ # = whois.sk-nic.sk parser
18
+ #
19
+ # Parser for the whois.sk-nic.sk server.
20
+ #
21
+ # NOTE: This parser is just a stub and provides only a few basic methods
22
+ # to check for domain availability and get domain status.
23
+ # Please consider to contribute implementing missing methods.
24
+ # See WhoisNicIt parser for an explanation of all available methods
25
+ # and examples.
26
+ #
27
+ class WhoisSkNicSk < Base
28
+
29
+ # == Values for Status
30
+ #
31
+ # @see https://www.sk-nic.sk/documents/stavy_domen.html
32
+ # @see http://www.inwx.de/en/sk-domain.html
33
+ #
34
+ property_supported :status do
35
+ if content_for_scanner =~ /^Domain-status\s+(.+)\n/
36
+ case $1.downcase
37
+ # The domain is registered and paid.
38
+ when "dom_ok"
39
+ :registered
40
+ # The domain is registered and registration fee has to be payed (14 days).
41
+ # Replacement 14-day period for domain payment.
42
+ when "dom_ta"
43
+ :registered
44
+ # 28 days before the expiration of one year's notice is sent to the first call for an extension of domains.
45
+ # The domain is still fully functional (14 days).
46
+ when "dom_dakt"
47
+ :registered
48
+ # 14 days before the expiration of one year's notice is sent to the second call to the extension of domains.
49
+ # The domain is still fully functional (14 days).
50
+ when "dom_warn"
51
+ :registered
52
+ # The domain is expired and has not been renewed (14 days).
53
+ when "dom_lnot"
54
+ :registered
55
+ when "dom_exp"
56
+ :registered
57
+ # The domain losts its registrar (28 days).
58
+ when "dom_held"
59
+ :redemption
60
+ else
61
+ Whois.bug!(ParserError, "Unknown status `#{$1}'.")
62
+ end
63
+ else
64
+ :available
65
+ end
66
+ end
67
+
68
+ property_supported :available? do
69
+ !!(content_for_scanner =~ /^Not found/)
70
+ end
71
+
72
+ property_supported :registered? do
73
+ !available?
74
+ end
75
+
76
+
77
+ property_not_supported :created_on
78
+
79
+ property_supported :updated_on do
80
+ if content_for_scanner =~ /^Last-update\s+(.+)\n/
81
+ parse_time($1)
82
+ end
83
+ end
84
+
85
+ property_supported :expires_on do
86
+ if content_for_scanner =~ /^Valid-date\s+(.+)\n/
87
+ parse_time($1)
88
+ end
89
+ end
90
+
91
+
92
+ property_supported :nameservers do
93
+ content_for_scanner.scan(/dns_name\s+(.+)\n/).flatten.map do |name|
94
+ Parser::Nameserver.new(:name => name)
95
+ end
96
+ end
97
+
98
+ end
99
+
100
+ end
101
+ end
@@ -0,0 +1,131 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+ require 'whois/scanners/whois.smallregistry.net.rb'
12
+
13
+
14
+ module Whois
15
+ class Parsers
16
+
17
+ # Parser for the whois.smallregistry.net server.
18
+ #
19
+ # @author Mathieu Arnold <m@absolight.fr>
20
+ #
21
+ class WhoisSmallregistryNet < Base
22
+ include Scanners::Scannable
23
+
24
+ self.scanner = Scanners::WhoisSmallregistryNet
25
+
26
+
27
+ property_supported :disclaimer do
28
+ node("field:disclaimer") do |alpha|
29
+ alpha.scan(/# (.+)\n/).flatten.map do |beta|
30
+ token = beta.strip
31
+ token.gsub!(/\s+/, " ")
32
+ end.join(" ").gsub!(/(\s{2})/, "\n")
33
+ end
34
+ end
35
+
36
+
37
+ property_supported :domain do
38
+ node("name")
39
+ end
40
+
41
+ property_not_supported :domain_id
42
+
43
+
44
+ property_supported :status do
45
+ if node?("status:available")
46
+ :available
47
+ else
48
+ case node("status")
49
+ when "ACTIVE"
50
+ :registered
51
+ else
52
+ Whois.bug!(ParserError, "Unknown status `#{node("field:status")}'.")
53
+ end
54
+ end
55
+ end
56
+
57
+ property_supported :available? do
58
+ status == :available
59
+ end
60
+
61
+ property_supported :registered? do
62
+ !available?
63
+ end
64
+
65
+
66
+ property_supported :created_on do
67
+ node("created") { |str| parse_time(str) }
68
+ end
69
+
70
+ property_supported :updated_on do
71
+ node("updated") { |str| parse_time(str) }
72
+ end
73
+
74
+ property_supported :expires_on do
75
+ node("expired") { |str| parse_time(str) }
76
+ end
77
+
78
+
79
+ property_supported :registrar do
80
+ node("registrar") do |hash|
81
+ v1, v2, v3, v4 = hash.values_at('nil', 'name', 'name', 'web')
82
+ Parser::Registrar.new(
83
+ :id => v1,
84
+ :name => v2,
85
+ :organization => v3,
86
+ :url => v4
87
+ )
88
+ end
89
+ end
90
+
91
+ property_supported :registrant_contacts do
92
+ build_contact("registrant", Parser::Contact::TYPE_REGISTRANT)
93
+ end
94
+
95
+ property_supported :admin_contacts do
96
+ build_contact("administrative_contact", Parser::Contact::TYPE_ADMINISTRATIVE)
97
+ end
98
+
99
+ property_supported :technical_contacts do
100
+ build_contact("technical_contact", Parser::Contact::TYPE_TECHNICAL)
101
+ end
102
+
103
+
104
+ property_supported :nameservers do
105
+ Array.wrap(node("name_servers")).map do |hash|
106
+ Parser::Nameserver.new(:name => hash)
107
+ end
108
+ end
109
+
110
+
111
+ private
112
+
113
+ def build_contact(element, type)
114
+ node(element) do |hash|
115
+ Parser::Contact.new(
116
+ :type => type,
117
+ :id => hash['nic-handle'],
118
+ :name => hash['name'],
119
+ :organization => hash['company'],
120
+ :address => hash['address'],
121
+ :phone => hash['phone'],
122
+ :fax => hash['fax'],
123
+ :email => hash['mobile'],
124
+ :updated_on => parse_time(hash['updated'])
125
+ )
126
+ end
127
+ end
128
+
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,159 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+ require 'whois/scanners/whois.srs.net.nz.rb'
12
+
13
+
14
+ module Whois
15
+ class Parsers
16
+
17
+ # Parser for the whois.srs.net.nz server.
18
+ #
19
+ # @see Whois::Parsers::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisSrsNetNz < Base
23
+ include Scanners::Scannable
24
+
25
+ self.scanner = Scanners::WhoisSrsNetNz
26
+
27
+
28
+ property_supported :domain do
29
+ node("domain_name")
30
+ end
31
+
32
+ property_not_supported :domain_id
33
+
34
+
35
+ # @see http://dnc.org.nz/content/srs-whois-spec-1.0.html
36
+ property_supported :status do
37
+ node("query_status") do |value|
38
+ case value.downcase
39
+ when "200 active"
40
+ :registered
41
+ # The domain is no longer active but is in the period prior
42
+ # to being released for general registrations
43
+ when "210 pendingrelease"
44
+ :redemption
45
+ when "220 available"
46
+ :available
47
+ when "404 request denied"
48
+ :error
49
+ when /invalid characters/
50
+ :invalid
51
+ else
52
+ Whois.bug!(ParserError, "Unknown status `#{value}'.")
53
+ end
54
+ end || Whois.bug!(ParserError, "Unable to parse status.")
55
+ end
56
+
57
+ property_supported :available? do
58
+ status == :available
59
+ end
60
+
61
+ property_supported :registered? do
62
+ status == :registered || status == :redemption
63
+ end
64
+
65
+
66
+ property_supported :created_on do
67
+ node("domain_dateregistered") { |value| parse_time(value) }
68
+ end
69
+
70
+ property_supported :updated_on do
71
+ node("domain_datelastmodified") { |value| parse_time(value) }
72
+ end
73
+
74
+ property_supported :expires_on do
75
+ node("domain_datebilleduntil") { |value| parse_time(value) }
76
+ end
77
+
78
+
79
+ property_supported :registrar do
80
+ node("registrar_name") do |value|
81
+ Parser::Registrar.new(
82
+ name: value
83
+ )
84
+ end
85
+ end
86
+
87
+ property_supported :registrant_contacts do
88
+ build_contact("registrant", Parser::Contact::TYPE_REGISTRANT)
89
+ end
90
+
91
+ property_supported :admin_contacts do
92
+ build_contact("admin", Parser::Contact::TYPE_ADMINISTRATIVE)
93
+ end
94
+
95
+ property_supported :technical_contacts do
96
+ build_contact("technical", Parser::Contact::TYPE_TECHNICAL)
97
+ end
98
+
99
+
100
+ property_supported :nameservers do
101
+ (1..4).map do |i|
102
+ node("ns_name_0#{i}") { |value| Parser::Nameserver.new(name: value) }
103
+ end.compact
104
+ end
105
+
106
+
107
+ # Checks whether the response has been throttled.
108
+ #
109
+ # @return [Boolean]
110
+ #
111
+ # @example
112
+ # query_status: 440 Request Denied
113
+ #
114
+ def response_throttled?
115
+ cached_properties_fetch(:response_throttled?) do
116
+ node("query_status") == "440 Request Denied"
117
+ end
118
+ end
119
+
120
+
121
+ # NEWPROPERTY
122
+ def valid?
123
+ cached_properties_fetch(:valid?) do
124
+ !invalid?
125
+ end
126
+ end
127
+
128
+ # NEWPROPERTY
129
+ def invalid?
130
+ cached_properties_fetch(:invalid?) do
131
+ status == :invalid
132
+ end
133
+ end
134
+
135
+
136
+ private
137
+
138
+ def build_contact(element, type)
139
+ node("#{element}_contact_name") do
140
+ Parser::Contact.new(
141
+ type: type,
142
+ id: nil,
143
+ name: node("#{element}_contact_name"),
144
+ address: node("#{element}_contact_address1"),
145
+ city: node("#{element}_contact_city"),
146
+ zip: node("#{element}_contact_postalcode"),
147
+ state: node("#{element}_contact_province"),
148
+ country: node("#{element}_contact_country"),
149
+ phone: node("#{element}_contact_phone"),
150
+ fax: node("#{element}_contact_fax"),
151
+ email: node("#{element}_contact_email")
152
+ )
153
+ end
154
+ end
155
+
156
+ end
157
+
158
+ end
159
+ end
@@ -0,0 +1,127 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+ require 'whois/scanners/whois.sx.rb'
12
+
13
+
14
+ module Whois
15
+ class Parsers
16
+
17
+ # Parser for the whois.sx server.
18
+ #
19
+ # @see Whois::Parsers::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisSx < Base
23
+ include Scanners::Scannable
24
+
25
+ self.scanner = Scanners::WhoisSx
26
+
27
+
28
+ property_supported :disclaimer do
29
+ node("field:disclaimer")
30
+ end
31
+
32
+
33
+ property_supported :domain do
34
+ node("Domain Name", &:downcase)
35
+ end
36
+
37
+ property_supported :domain_id do
38
+ node("Domain ID")
39
+ end
40
+
41
+
42
+ property_supported :status do
43
+ case (s = node("Domain Status", &:downcase))
44
+ when "available"
45
+ :available
46
+ when "ok"
47
+ :registered
48
+ when "premium name"
49
+ :unavailable
50
+ else
51
+ Whois.bug!(ParserError, "Unknown status `#{s}'.")
52
+ end
53
+ end
54
+
55
+ property_supported :available? do
56
+ status == :available
57
+ end
58
+
59
+ property_supported :registered? do
60
+ status == :registered
61
+ end
62
+
63
+
64
+ property_supported :created_on do
65
+ node("Creation Date") { |value| parse_time(value) }
66
+ end
67
+
68
+ property_supported :updated_on do
69
+ node("Updated Date") { |value| parse_time(value) }
70
+ end
71
+
72
+ property_supported :expires_on do
73
+ node("Registry Expiry Date") { |value| parse_time(value) }
74
+ end
75
+
76
+
77
+ property_supported :registrar do
78
+ node("Sponsoring Registrar") do |value|
79
+ Parser::Registrar.new(
80
+ :name => value
81
+ )
82
+ end
83
+ end
84
+
85
+
86
+ property_supported :registrant_contacts do
87
+ build_contact("Registrant", Parser::Contact::TYPE_REGISTRANT)
88
+ end
89
+
90
+ property_supported :admin_contacts do
91
+ build_contact("Admin", Parser::Contact::TYPE_ADMINISTRATIVE)
92
+ end
93
+
94
+ property_supported :technical_contacts do
95
+ build_contact("Tech", Parser::Contact::TYPE_TECHNICAL)
96
+ end
97
+
98
+
99
+ property_supported :nameservers do
100
+ Array.wrap(node("Name Server")).map do |name|
101
+ Parser::Nameserver.new(:name => name)
102
+ end
103
+ end
104
+
105
+
106
+ private
107
+
108
+ def build_contact(element, type)
109
+ node("#{element} ID") do |id|
110
+ Parser::Contact.new(
111
+ :type => type,
112
+ :id => id,
113
+ :name => node("#{element} Name"),
114
+ :organization => node("#{element} Organization"),
115
+ :address => node("#{element} Street"),
116
+ :city => node("#{element} City"),
117
+ :zip => node("#{element} Postal Code"),
118
+ :country => node("#{element} Country"),
119
+ :email => node("#{element} Email")
120
+ )
121
+ end
122
+ end
123
+
124
+ end
125
+
126
+ end
127
+ end
@@ -0,0 +1,114 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+
12
+
13
+ module Whois
14
+ class Parsers
15
+
16
+ # Parser for the whois.tcinet.ru server.
17
+ #
18
+ # @note This parser is just a stub and provides only a few basic methods
19
+ # to check for domain availability and get domain status.
20
+ # Please consider to contribute implementing missing methods.
21
+ #
22
+ # @see Whois::Parsers::Example
23
+ # The Example parser for the list of all available methods.
24
+ #
25
+ class WhoisTcinetRu < Base
26
+
27
+ property_supported :domain do
28
+ if content_for_scanner =~ /domain:\s+(.+?)\n/
29
+ $1.downcase
30
+ end
31
+ end
32
+
33
+ property_not_supported :domain_id
34
+
35
+
36
+ property_supported :status do
37
+ if content_for_scanner =~ /state:\s+(.+?)\n/
38
+ $1.split(",").map(&:strip)
39
+ else
40
+ []
41
+ end
42
+ end
43
+
44
+ property_supported :available? do
45
+ !!(content_for_scanner =~ /No entries found/)
46
+ end
47
+
48
+ property_supported :registered? do
49
+ !available?
50
+ end
51
+
52
+
53
+ property_supported :created_on do
54
+ if content_for_scanner =~ /created:\s+(.*)\n/
55
+ parse_time($1)
56
+ end
57
+ end
58
+
59
+ property_not_supported :updated_on
60
+
61
+ property_supported :expires_on do
62
+ if content_for_scanner =~ /paid-till:\s+(.*)\n/
63
+ parse_time($1)
64
+ end
65
+ end
66
+
67
+
68
+ property_supported :registrar do
69
+ if content_for_scanner =~ /registrar:\s+(.*)\n/
70
+ Parser::Registrar.new(
71
+ :id => $1
72
+ )
73
+ end
74
+ end
75
+
76
+
77
+ property_supported :admin_contacts do
78
+ url = content_for_scanner[/admin-contact:\s+(.+)\n/, 1]
79
+ email = content_for_scanner[/e-mail:\s+(.+)\n/, 1]
80
+ contact = if url or email
81
+ Parser::Contact.new(
82
+ :type => Parser::Contact::TYPE_ADMINISTRATIVE,
83
+ :url => url,
84
+ :email => email,
85
+ :name => content_for_scanner[/person:\s+(.+)\n/, 1],
86
+ :organization => content_for_scanner[/org:\s+(.+)\n/, 1],
87
+ :phone => content_for_scanner[/phone:\s+(.+)\n/, 1],
88
+ :fax => content_for_scanner[/fax-no:\s+(.+)\n/, 1]
89
+ )
90
+ end
91
+ Array.wrap(contact)
92
+ end
93
+
94
+ property_not_supported :registrant_contacts
95
+
96
+ property_not_supported :technical_contacts
97
+
98
+
99
+ # Nameservers are listed in the following formats:
100
+ #
101
+ # nserver: ns.masterhost.ru.
102
+ # nserver: ns.masterhost.ru. 217.16.20.30
103
+ #
104
+ property_supported :nameservers do
105
+ content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
106
+ name, ipv4 = line.split(/\s+/)
107
+ Parser::Nameserver.new(:name => name.chomp("."), :ipv4 => ipv4)
108
+ end
109
+ end
110
+
111
+ end
112
+
113
+ end
114
+ end
@@ -0,0 +1,79 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2015 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require_relative 'base'
11
+
12
+
13
+ module Whois
14
+ class Parsers
15
+
16
+ #
17
+ # = whois.thnic.co.th parser
18
+ #
19
+ # Parser for the whois.thnic.co.th server.
20
+ #
21
+ # NOTE: This parser is just a stub and provides only a few basic methods
22
+ # to check for domain availability and get domain status.
23
+ # Please consider to contribute implementing missing methods.
24
+ # See WhoisNicIt parser for an explanation of all available methods
25
+ # and examples.
26
+ #
27
+ class WhoisThnicCoTh < Base
28
+
29
+ property_supported :status do
30
+ if content_for_scanner =~ /Status: (.+?)\n/
31
+ case $1.downcase
32
+ when "active"
33
+ :registered
34
+ else
35
+ Whois.bug!(ParserError, "Unknown status `#{$1}'.")
36
+ end
37
+ else
38
+ :available
39
+ end
40
+ end
41
+
42
+ property_supported :available? do
43
+ !!(content_for_scanner =~ /^% No match for/)
44
+ end
45
+
46
+ property_supported :registered? do
47
+ !available?
48
+ end
49
+
50
+
51
+ property_supported :created_on do
52
+ if content_for_scanner =~ /^Created date: (.+?)\n/
53
+ parse_time($1)
54
+ end
55
+ end
56
+
57
+ property_supported :updated_on do
58
+ if content_for_scanner =~ /^Updated date: (.+?)\n/
59
+ parse_time($1)
60
+ end
61
+ end
62
+
63
+ property_supported :expires_on do
64
+ if content_for_scanner =~ /^Exp date: (.+?)\n/
65
+ parse_time($1)
66
+ end
67
+ end
68
+
69
+
70
+ property_supported :nameservers do
71
+ content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
72
+ Parser::Nameserver.new(:name => name.downcase)
73
+ end
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+ end