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 +4 -4
- data/lib/reverse.rb +7 -2
- data/lib/reverse/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95405c98fececff54a8c99f2d60aab1c2568bd87
|
4
|
+
data.tar.gz: 5656c14a4ec211420f1b728ceda32bb5d96796ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 955796e233526ebc4042e7a90fa54b3e5aac2127b8463055483de71cf69f6c660af1c02a5ef8dc9c53a1347f2acec33200db659317577e8acad8f18d45023ffd
|
7
|
+
data.tar.gz: 73d6652f60fbe2fb21ed0cda26972d89491666382043597ac456ffeff2ce99a12bf628f0dbe3a22e71126639594abc0870d95600a0e270312a440ac090d3f9bb
|
data/lib/reverse.rb
CHANGED
@@ -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
|
-
|
43
|
-
|
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
|
data/lib/reverse/version.rb
CHANGED