reverse 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a7b405c1ebc765561b3bd4f01db0de451ee0370
4
- data.tar.gz: 7d9d88193d049558b5084cfb7e3255734c8b6e55
3
+ metadata.gz: 95405c98fececff54a8c99f2d60aab1c2568bd87
4
+ data.tar.gz: 5656c14a4ec211420f1b728ceda32bb5d96796ad
5
5
  SHA512:
6
- metadata.gz: 9a609f2b57f51601b91a175aedac2cb965fdce2aef803275a1b24100536272eeb9f36ddcd3e8e8adcff5cbc3d10c6de8a3b8a0aeb82e9dec7c83e342cd0b52d3
7
- data.tar.gz: 99caa700335411e58ad14a008eeac55c529ea69e8f669c284559557ef1e0dd3205b3141cc1514b6e89bf688344cc4a5e4ecd8c9b1718ae25f81b12bda407d50f
6
+ metadata.gz: 955796e233526ebc4042e7a90fa54b3e5aac2127b8463055483de71cf69f6c660af1c02a5ef8dc9c53a1347f2acec33200db659317577e8acad8f18d45023ffd
7
+ data.tar.gz: 73d6652f60fbe2fb21ed0cda26972d89491666382043597ac456ffeff2ce99a12bf628f0dbe3a22e71126639594abc0870d95600a0e270312a440ac090d3f9bb
@@ -1,11 +1,13 @@
1
1
  require "reverse/version"
2
2
  require "socket"
3
3
  require "term/ansicolor"
4
+ require "resolv"
4
5
 
5
6
  class Reverse
6
7
  ADDR_REG_EXP = /\b((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\b/
7
8
 
8
9
  def initialize
10
+ @resolv = Resolv::DNS.new(nameserver: ["8.8.8.8", "8.8.4.4"], ndots: 1)
9
11
  @list = {}
10
12
  Signal.trap(:INT){ exit(0) }
11
13
  end
@@ -39,8 +41,11 @@ class Reverse
39
41
  end
40
42
 
41
43
  def get_name(addr)
42
- info = Socket.getnameinfo(Socket.sockaddr_in("80", addr))
43
- info[0]
44
+ begin
45
+ @resolv.getname(addr).to_s
46
+ rescue Resolv::ResolvError => e
47
+ addr
48
+ end
44
49
  end
45
50
 
46
51
  end
@@ -1,3 +1,3 @@
1
1
  class Reverse
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reverse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Kurokawa