whois-parser-next 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +80 -0
  3. data/CODE_OF_CONDUCT.md +30 -0
  4. data/CONTRIBUTING.md +80 -0
  5. data/GOVERNANCE.md +59 -0
  6. data/LICENSE.txt +22 -0
  7. data/MAINTAINERS.md +44 -0
  8. data/README.md +123 -0
  9. data/RELEASING.md +43 -0
  10. data/ROADMAP.md +59 -0
  11. data/SECURITY.md +41 -0
  12. data/lib/whois/parser/contact.rb +56 -0
  13. data/lib/whois/parser/errors.rb +46 -0
  14. data/lib/whois/parser/nameserver.rb +39 -0
  15. data/lib/whois/parser/registrar.rb +25 -0
  16. data/lib/whois/parser/super_struct.rb +50 -0
  17. data/lib/whois/parser/version.rb +6 -0
  18. data/lib/whois/parser.rb +447 -0
  19. data/lib/whois/parser_extensions/whois.rb +83 -0
  20. data/lib/whois/parser_extensions/whois_parser.rb +24 -0
  21. data/lib/whois/parser_extensions/whois_record.rb +236 -0
  22. data/lib/whois/parser_extensions.rb +3 -0
  23. data/lib/whois/parsers/base.rb +413 -0
  24. data/lib/whois/parsers/base_afilias.rb +144 -0
  25. data/lib/whois/parsers/base_afilias2.rb +145 -0
  26. data/lib/whois/parsers/base_cocca.rb +97 -0
  27. data/lib/whois/parsers/base_cocca2.rb +93 -0
  28. data/lib/whois/parsers/base_icann_compliant.rb +158 -0
  29. data/lib/whois/parsers/base_icb.rb +51 -0
  30. data/lib/whois/parsers/base_iisse.rb +113 -0
  31. data/lib/whois/parsers/base_nic_fr.rb +175 -0
  32. data/lib/whois/parsers/base_shared1.rb +112 -0
  33. data/lib/whois/parsers/base_shared2.rb +130 -0
  34. data/lib/whois/parsers/base_shared3.rb +131 -0
  35. data/lib/whois/parsers/base_unsupported_registry.rb +30 -0
  36. data/lib/whois/parsers/base_verisign.rb +106 -0
  37. data/lib/whois/parsers/base_whoisd.rb +150 -0
  38. data/lib/whois/parsers/blank.rb +35 -0
  39. data/lib/whois/parsers/capetown-whois.registry.net.za.rb +25 -0
  40. data/lib/whois/parsers/ccwhois.ksregistry.net.rb +25 -0
  41. data/lib/whois/parsers/ccwhois.verisign-grs.com.rb +25 -0
  42. data/lib/whois/parsers/coza-whois.registry.net.za.rb +25 -0
  43. data/lib/whois/parsers/durban-whois.registry.net.za.rb +25 -0
  44. data/lib/whois/parsers/example.rb +163 -0
  45. data/lib/whois/parsers/joburg-whois.registry.net.za.rb +25 -0
  46. data/lib/whois/parsers/kero.yachay.pe.rb +97 -0
  47. data/lib/whois/parsers/org-whois.registry.net.za.rb +25 -0
  48. data/lib/whois/parsers/registry_response_safety.rb +29 -0
  49. data/lib/whois/parsers/tvwhois.verisign-grs.com.rb +25 -0
  50. data/lib/whois/parsers/vunic.vu.rb +11 -0
  51. data/lib/whois/parsers/whois.1und1.info.rb +28 -0
  52. data/lib/whois/parsers/whois.35.com.rb +23 -0
  53. data/lib/whois/parsers/whois.aeda.net.ae.rb +65 -0
  54. data/lib/whois/parsers/whois.aero.rb +58 -0
  55. data/lib/whois/parsers/whois.afilias-grs.info.rb +33 -0
  56. data/lib/whois/parsers/whois.afilias-srs.net.rb +16 -0
  57. data/lib/whois/parsers/whois.afilias.net.rb +41 -0
  58. data/lib/whois/parsers/whois.amnic.net.rb +81 -0
  59. data/lib/whois/parsers/whois.ascio.com.rb +29 -0
  60. data/lib/whois/parsers/whois.ati.tn.rb +120 -0
  61. data/lib/whois/parsers/whois.auda.org.au.rb +12 -0
  62. data/lib/whois/parsers/whois.audns.net.au.rb +118 -0
  63. data/lib/whois/parsers/whois.ax.rb +64 -0
  64. data/lib/whois/parsers/whois.biz.rb +34 -0
  65. data/lib/whois/parsers/whois.bnnic.bn.rb +77 -0
  66. data/lib/whois/parsers/whois.cat.rb +75 -0
  67. data/lib/whois/parsers/whois.cctld.by.rb +98 -0
  68. data/lib/whois/parsers/whois.cctld.uz.rb +83 -0
  69. data/lib/whois/parsers/whois.cdmon.com.rb +23 -0
  70. data/lib/whois/parsers/whois.centralnic.com.rb +144 -0
  71. data/lib/whois/parsers/whois.cira.ca.rb +227 -0
  72. data/lib/whois/parsers/whois.cmc.iq.rb +25 -0
  73. data/lib/whois/parsers/whois.cnnic.cn.rb +108 -0
  74. data/lib/whois/parsers/whois.co.ca.rb +74 -0
  75. data/lib/whois/parsers/whois.co.pl.rb +82 -0
  76. data/lib/whois/parsers/whois.co.ug.rb +93 -0
  77. data/lib/whois/parsers/whois.comlaude.com.rb +113 -0
  78. data/lib/whois/parsers/whois.corporatedomains.com.rb +28 -0
  79. data/lib/whois/parsers/whois.denic.de.rb +164 -0
  80. data/lib/whois/parsers/whois.dk-hostmaster.dk.rb +88 -0
  81. data/lib/whois/parsers/whois.dns.be.rb +120 -0
  82. data/lib/whois/parsers/whois.dns.hr.rb +119 -0
  83. data/lib/whois/parsers/whois.dns.lu.rb +125 -0
  84. data/lib/whois/parsers/whois.dns.pl.rb +151 -0
  85. data/lib/whois/parsers/whois.dns.pt.rb +92 -0
  86. data/lib/whois/parsers/whois.domain-registry.nl.rb +133 -0
  87. data/lib/whois/parsers/whois.domainregistry.ie.rb +128 -0
  88. data/lib/whois/parsers/whois.domreg.lt.rb +68 -0
  89. data/lib/whois/parsers/whois.donuts.co.rb +59 -0
  90. data/lib/whois/parsers/whois.dot.cf.rb +71 -0
  91. data/lib/whois/parsers/whois.dot.tk.rb +70 -0
  92. data/lib/whois/parsers/whois.dotgov.gov.rb +58 -0
  93. data/lib/whois/parsers/whois.dotmobiregistry.net.rb +21 -0
  94. data/lib/whois/parsers/whois.dotpostregistry.net.rb +25 -0
  95. data/lib/whois/parsers/whois.dreamhost.com.rb +23 -0
  96. data/lib/whois/parsers/whois.educause.edu.rb +198 -0
  97. data/lib/whois/parsers/whois.eenet.ee.rb +72 -0
  98. data/lib/whois/parsers/whois.enom.com.rb +34 -0
  99. data/lib/whois/parsers/whois.eu.org.rb +58 -0
  100. data/lib/whois/parsers/whois.eu.rb +130 -0
  101. data/lib/whois/parsers/whois.fi.rb +119 -0
  102. data/lib/whois/parsers/whois.gandi.net.rb +36 -0
  103. data/lib/whois/parsers/whois.gg.rb +93 -0
  104. data/lib/whois/parsers/whois.godaddy.com.rb +42 -0
  105. data/lib/whois/parsers/whois.gov.za.rb +60 -0
  106. data/lib/whois/parsers/whois.hkirc.hk.rb +71 -0
  107. data/lib/whois/parsers/whois.iana.org.rb +102 -0
  108. data/lib/whois/parsers/whois.id.rb +26 -0
  109. data/lib/whois/parsers/whois.iedr.ie.rb +18 -0
  110. data/lib/whois/parsers/whois.iis.nu.rb +46 -0
  111. data/lib/whois/parsers/whois.iis.se.rb +26 -0
  112. data/lib/whois/parsers/whois.in.ua.rb +75 -0
  113. data/lib/whois/parsers/whois.inregistry.net.rb +27 -0
  114. data/lib/whois/parsers/whois.isnic.is.rb +70 -0
  115. data/lib/whois/parsers/whois.isoc.org.il.rb +75 -0
  116. data/lib/whois/parsers/whois.ja.net.rb +75 -0
  117. data/lib/whois/parsers/whois.je.rb +75 -0
  118. data/lib/whois/parsers/whois.jprs.jp.rb +103 -0
  119. data/lib/whois/parsers/whois.kenic.or.ke.rb +93 -0
  120. data/lib/whois/parsers/whois.kg.rb +77 -0
  121. data/lib/whois/parsers/whois.kr.rb +79 -0
  122. data/lib/whois/parsers/whois.markmonitor.com.rb +36 -0
  123. data/lib/whois/parsers/whois.marnet.mk.rb +20 -0
  124. data/lib/whois/parsers/whois.monic.mo.rb +83 -0
  125. data/lib/whois/parsers/whois.museum.rb +79 -0
  126. data/lib/whois/parsers/whois.mx.rb +16 -0
  127. data/lib/whois/parsers/whois.mynic.my.rb +86 -0
  128. data/lib/whois/parsers/whois.na-nic.com.na.rb +21 -0
  129. data/lib/whois/parsers/whois.nc.rb +122 -0
  130. data/lib/whois/parsers/whois.netcom.cm.rb +54 -0
  131. data/lib/whois/parsers/whois.networksolutions.com.rb +37 -0
  132. data/lib/whois/parsers/whois.nic.ac.rb +33 -0
  133. data/lib/whois/parsers/whois.nic.af.rb +32 -0
  134. data/lib/whois/parsers/whois.nic.ag.rb +33 -0
  135. data/lib/whois/parsers/whois.nic.ai.rb +62 -0
  136. data/lib/whois/parsers/whois.nic.ar.rb +54 -0
  137. data/lib/whois/parsers/whois.nic.art.rb +9 -0
  138. data/lib/whois/parsers/whois.nic.as.rb +73 -0
  139. data/lib/whois/parsers/whois.nic.asia.rb +112 -0
  140. data/lib/whois/parsers/whois.nic.at.rb +68 -0
  141. data/lib/whois/parsers/whois.nic.best.rb +9 -0
  142. data/lib/whois/parsers/whois.nic.bj.rb +127 -0
  143. data/lib/whois/parsers/whois.nic.bo.rb +82 -0
  144. data/lib/whois/parsers/whois.nic.business.rb +8 -0
  145. data/lib/whois/parsers/whois.nic.cat.rb +23 -0
  146. data/lib/whois/parsers/whois.nic.cd.rb +38 -0
  147. data/lib/whois/parsers/whois.nic.cfd.rb +9 -0
  148. data/lib/whois/parsers/whois.nic.ch.rb +109 -0
  149. data/lib/whois/parsers/whois.nic.chat.rb +10 -0
  150. data/lib/whois/parsers/whois.nic.ci.rb +74 -0
  151. data/lib/whois/parsers/whois.nic.cl.rb +76 -0
  152. data/lib/whois/parsers/whois.nic.cloud.rb +15 -0
  153. data/lib/whois/parsers/whois.nic.club.rb +15 -0
  154. data/lib/whois/parsers/whois.nic.co.rb +25 -0
  155. data/lib/whois/parsers/whois.nic.college.rb +25 -0
  156. data/lib/whois/parsers/whois.nic.coop.rb +70 -0
  157. data/lib/whois/parsers/whois.nic.cr.rb +64 -0
  158. data/lib/whois/parsers/whois.nic.cx.rb +25 -0
  159. data/lib/whois/parsers/whois.nic.cz.rb +42 -0
  160. data/lib/whois/parsers/whois.nic.delivery.rb +9 -0
  161. data/lib/whois/parsers/whois.nic.design.rb +30 -0
  162. data/lib/whois/parsers/whois.nic.direct.rb +9 -0
  163. data/lib/whois/parsers/whois.nic.dm.rb +39 -0
  164. data/lib/whois/parsers/whois.nic.domains.rb +8 -0
  165. data/lib/whois/parsers/whois.nic.dz.rb +67 -0
  166. data/lib/whois/parsers/whois.nic.ec.rb +44 -0
  167. data/lib/whois/parsers/whois.nic.es.rb +114 -0
  168. data/lib/whois/parsers/whois.nic.fm.rb +18 -0
  169. data/lib/whois/parsers/whois.nic.fo.rb +69 -0
  170. data/lib/whois/parsers/whois.nic.fr.rb +25 -0
  171. data/lib/whois/parsers/whois.nic.fun.rb +13 -0
  172. data/lib/whois/parsers/whois.nic.games.rb +9 -0
  173. data/lib/whois/parsers/whois.nic.gd.rb +31 -0
  174. data/lib/whois/parsers/whois.nic.gl.rb +49 -0
  175. data/lib/whois/parsers/whois.nic.group.rb +8 -0
  176. data/lib/whois/parsers/whois.nic.gs.rb +31 -0
  177. data/lib/whois/parsers/whois.nic.hn.rb +49 -0
  178. data/lib/whois/parsers/whois.nic.host.rb +37 -0
  179. data/lib/whois/parsers/whois.nic.ht.rb +25 -0
  180. data/lib/whois/parsers/whois.nic.hu.rb +78 -0
  181. data/lib/whois/parsers/whois.nic.icu.rb +12 -0
  182. data/lib/whois/parsers/whois.nic.im.rb +66 -0
  183. data/lib/whois/parsers/whois.nic.ink.rb +12 -0
  184. data/lib/whois/parsers/whois.nic.io.rb +52 -0
  185. data/lib/whois/parsers/whois.nic.ir.rb +70 -0
  186. data/lib/whois/parsers/whois.nic.it.rb +159 -0
  187. data/lib/whois/parsers/whois.nic.jobs.rb +25 -0
  188. data/lib/whois/parsers/whois.nic.ki.rb +25 -0
  189. data/lib/whois/parsers/whois.nic.kz.rb +69 -0
  190. data/lib/whois/parsers/whois.nic.la.rb +32 -0
  191. data/lib/whois/parsers/whois.nic.li.rb +68 -0
  192. data/lib/whois/parsers/whois.nic.life.rb +10 -0
  193. data/lib/whois/parsers/whois.nic.link.rb +13 -0
  194. data/lib/whois/parsers/whois.nic.lk.rb +109 -0
  195. data/lib/whois/parsers/whois.nic.ltd.rb +8 -0
  196. data/lib/whois/parsers/whois.nic.lv.rb +69 -0
  197. data/lib/whois/parsers/whois.nic.ly.rb +78 -0
  198. data/lib/whois/parsers/whois.nic.market.rb +8 -0
  199. data/lib/whois/parsers/whois.nic.md.rb +101 -0
  200. data/lib/whois/parsers/whois.nic.me.rb +85 -0
  201. data/lib/whois/parsers/whois.nic.mg.rb +35 -0
  202. data/lib/whois/parsers/whois.nic.ms.rb +37 -0
  203. data/lib/whois/parsers/whois.nic.mu.rb +25 -0
  204. data/lib/whois/parsers/whois.nic.mw.rb +33 -0
  205. data/lib/whois/parsers/whois.nic.mx.rb +79 -0
  206. data/lib/whois/parsers/whois.nic.name.rb +68 -0
  207. data/lib/whois/parsers/whois.nic.net.bw.rb +11 -0
  208. data/lib/whois/parsers/whois.nic.net.ng.rb +27 -0
  209. data/lib/whois/parsers/whois.nic.net.sa.rb +74 -0
  210. data/lib/whois/parsers/whois.nic.net.sb.rb +35 -0
  211. data/lib/whois/parsers/whois.nic.news.rb +8 -0
  212. data/lib/whois/parsers/whois.nic.nf.rb +50 -0
  213. data/lib/whois/parsers/whois.nic.ninja.rb +8 -0
  214. data/lib/whois/parsers/whois.nic.one.rb +41 -0
  215. data/lib/whois/parsers/whois.nic.online.rb +39 -0
  216. data/lib/whois/parsers/whois.nic.org.uy.rb +75 -0
  217. data/lib/whois/parsers/whois.nic.plus.rb +8 -0
  218. data/lib/whois/parsers/whois.nic.pm.rb +25 -0
  219. data/lib/whois/parsers/whois.nic.pr.rb +84 -0
  220. data/lib/whois/parsers/whois.nic.priv.at.rb +62 -0
  221. data/lib/whois/parsers/whois.nic.pub.rb +8 -0
  222. data/lib/whois/parsers/whois.nic.pw.rb +25 -0
  223. data/lib/whois/parsers/whois.nic.re.rb +29 -0
  224. data/lib/whois/parsers/whois.nic.rocks.rb +8 -0
  225. data/lib/whois/parsers/whois.nic.run.rb +8 -0
  226. data/lib/whois/parsers/whois.nic.sh.rb +25 -0
  227. data/lib/whois/parsers/whois.nic.site.rb +62 -0
  228. data/lib/whois/parsers/whois.nic.sl.rb +80 -0
  229. data/lib/whois/parsers/whois.nic.sm.rb +84 -0
  230. data/lib/whois/parsers/whois.nic.sn.rb +119 -0
  231. data/lib/whois/parsers/whois.nic.so.rb +71 -0
  232. data/lib/whois/parsers/whois.nic.software.rb +9 -0
  233. data/lib/whois/parsers/whois.nic.solutions.rb +9 -0
  234. data/lib/whois/parsers/whois.nic.space.rb +25 -0
  235. data/lib/whois/parsers/whois.nic.st.rb +76 -0
  236. data/lib/whois/parsers/whois.nic.store.rb +15 -0
  237. data/lib/whois/parsers/whois.nic.studio.rb +8 -0
  238. data/lib/whois/parsers/whois.nic.systems.rb +8 -0
  239. data/lib/whois/parsers/whois.nic.tc.rb +25 -0
  240. data/lib/whois/parsers/whois.nic.tech.rb +33 -0
  241. data/lib/whois/parsers/whois.nic.technology.rb +8 -0
  242. data/lib/whois/parsers/whois.nic.tel.rb +25 -0
  243. data/lib/whois/parsers/whois.nic.tg.rb +49 -0
  244. data/lib/whois/parsers/whois.nic.tl.rb +32 -0
  245. data/lib/whois/parsers/whois.nic.tm.rb +101 -0
  246. data/lib/whois/parsers/whois.nic.today.rb +8 -0
  247. data/lib/whois/parsers/whois.nic.tools.rb +9 -0
  248. data/lib/whois/parsers/whois.nic.tr.rb +159 -0
  249. data/lib/whois/parsers/whois.nic.travel.rb +25 -0
  250. data/lib/whois/parsers/whois.nic.tv.rb +15 -0
  251. data/lib/whois/parsers/whois.nic.uk.rb +177 -0
  252. data/lib/whois/parsers/whois.nic.us.rb +25 -0
  253. data/lib/whois/parsers/whois.nic.ve.rb +94 -0
  254. data/lib/whois/parsers/whois.nic.vg.rb +16 -0
  255. data/lib/whois/parsers/whois.nic.video.rb +10 -0
  256. data/lib/whois/parsers/whois.nic.vip.rb +13 -0
  257. data/lib/whois/parsers/whois.nic.website.rb +9 -0
  258. data/lib/whois/parsers/whois.nic.wf.rb +29 -0
  259. data/lib/whois/parsers/whois.nic.win.rb +10 -0
  260. data/lib/whois/parsers/whois.nic.work.rb +10 -0
  261. data/lib/whois/parsers/whois.nic.works.rb +8 -0
  262. data/lib/whois/parsers/whois.nic.world.rb +10 -0
  263. data/lib/whois/parsers/whois.nic.xxx.rb +42 -0
  264. data/lib/whois/parsers/whois.nic.xyz.rb +25 -0
  265. data/lib/whois/parsers/whois.nixiregistry.in.rb +15 -0
  266. data/lib/whois/parsers/whois.norid.no.rb +61 -0
  267. data/lib/whois/parsers/whois.ovh.com.rb +12 -0
  268. data/lib/whois/parsers/whois.pairnic.com.rb +28 -0
  269. data/lib/whois/parsers/whois.pandi.or.id.rb +25 -0
  270. data/lib/whois/parsers/whois.pir.org.rb +90 -0
  271. data/lib/whois/parsers/whois.pnina.ps.rb +31 -0
  272. data/lib/whois/parsers/whois.register.bg.rb +86 -0
  273. data/lib/whois/parsers/whois.register.com.rb +30 -0
  274. data/lib/whois/parsers/whois.register.si.rb +73 -0
  275. data/lib/whois/parsers/whois.registre.ma.rb +65 -0
  276. data/lib/whois/parsers/whois.registro.br.rb +126 -0
  277. data/lib/whois/parsers/whois.registry.co.rb +19 -0
  278. data/lib/whois/parsers/whois.registry.gy.rb +32 -0
  279. data/lib/whois/parsers/whois.registry.hm.rb +72 -0
  280. data/lib/whois/parsers/whois.registry.om.rb +40 -0
  281. data/lib/whois/parsers/whois.registry.qa.rb +25 -0
  282. data/lib/whois/parsers/whois.ricta.org.rw.rb +16 -0
  283. data/lib/whois/parsers/whois.ripe.net.rb +68 -0
  284. data/lib/whois/parsers/whois.rnids.rs.rb +135 -0
  285. data/lib/whois/parsers/whois.rotld.ro.rb +65 -0
  286. data/lib/whois/parsers/whois.rrpproxy.net.rb +32 -0
  287. data/lib/whois/parsers/whois.safenames.net.rb +48 -0
  288. data/lib/whois/parsers/whois.schlund.info.rb +34 -0
  289. data/lib/whois/parsers/whois.sgnic.sg.rb +92 -0
  290. data/lib/whois/parsers/whois.sk-nic.sk.rb +111 -0
  291. data/lib/whois/parsers/whois.smallregistry.net.rb +131 -0
  292. data/lib/whois/parsers/whois.srs.net.nz.rb +177 -0
  293. data/lib/whois/parsers/whois.sx.rb +127 -0
  294. data/lib/whois/parsers/whois.tcinet.ru.rb +114 -0
  295. data/lib/whois/parsers/whois.thnic.co.th.rb +80 -0
  296. data/lib/whois/parsers/whois.tld.ee.rb +134 -0
  297. data/lib/whois/parsers/whois.tld.sy.rb +34 -0
  298. data/lib/whois/parsers/whois.tonic.to.rb +100 -0
  299. data/lib/whois/parsers/whois.tonicregistry.to.rb +12 -0
  300. data/lib/whois/parsers/whois.trabis.gov.tr.rb +58 -0
  301. data/lib/whois/parsers/whois.tucows.com.rb +28 -0
  302. data/lib/whois/parsers/whois.twnic.net.tw.rb +72 -0
  303. data/lib/whois/parsers/whois.tznic.or.tz.rb +36 -0
  304. data/lib/whois/parsers/whois.ua.rb +242 -0
  305. data/lib/whois/parsers/whois.udag.net.rb +28 -0
  306. data/lib/whois/parsers/whois.uniregistry.net.rb +71 -0
  307. data/lib/whois/parsers/whois.usp.ac.fj.rb +72 -0
  308. data/lib/whois/parsers/whois.verisign-grs.com.rb +49 -0
  309. data/lib/whois/parsers/whois.vunic.vu.rb +14 -0
  310. data/lib/whois/parsers/whois.website.ws.rb +79 -0
  311. data/lib/whois/parsers/whois.wildwestdomains.com.rb +37 -0
  312. data/lib/whois/parsers/whois.yoursrs.com.rb +125 -0
  313. data/lib/whois/parsers/whois.za.net.rb +72 -0
  314. data/lib/whois/parsers/whois.za.org.rb +72 -0
  315. data/lib/whois/parsers/whois.zicta.zm.rb +13 -0
  316. data/lib/whois/parsers/whois1.nic.bi.rb +25 -0
  317. data/lib/whois/parsers/za_central_registry.rb +80 -0
  318. data/lib/whois/parsers.rb +1 -0
  319. data/lib/whois/safe_record.rb +170 -0
  320. data/lib/whois/scanners/base.rb +114 -0
  321. data/lib/whois/scanners/base_afilias.rb +51 -0
  322. data/lib/whois/scanners/base_cocca2.rb +58 -0
  323. data/lib/whois/scanners/base_icann_compliant.rb +45 -0
  324. data/lib/whois/scanners/base_iisse.rb +36 -0
  325. data/lib/whois/scanners/base_shared1.rb +31 -0
  326. data/lib/whois/scanners/base_shared2.rb +35 -0
  327. data/lib/whois/scanners/base_shared3.rb +37 -0
  328. data/lib/whois/scanners/base_whoisd.rb +44 -0
  329. data/lib/whois/scanners/iana.rb +89 -0
  330. data/lib/whois/scanners/scannable.rb +65 -0
  331. data/lib/whois/scanners/verisign.rb +100 -0
  332. data/lib/whois/scanners/whois.ati.tn.rb +32 -0
  333. data/lib/whois/scanners/whois.audns.net.au.rb +32 -0
  334. data/lib/whois/scanners/whois.cctld.by.rb +35 -0
  335. data/lib/whois/scanners/whois.centralnic.com.rb +32 -0
  336. data/lib/whois/scanners/whois.cira.ca.rb +72 -0
  337. data/lib/whois/scanners/whois.cnnic.cn.rb +42 -0
  338. data/lib/whois/scanners/whois.denic.de.rb +103 -0
  339. data/lib/whois/scanners/whois.dns.hr.rb +30 -0
  340. data/lib/whois/scanners/whois.domainregistry.ie.rb +51 -0
  341. data/lib/whois/scanners/whois.fi.rb +66 -0
  342. data/lib/whois/scanners/whois.nc.rb +32 -0
  343. data/lib/whois/scanners/whois.nic.cz.rb +22 -0
  344. data/lib/whois/scanners/whois.nic.it.rb +92 -0
  345. data/lib/whois/scanners/whois.pir.org.rb +17 -0
  346. data/lib/whois/scanners/whois.rnids.rs.rb +52 -0
  347. data/lib/whois/scanners/whois.smallregistry.net.rb +50 -0
  348. data/lib/whois/scanners/whois.srs.net.nz.rb +23 -0
  349. data/lib/whois/scanners/whois.sx.rb +37 -0
  350. data/lib/whois/scanners/whois.tld.ee.rb +47 -0
  351. data/lib/whois/scanners/whois.tucows.com.rb +23 -0
  352. data/lib/whois/scanners/whois.yoursrs.com.rb +24 -0
  353. data/lib/whois-parser.rb +10 -0
  354. metadata +507 -0
@@ -0,0 +1,24 @@
1
+ require 'whois'
2
+
3
+
4
+ module Whois
5
+ class ParserExtensions
6
+
7
+ module WhoisParser
8
+
9
+ # Lazy-loads and returns the parser proxy for current record.
10
+ #
11
+ # @return [Whois::Record::Parser]
12
+ def parser
13
+ @parser ||= Parser.new(self)
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
20
+
21
+
22
+ Whois::Record.class_eval do
23
+ include Whois::ParserExtensions::WhoisParser
24
+ end
@@ -0,0 +1,236 @@
1
+ require 'whois'
2
+
3
+
4
+ module Whois
5
+ class ParserExtensions
6
+
7
+ module WhoisRecord
8
+ def self.included(base)
9
+ base.extend ClassMethods
10
+ end
11
+
12
+ # Checks if this class respond to given method.
13
+ #
14
+ # Overrides the default implementation to add support
15
+ # for {Parser::PROPERTIES} and {Parser::METHODS}.
16
+ #
17
+ # @return [Boolean]
18
+ def respond_to_missing?(symbol, include_private = false)
19
+ respond_to_parser_method?(symbol) || super
20
+ end
21
+
22
+
23
+ # Lazy-loads and returns the parser proxy for current record.
24
+ #
25
+ # @return [Whois::Record::Parser]
26
+ def parser
27
+ @parser ||= Parser.new(self)
28
+ end
29
+
30
+ # Returns a Hash containing all supported properties for this record
31
+ # along with corresponding values.
32
+ #
33
+ # @return [{ Symbol => Object }]
34
+ # @raise [Whois::AttributeNotSupported, Whois::AttributeNotImplemented]
35
+ def properties
36
+ warn("#{self.class}#properties is deprecated")
37
+ hash = {}
38
+ Parser::PROPERTIES.each { |property| hash[property] = send(property) }
39
+ hash
40
+ end
41
+
42
+ # Shortcut for <tt>#registrant_contacts.first</tt>.
43
+ #
44
+ # @see Whois::Record#registrant_contacts
45
+ #
46
+ # @return [Whois::Record::Contact]
47
+ # If the property is supported and a contact exists.
48
+ # @return [nil]
49
+ # If the the contact doesn't exist.
50
+ # @raise [Whois::AttributeNotSupported, Whois::AttributeNotImplemented]
51
+ def registrant_contact
52
+ parser.registrant_contacts.first
53
+ end
54
+
55
+ # Shortcut for <tt>#admin_contacts.first</tt>.
56
+ #
57
+ # @see Whois::Record#admin_contacts
58
+ #
59
+ # @return [Whois::Record::Contact]
60
+ # If the property is supported and a contact exists.
61
+ # @return [nil]
62
+ # If the contact doesn't exist.
63
+ # @raise [Whois::AttributeNotSupported, Whois::AttributeNotImplemented]
64
+ def admin_contact
65
+ parser.admin_contacts.first
66
+ end
67
+
68
+ # Shortcut for <tt>#technical_contacts.first</tt>.
69
+ #
70
+ # @see Whois::Record#technical_contacts
71
+ #
72
+ # @return [Whois::Record::Contact]
73
+ # If the property is supported and a contact exists.
74
+ # @return [nil]
75
+ # If the contact doesn't exist.
76
+ # @raise [Whois::AttributeNotSupported, Whois::AttributeNotImplemented]
77
+ def technical_contact
78
+ parser.technical_contacts.first
79
+ end
80
+
81
+ # Collects and returns all the contacts.
82
+ #
83
+ # @see Whois::Parser#contacts
84
+ #
85
+ # @return [Array<Whois::Record::Contact>]
86
+ def contacts
87
+ warn("#{self.class}#contacts is deprecated")
88
+ parser.contacts
89
+ end
90
+
91
+
92
+ # Checks whether this {Whois::Record} is different than +other+.
93
+ #
94
+ # Comparing the {Whois::Record} content is not as trivial as you may think.
95
+ # WHOIS servers can inject into the WHOIS response strings that changes at every request,
96
+ # such as the timestamp the request was generated or the number of requests left
97
+ # for your current IP.
98
+ #
99
+ # These strings causes a simple equal comparison to fail even if
100
+ # the registry data is the same.
101
+ #
102
+ # This method should provide a bulletproof way to detect whether this record
103
+ # changed compared with +other+.
104
+ #
105
+ # @see Whois::Parser#changed?
106
+ #
107
+ # @param [Whois::Record] other The other record instance to compare.
108
+ # @return [Boolean]
109
+ def changed?(other)
110
+ !unchanged?(other)
111
+ end
112
+
113
+ # The opposite of {#changed?}.
114
+ #
115
+ # @see Whois::Parser#unchanged?
116
+ #
117
+ # @param [Whois::Record] other The other record instance to compare.
118
+ # @return [Boolean]
119
+ def unchanged?(other)
120
+ unless other.is_a?(self.class)
121
+ raise(ArgumentError, "Can't compare `#{self.class}' with `#{other.class}'")
122
+ end
123
+
124
+ equal?(other) || parser.unchanged?(other.parser)
125
+ end
126
+
127
+ # Checks whether this is an incomplete response.
128
+ #
129
+ # @deprecated
130
+ # @see Whois::Parser#response_incomplete?
131
+ #
132
+ # @return [Boolean]
133
+ def response_incomplete?
134
+ warn("#{self.class}#response_incomplete? is deprecated. Use parser.response_incomplete?")
135
+ parser.response_incomplete?
136
+ end
137
+
138
+ # Checks whether this is a throttle response.
139
+ #
140
+ # @deprecated
141
+ # @see Whois::Parser#response_throttled?
142
+ #
143
+ # @return [Boolean]
144
+ def response_throttled?
145
+ warn("#{self.class}#response_throttled? is deprecated. Use parser.response_throttled?")
146
+ parser.response_throttled?
147
+ end
148
+
149
+ # Checks whether this is an unavailable response.
150
+ #
151
+ # @deprecated
152
+ # @see Whois::Parser#response_unavailable?
153
+ #
154
+ # @return [Boolean]
155
+ def response_unavailable?
156
+ warn("#{self.class}#response_unavailable? is deprecated. Use parser.response_unavailable?")
157
+ parser.response_unavailable?
158
+ end
159
+
160
+
161
+ # @deprecated
162
+ def property_any_supported?(property)
163
+ warn("#{self.class}#property_any_supported? is deprecated and has no effect. Use Whois::Parser.property_any_supported? if you need it.")
164
+ end
165
+
166
+
167
+ private
168
+
169
+ # @api private
170
+ def respond_to_parser_method?(symbol)
171
+ Parser::PROPERTIES.include?(symbol) ||
172
+ Parser::METHODS.include?(symbol) ||
173
+ respond_to_question_method?(symbol)
174
+ end
175
+
176
+ def respond_to_question_method?(symbol)
177
+ return false unless symbol.to_s =~ /([a-z_]+)\?/
178
+
179
+ symbol = ::Regexp.last_match(1).to_sym
180
+ Parser::PROPERTIES.include?(symbol) ||
181
+ Parser::METHODS.include?(symbol)
182
+ end
183
+
184
+ # Delegates all method calls to the internal parser.
185
+ def method_missing(method, *args, &block)
186
+ if Parser::PROPERTIES.include?(method)
187
+ self.class.define_property_method(method)
188
+ send(method, *args, &block)
189
+ elsif Parser::METHODS.include?(method)
190
+ self.class.define_method_method(method)
191
+ send(method, *args, &block)
192
+ elsif method.to_s =~ /([a-z_]+)\?/ and (Parser::PROPERTIES + Parser::METHODS).include?(::Regexp.last_match(1).to_sym)
193
+ self.class.define_question_method(::Regexp.last_match(1))
194
+ send(method)
195
+ else
196
+ super
197
+ end
198
+ end
199
+
200
+ module ClassMethods
201
+ # @api private
202
+ def define_property_method(method)
203
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
204
+ def #{method}(*args, &block)
205
+ parser.#{method}(*args, &block)
206
+ end
207
+ RUBY
208
+ end
209
+
210
+ # @api private
211
+ def define_method_method(method)
212
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
213
+ def #{method}(*args, &block)
214
+ parser.#{method}(*args, &block)
215
+ end
216
+ RUBY
217
+ end
218
+
219
+ # @api private
220
+ def define_question_method(method)
221
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
222
+ def #{method}?
223
+ !#{method}.nil?
224
+ end
225
+ RUBY
226
+ end
227
+ end
228
+ end
229
+
230
+ end
231
+ end
232
+
233
+
234
+ Whois::Record.class_eval do
235
+ include Whois::ParserExtensions::WhoisRecord
236
+ end
@@ -0,0 +1,3 @@
1
+ require_relative 'parser_extensions/whois'
2
+ require_relative 'parser_extensions/whois_parser'
3
+ require_relative 'parser_extensions/whois_record'
@@ -0,0 +1,413 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'time'
11
+ require_relative '../parser/contact'
12
+ require_relative '../parser/registrar'
13
+ require_relative '../parser/nameserver'
14
+ require_relative '../scanners/scannable'
15
+
16
+
17
+ module Whois
18
+ class Parsers
19
+
20
+ # Represents the abstract base parser class for all
21
+ # server-specific parser implementations.
22
+ #
23
+ # NOTE. This class is for the most part auto-generated via meta programming.
24
+ # This is the reason why RDoc can't detect and document all available methods.
25
+ #
26
+ # @abstract
27
+ #
28
+ class Base
29
+
30
+ class_attribute :_properties
31
+ self._properties = {}
32
+
33
+ # Returns the status for the +property+ passed as symbol.
34
+ #
35
+ # @param [Symbol] property
36
+ # @return [Symbol, nil]
37
+ #
38
+ # @example Undefined property
39
+ # property_state(:disclaimer)
40
+ # # => nil
41
+ #
42
+ # @example Defined property
43
+ # property_register(:disclaimer, Parser::PROPERTY_STATE_SUPPORTED) {}
44
+ # property_state(:disclaimer)
45
+ # # => :supported
46
+ #
47
+ def self.property_state(property)
48
+ _properties[property]
49
+ end
50
+
51
+ # Check if the +property+ passed as symbol
52
+ # is registered in the registry for current parser.
53
+ #
54
+ # @param [Symbol] property
55
+ # @param [Symbol] status
56
+ # @return [Boolean]
57
+ #
58
+ # @example Not-registered property
59
+ # property_state?(:disclaimer)
60
+ # # => false
61
+ #
62
+ # @example Registered property
63
+ # property_register(:disclaimer) {}
64
+ # property_state?(:disclaimer)
65
+ # # => true
66
+ #
67
+ def self.property_state?(property, status = :any)
68
+ if status == :any
69
+ _properties.key?(property)
70
+ else
71
+ _properties[property] == status
72
+ end
73
+ end
74
+
75
+ # Registers a <tt>property</tt> in the registry.
76
+ #
77
+ # @param [Symbol] property
78
+ # @param [Symbol] status
79
+ #
80
+ # @return [void]
81
+ #
82
+ def self.property_register(property, status)
83
+ self._properties = _properties.merge({ property => status })
84
+ end
85
+
86
+
87
+ # Registers a <tt>property</tt> as "not implemented"
88
+ # and defines the corresponding private _property_PROPERTY method.
89
+ #
90
+ # A "not implemented" property always raises a <tt>AttributeNotImplemented</tt> error
91
+ # when the property method is called.
92
+ #
93
+ # @param [Symbol] property
94
+ # @return [void]
95
+ #
96
+ # @example Defining a not implemented property
97
+ # # Defines a not implemented property called :disclaimer.
98
+ # property_not_implemented(:disclaimer)
99
+ #
100
+ def self.property_not_implemented(property)
101
+ property_register(property, Parser::PROPERTY_STATE_NOT_IMPLEMENTED)
102
+
103
+ class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
104
+ def _property_#{property}(*args)
105
+ raise AttributeNotImplemented
106
+ end
107
+
108
+ private :_property_#{property}
109
+ RUBY
110
+ end
111
+
112
+ # Registers a <tt>property</tt> as "not supported"
113
+ # and defines the corresponding private _property_PROPERTY method.
114
+ #
115
+ # A "not supported" property always raises a <tt>AttributeNotSupported</tt> error
116
+ # when the property method is called.
117
+ #
118
+ # @param [Symbol] property
119
+ # @return [void]
120
+ #
121
+ # @example Defining an unsupported property
122
+ # # Defines an unsupported property called :disclaimer.
123
+ # property_not_supported(:disclaimer)
124
+ #
125
+ def self.property_not_supported(property)
126
+ property_register(property, Parser::PROPERTY_STATE_NOT_SUPPORTED)
127
+
128
+ class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
129
+ def _property_#{property}(*args)
130
+ raise AttributeNotSupported
131
+ end
132
+
133
+ private :_property_#{property}
134
+ RUBY
135
+ end
136
+
137
+ # Registers a <tt>property</tt> as "supported"
138
+ # and defines the corresponding private _property_PROPERTY method.
139
+ #
140
+ # @param [Symbol] property
141
+ # @return [void]
142
+ #
143
+ # @example Defining a supported property
144
+ # # Defines a supported property called :disclaimer.
145
+ # property_supported(:disclaimer) do
146
+ # ...
147
+ # end
148
+ #
149
+ def self.property_supported(property, &block)
150
+ property_register(property, Parser::PROPERTY_STATE_SUPPORTED)
151
+
152
+ define_method("_property_#{property}", &block)
153
+ private :"_property_#{property}"
154
+ end
155
+
156
+ # Checks if the <tt>property</tt> passed as symbol
157
+ # is supported by the current parser.
158
+ #
159
+ # @param [Symbol] property The name of the property to check.
160
+ # @return [Boolean]
161
+ #
162
+ def property_supported?(property)
163
+ self.class.property_state?(property, Parser::PROPERTY_STATE_SUPPORTED)
164
+ end
165
+
166
+ # Parses a timestamp, returning nil for invalid input
167
+ #
168
+ # @param [String] timestamp The timestamp to parse
169
+ # @return [Nil] if the timestamp can't be parsed
170
+ # @return [Time]
171
+ #
172
+ def self.parse_time(timestamp)
173
+ return unless timestamp.is_a?(String) && !timestamp.empty?
174
+
175
+ Time.parse(timestamp).change(usec: 0)
176
+ rescue ArgumentError
177
+ nil
178
+ end
179
+
180
+ # @return [Whois::Record::Part] The part referenced by this parser.
181
+ attr_reader :part
182
+
183
+ # Initializes a new parser with given +part+.
184
+ #
185
+ # @param [Whois::Record::Part] part
186
+ #
187
+ def initialize(part)
188
+ @part = part
189
+ @cached_properties = {}
190
+ end
191
+
192
+
193
+ # This is an internal method primary used as a common access point
194
+ # to get the content to be parsed as a string.
195
+ #
196
+ # The main reason behind this method is because, in the past,
197
+ # the internal representation of the data to be parsed changed
198
+ # several times, and I always had to rewrite all single parsers
199
+ # in order to reflect these changes.
200
+ # Now, as far as the parser access the data via the content method,
201
+ # there's no need to change each single implementation
202
+ # in case the content source changes.
203
+ #
204
+ # That said, the only constraints about this method
205
+ # is to return the data to be parsed as string.
206
+ #
207
+ # @return [String] The part body.
208
+ def content
209
+ part.body
210
+ end
211
+
212
+ # Check if the parser respond to +symbol+
213
+ # and calls the method if defined.
214
+ # The method referenced by the +symbol+
215
+ # is supposed to be a question? method and to return a boolean.
216
+ #
217
+ # @param [Symbol] symbol
218
+ # @return [Boolean]
219
+ #
220
+ # @example
221
+ # is(:response_throttled?)
222
+ # # => true
223
+ #
224
+ # @api private
225
+ def is(symbol)
226
+ respond_to?(symbol) && send(symbol)
227
+ end
228
+
229
+ # @api private
230
+ def validate!
231
+ raise ResponseIsThrottled if is(:response_throttled?)
232
+ raise ResponseIsUnavailable if is(:response_unavailable?)
233
+ end
234
+
235
+
236
+ # @!group Properties
237
+
238
+ Parser::PROPERTIES.each do |property|
239
+ class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
240
+ def #{property}(*args)
241
+ handle_property(:#{property}, *args)
242
+ end
243
+ RUBY
244
+
245
+ property_not_implemented(property)
246
+ end
247
+
248
+ # @!endgroup
249
+
250
+
251
+ # @!group Methods
252
+
253
+ # Collects and returns all the available contacts.
254
+ #
255
+ # @return [Array<Parser::Contact>]
256
+ #
257
+ # @see Whois::Record#contacts
258
+ # @see Whois::Parser#contacts
259
+ #
260
+ def contacts
261
+ [:registrant_contacts, :admin_contacts, :technical_contacts].inject([]) do |contacts, property|
262
+ contacts += send(property) if property_supported?(property)
263
+ contacts
264
+ end
265
+ end
266
+
267
+ # @!endgroup
268
+
269
+
270
+ # @!group Response
271
+
272
+ # Checks whether the content of this part is different than +other+.
273
+ #
274
+ # Comparing a WHOIS response is not as trivial as you may think.
275
+ # WHOIS servers can inject into the WHOIS response strings
276
+ # that changes at every request, such as the timestamp the request
277
+ # was generated or the number of requests left for your current IP.
278
+ #
279
+ # These strings causes a simple equal comparison to fail even if
280
+ # the registry data is the same.
281
+ #
282
+ # This method should provide a bulletproof way to detect
283
+ # whether this record changed compared with +other+.
284
+ #
285
+ # @param [Base] other The other parser instance to compare.
286
+ # @return [Boolean]
287
+ #
288
+ # @see Whois::Record#changed?
289
+ # @see Whois::Parser#changed?
290
+ #
291
+ def changed?(other)
292
+ !unchanged?(other)
293
+ end
294
+
295
+ # The opposite of {#changed?}.
296
+ #
297
+ # @param [Base] other The other parser instance to compare.
298
+ # @return [Boolean]
299
+ #
300
+ # @see Whois::Record#unchanged?
301
+ # @see Whois::Parser#unchanged?
302
+ #
303
+ def unchanged?(other)
304
+ unless other.is_a?(self.class)
305
+ raise(ArgumentError, "Can't compare `#{self.class}' with `#{other.class}'")
306
+ end
307
+
308
+ equal?(other) ||
309
+ content_for_scanner == other.content_for_scanner
310
+ end
311
+
312
+
313
+ # Checks whether this is an incomplete response.
314
+ #
315
+ # @return [Boolean]
316
+ #
317
+ # @abstract This method is just a stub.
318
+ # Define it in your parser class.
319
+ #
320
+ # @see Whois::Record#response_incomplete?
321
+ # @see Whois::Parser#response_incomplete?
322
+ #
323
+ def response_incomplete?
324
+ end
325
+
326
+ # Checks whether this is a throttle response.
327
+ #
328
+ # @return [Boolean]
329
+ #
330
+ # @abstract This method is just a stub.
331
+ # Define it in your parser class.
332
+ #
333
+ # @see Whois::Record#response_throttled?
334
+ # @see Whois::Parser#response_throttled?
335
+ #
336
+ def response_throttled?
337
+ end
338
+
339
+ # Checks whether this response contains a message
340
+ # that can be reconducted to a "WHOIS Server Unavailable" status.
341
+ #
342
+ # Some WHOIS servers returns error messages
343
+ # when they are experiencing failures.
344
+ #
345
+ # @return [Boolean]
346
+ #
347
+ # @abstract This method is just a stub.
348
+ # Define it in your parser class.
349
+ #
350
+ # @see Whois::Record#response_unavailable?
351
+ # @see Whois::Parser#response_unavailable?
352
+ #
353
+ def response_unavailable?
354
+ end
355
+
356
+ # Let them be documented
357
+ undef response_incomplete?
358
+ undef response_throttled?
359
+ undef response_unavailable?
360
+
361
+ # @!endgroup
362
+
363
+
364
+ protected
365
+
366
+ def content_for_scanner
367
+ @content_for_scanner ||= content.to_s.gsub(/\r\n/, "\n")
368
+ end
369
+
370
+ def cached_properties_fetch(key)
371
+ if !@cached_properties.key?(key)
372
+ @cached_properties[key] = yield
373
+ end
374
+ @cached_properties[key]
375
+ end
376
+
377
+
378
+ private
379
+
380
+ def typecast(value, type)
381
+ if Array == type
382
+ Array.wrap(value)
383
+ else
384
+ value
385
+ end
386
+ end
387
+
388
+ def parse_time(timestamp)
389
+ self.class.parse_time(timestamp)
390
+ end
391
+
392
+ def handle_property(property, *args)
393
+ unless property_supported?(property)
394
+ return send(:"_property_#{property}", *args)
395
+ end
396
+
397
+ cached_properties_fetch(property) do
398
+ validate!
399
+ value = send(:"_property_#{property}", *args)
400
+
401
+ case property.to_s
402
+ when /_contacts$/, "nameservers"
403
+ typecast(value, Array)
404
+ else
405
+ value
406
+ end
407
+ end
408
+ end
409
+
410
+ end
411
+
412
+ end
413
+ end