reverse 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -10
- data/lib/reverse.rb +20 -12
- data/lib/reverse/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4aaeca93b8dc60ada1a354e9f859d663b0f4068
|
4
|
+
data.tar.gz: c9c63f5ee17c81b752219ba0907449349a15ac7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 450c244f6da36ef92f6fb66b67f0b6cd8b008b6c400982d6ad1adf9cd5eabbdad0b3aef82858285788e068ebfaeccb898c2d536776b8742d0648fba3dd8d7023
|
7
|
+
data.tar.gz: bcb8f3a9c5df489402309699e6ed0600d8aca911bfbcc8b4571b3b185b5ae0f7617e4b08a00f52cd673ecce2ae0295a2756928dabe06de2dc24bee7d4c53f2e1
|
data/README.md
CHANGED
data/lib/reverse.rb
CHANGED
@@ -7,28 +7,36 @@ class Reverse
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
@list = {}
|
10
|
+
Signal.trap(:INT){ exit(0) }
|
10
11
|
end
|
11
12
|
|
12
13
|
def exec
|
13
14
|
while line = gets
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
else
|
20
|
-
name = get_name(addr)
|
21
|
-
@list[addr] = name
|
22
|
-
end
|
23
|
-
name
|
15
|
+
output =
|
16
|
+
if line =~ ADDR_REG_EXP
|
17
|
+
replace_addr(line)
|
18
|
+
else
|
19
|
+
line
|
24
20
|
end
|
25
|
-
|
26
|
-
end
|
21
|
+
print output
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
30
25
|
private
|
31
26
|
|
27
|
+
def replace_addr(line)
|
28
|
+
line.gsub(ADDR_REG_EXP) do |addr|
|
29
|
+
name = nil
|
30
|
+
if @list[addr]
|
31
|
+
name = @list[addr]
|
32
|
+
else
|
33
|
+
name = get_name(addr)
|
34
|
+
@list[addr] = name
|
35
|
+
end
|
36
|
+
name
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
def get_name(addr)
|
33
41
|
info = Socket.getnameinfo(Socket.sockaddr_in('80', addr))
|
34
42
|
info[0]
|
data/lib/reverse/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hitoshi Kurokawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: reverse DNS lookup CLU for standard output
|
@@ -46,7 +46,7 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -65,17 +65,17 @@ require_paths:
|
|
65
65
|
- lib
|
66
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.0
|
78
|
+
rubygems_version: 2.2.0
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: reverse DNS lookup CLU for standard output
|