ruby-nmap 0.9.3 → 1.0.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 (107) hide show
  1. checksums.yaml +5 -5
  2. data/.document +1 -0
  3. data/.editorconfig +11 -0
  4. data/.github/workflows/ruby.yml +31 -0
  5. data/ChangeLog.md +122 -67
  6. data/Gemfile +11 -5
  7. data/LICENSE.txt +1 -1
  8. data/README.md +88 -50
  9. data/Rakefile +8 -3
  10. data/UPGRADING.md +47 -0
  11. data/gemspec.yml +6 -6
  12. data/lib/nmap/command.rb +765 -0
  13. data/lib/nmap/version.rb +1 -1
  14. data/lib/nmap/xml/address.rb +38 -0
  15. data/lib/nmap/xml/cpe/url.rb +80 -0
  16. data/lib/nmap/xml/cpe.rb +47 -0
  17. data/lib/nmap/xml/hop.rb +22 -0
  18. data/lib/nmap/xml/host.rb +546 -0
  19. data/lib/nmap/xml/host_script.rb +26 -0
  20. data/lib/nmap/xml/hostname.rb +44 -0
  21. data/lib/nmap/xml/ip_id_sequence.rb +26 -0
  22. data/lib/nmap/xml/os.rb +131 -0
  23. data/lib/nmap/xml/os_class.rb +86 -0
  24. data/lib/nmap/xml/os_match.rb +22 -0
  25. data/lib/nmap/xml/port.rb +114 -0
  26. data/lib/nmap/xml/postscript.rb +26 -0
  27. data/lib/nmap/xml/prescript.rb +26 -0
  28. data/lib/nmap/xml/run_stat.rb +22 -0
  29. data/lib/nmap/xml/scan.rb +38 -0
  30. data/lib/nmap/xml/scan_task.rb +55 -0
  31. data/lib/nmap/xml/scanner.rb +22 -0
  32. data/lib/nmap/xml/script.rb +110 -0
  33. data/lib/nmap/xml/scripts.rb +33 -0
  34. data/lib/nmap/xml/sequence.rb +52 -0
  35. data/lib/nmap/xml/service.rb +172 -0
  36. data/lib/nmap/xml/status.rb +22 -0
  37. data/lib/nmap/xml/tcp_sequence.rb +48 -0
  38. data/lib/nmap/xml/tcp_ts_sequence.rb +26 -0
  39. data/lib/nmap/xml/traceroute.rb +73 -0
  40. data/lib/nmap/xml/uptime.rb +22 -0
  41. data/lib/nmap/xml.rb +46 -44
  42. data/ruby-nmap.gemspec +38 -83
  43. data/spec/command_spec.rb +726 -0
  44. data/spec/fixtures/down_host_scan.xml +16 -0
  45. data/spec/{local_scan.xml → fixtures/local_scan.xml} +1 -1
  46. data/spec/{scan.xml → fixtures/scan.xml} +1 -1
  47. data/spec/spec_helper.rb +2 -2
  48. data/spec/{address_spec.rb → xml/address_spec.rb} +2 -2
  49. data/spec/{cpe → xml/cpe}/url_spec.rb +1 -1
  50. data/spec/{cpe_examples.rb → xml/cpe_examples.rb} +1 -1
  51. data/spec/{hop_spec.rb → xml/hop_spec.rb} +2 -2
  52. data/spec/{host_script_spec.rb → xml/host_script_spec.rb} +2 -2
  53. data/spec/{host_spec.rb → xml/host_spec.rb} +12 -8
  54. data/spec/{hostname_spec.rb → xml/hostname_spec.rb} +2 -2
  55. data/spec/{ip_id_sequence_spec.rb → xml/ip_id_sequence_spec.rb} +3 -3
  56. data/spec/{os_class_spec.rb → xml/os_class_spec.rb} +3 -3
  57. data/spec/{os_match_spec.rb → xml/os_match_spec.rb} +2 -2
  58. data/spec/{os_spec.rb → xml/os_spec.rb} +3 -3
  59. data/spec/{port_spec.rb → xml/port_spec.rb} +10 -5
  60. data/spec/{postscript_spec.rb → xml/postscript_spec.rb} +2 -2
  61. data/spec/{prescript_spec.rb → xml/prescript_spec.rb} +2 -2
  62. data/spec/{run_stat_spec.rb → xml/run_stat_spec.rb} +2 -2
  63. data/spec/{scan_spec.rb → xml/scan_spec.rb} +2 -2
  64. data/spec/{scan_task_spec.rb → xml/scan_task_spec.rb} +6 -6
  65. data/spec/{scanner_spec.rb → xml/scanner_spec.rb} +3 -3
  66. data/spec/xml/script_spec.rb +137 -0
  67. data/spec/xml/scripts_examples.rb +19 -0
  68. data/spec/{sequence_examples.rb → xml/sequence_examples.rb} +1 -0
  69. data/spec/{service_spec.rb → xml/service_spec.rb} +31 -5
  70. data/spec/{status_spec.rb → xml/status_spec.rb} +4 -3
  71. data/spec/{tcp_sequence_spec.rb → xml/tcp_sequence_spec.rb} +3 -3
  72. data/spec/{tcp_ts_sequence_spec.rb → xml/tcp_ts_sequence_spec.rb} +3 -3
  73. data/spec/{traceroute_spec.rb → xml/traceroute_spec.rb} +3 -3
  74. data/spec/{uptime_spec.rb → xml/uptime_spec.rb} +2 -2
  75. data/spec/xml_spec.rb +93 -45
  76. metadata +78 -99
  77. data/.travis.yml +0 -14
  78. data/lib/nmap/address.rb +0 -34
  79. data/lib/nmap/cpe/url.rb +0 -78
  80. data/lib/nmap/cpe.rb +0 -45
  81. data/lib/nmap/hop.rb +0 -20
  82. data/lib/nmap/host.rb +0 -586
  83. data/lib/nmap/host_script.rb +0 -18
  84. data/lib/nmap/hostname.rb +0 -42
  85. data/lib/nmap/ip_id_sequence.rb +0 -24
  86. data/lib/nmap/os.rb +0 -127
  87. data/lib/nmap/os_class.rb +0 -82
  88. data/lib/nmap/os_match.rb +0 -18
  89. data/lib/nmap/port.rb +0 -99
  90. data/lib/nmap/postscript.rb +0 -16
  91. data/lib/nmap/prescript.rb +0 -16
  92. data/lib/nmap/program.rb +0 -102
  93. data/lib/nmap/run_stat.rb +0 -20
  94. data/lib/nmap/scan.rb +0 -34
  95. data/lib/nmap/scan_task.rb +0 -50
  96. data/lib/nmap/scanner.rb +0 -18
  97. data/lib/nmap/scripts.rb +0 -71
  98. data/lib/nmap/sequence.rb +0 -50
  99. data/lib/nmap/service.rb +0 -170
  100. data/lib/nmap/status.rb +0 -18
  101. data/lib/nmap/task.rb +0 -381
  102. data/lib/nmap/tcp_sequence.rb +0 -46
  103. data/lib/nmap/tcp_ts_sequence.rb +0 -22
  104. data/lib/nmap/traceroute.rb +0 -71
  105. data/lib/nmap/uptime.rb +0 -20
  106. data/spec/scripts_examples.rb +0 -35
  107. data/spec/task_spec.rb +0 -150
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
- require 'sequence_examples'
2
+ require 'xml/sequence_examples'
3
3
 
4
- require 'nmap/tcp_sequence'
4
+ require 'nmap/xml/tcp_sequence'
5
5
 
6
- describe TcpSequence do
6
+ describe Nmap::XML::TcpSequence do
7
7
  subject { @xml.hosts.first.tcp_sequence }
8
8
 
9
9
  describe "#index" do
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
- require 'sequence_examples'
2
+ require 'xml/sequence_examples'
3
3
 
4
- require 'nmap/tcp_ts_sequence'
4
+ require 'nmap/xml/tcp_ts_sequence'
5
5
 
6
- describe TcpTsSequence do
6
+ describe Nmap::XML::TcpTsSequence do
7
7
  subject { @xml.hosts.first.tcp_ts_sequence }
8
8
 
9
9
  describe "#description" do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'nmap/traceroute'
2
+ require 'nmap/xml/traceroute'
3
3
 
4
- describe Traceroute do
4
+ describe Nmap::XML::Traceroute do
5
5
  subject { @xml.hosts.first.traceroute }
6
6
 
7
7
  describe "#port" do
@@ -22,7 +22,7 @@ describe Traceroute do
22
22
  describe "#each" do
23
23
  subject { super().each.first }
24
24
 
25
- it { is_expected.to be_kind_of(Hop) }
25
+ it { is_expected.to be_kind_of(Nmap::XML::Hop) }
26
26
 
27
27
  describe '#addr' do
28
28
  subject { super().addr }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'nmap/uptime'
2
+ require 'nmap/xml/uptime'
3
3
 
4
- describe Uptime do
4
+ describe Nmap::XML::Uptime do
5
5
  describe "#to_s" do
6
6
  let(:seconds) { 920430 }
7
7
  let(:last_boot) { Time.parse("2013-07-10 08:34:03 -0700") }
data/spec/xml_spec.rb CHANGED
@@ -1,36 +1,20 @@
1
1
  require 'spec_helper'
2
2
  require 'nmap/xml'
3
3
 
4
- describe XML do
5
- let(:path) { File.expand_path('spec/scan.xml') }
4
+ describe Nmap::XML do
5
+ let(:file) { 'spec/fixtures/scan.xml' }
6
+ let(:path) { File.expand_path(file) }
7
+ let(:doc) { Nokogiri::XML(File.open(path)) }
6
8
 
7
- subject { described_class.new(path) }
9
+ subject { described_class.new(doc) }
8
10
 
9
11
  describe "#initialize" do
10
- context "when given a Nokogiri::XML::Document" do
11
- let(:document) { Nokogiri::XML(File.read(path)) }
12
-
13
- it "should use the document" do
14
- expect(described_class.new(document).version).to eq(subject.version)
15
- end
16
- end
17
-
18
- context "when given an IO object" do
19
- let(:io) { File.new(path) }
20
-
21
- it "should parse the IO object" do
22
- expect(described_class.new(io).version).to eq(subject.version)
23
- end
24
- end
25
-
26
- context "when given a String" do
27
- it "should parse the file at the path" do
28
- expect(described_class.new(path).version).to eq(subject.version)
29
- end
12
+ it "must set #doc" do
13
+ expect(described_class.new(doc).doc).to be(doc)
30
14
  end
31
15
  end
32
16
 
33
- describe "parse" do
17
+ describe ".parse" do
34
18
  let(:xml) { File.read(path) }
35
19
 
36
20
  subject { described_class.parse(xml) }
@@ -44,7 +28,7 @@ describe XML do
44
28
  end
45
29
  end
46
30
 
47
- describe "open" do
31
+ describe ".open" do
48
32
  subject { described_class.open(path) }
49
33
 
50
34
  it "should return an XML object" do
@@ -72,7 +56,7 @@ describe XML do
72
56
  end
73
57
 
74
58
  it "should parse the scanner arguments" do
75
- expect(subject.scanner.arguments).to eq('nmap -v -sS -sU -A -O --script ssh2-enum-algos,ssh-hostkey -oX spec/scan.xml scanme.nmap.org')
59
+ expect(subject.scanner.arguments).to eq("nmap -v -sS -sU -A -O --script ssh2-enum-algos,ssh-hostkey -oX #{file} scanme.nmap.org")
76
60
  end
77
61
 
78
62
  it "should parse the scanner start time" do
@@ -108,7 +92,7 @@ describe XML do
108
92
  subject { super().each_run_stat.first }
109
93
 
110
94
  it "should yield RunStat objects" do
111
- expect(subject).to be_kind_of(RunStat)
95
+ expect(subject).to be_kind_of(Nmap::XML::RunStat)
112
96
  end
113
97
 
114
98
  it "should parse the end time" do
@@ -132,7 +116,7 @@ describe XML do
132
116
  subject { super().run_stats }
133
117
 
134
118
  it { is_expected.not_to be_empty }
135
- it { is_expected.to all(be_kind_of(RunStat)) }
119
+ it { is_expected.to all(be_kind_of(Nmap::XML::RunStat)) }
136
120
  end
137
121
 
138
122
  describe "#each_task" do
@@ -152,7 +136,7 @@ describe XML do
152
136
  end
153
137
 
154
138
  it "should parse the extrainfo" do
155
- expect(subject.extrainfo).not_to be_empty
139
+ expect(subject.extra_info).not_to be_empty
156
140
  end
157
141
  end
158
142
 
@@ -160,7 +144,25 @@ describe XML do
160
144
  subject { super().tasks }
161
145
 
162
146
  it { is_expected.not_to be_empty }
163
- it { is_expected.to all(be_kind_of(ScanTask)) }
147
+ it { is_expected.to all(be_kind_of(Nmap::XML::ScanTask)) }
148
+ end
149
+
150
+ describe "#task" do
151
+ context "when the task with the given name exists" do
152
+ it "must return the matching task" do
153
+ name = "Parallel DNS resolution of 1 host."
154
+ task = subject.task(name)
155
+
156
+ expect(task).to be_kind_of(Nmap::XML::ScanTask)
157
+ expect(task.name).to be == name
158
+ end
159
+ end
160
+
161
+ context "when no task with the given name can be found" do
162
+ it "must return nil" do
163
+ expect(subject.task('Foo')).to be(nil)
164
+ end
165
+ end
164
166
  end
165
167
 
166
168
  describe "#prescript" do
@@ -179,7 +181,7 @@ describe XML do
179
181
  subject { super().each_host.first }
180
182
 
181
183
  it "should yield Host objects" do
182
- expect(subject).to be_kind_of(Host)
184
+ expect(subject).to be_kind_of(Nmap::XML::Host)
183
185
  end
184
186
  end
185
187
 
@@ -187,20 +189,62 @@ describe XML do
187
189
  subject { super().hosts }
188
190
 
189
191
  it { is_expected.not_to be_empty }
190
- it { expect(subject).to all(be_kind_of(Host)) }
192
+ it { expect(subject).to all(be_kind_of(Nmap::XML::Host)) }
191
193
  end
192
194
 
193
195
  describe "#host" do
194
196
  subject { super().host }
195
197
 
196
- it { expect(subject).to be_kind_of(Host) }
198
+ it { expect(subject).to be_kind_of(Nmap::XML::Host) }
199
+ end
200
+
201
+ describe "#each_down_host" do
202
+ let(:file) { 'spec/fixtures/down_host_scan.xml' }
203
+
204
+ context "when given a block" do
205
+ it "must yield Host objects" do
206
+ expect { |b|
207
+ subject.each_down_host(&b)
208
+ }.to yield_successive_args(Nmap::XML::Host)
209
+ end
210
+
211
+ it "status must be down" do
212
+ yielded_hosts = []
213
+
214
+ subject.each_down_host do |host|
215
+ yielded_hosts << host
216
+ end
217
+
218
+ expect(yielded_hosts).to_not be_empty
219
+ expect(yielded_hosts.map { |host| host.status.state }).to all(eq(:down))
220
+ end
221
+ end
222
+
223
+ context "when not given a block" do
224
+ it "must return an Enumerator for the method" do
225
+ expect(subject.each_down_host).to be_kind_of(Enumerator)
226
+ end
227
+ end
228
+ end
229
+
230
+ describe "#down_hosts" do
231
+ let(:file) { 'spec/fixtures/down_host_scan.xml' }
232
+
233
+ subject { super().down_hosts }
234
+
235
+ it { expect(subject).to_not be_empty }
236
+ it { expect(subject).to all(be_kind_of(Nmap::XML::Host)) }
237
+
238
+ it "should contain only up hosts" do
239
+ expect(subject.map { |host| host.status.state }).to all(eq(:down))
240
+ end
197
241
  end
198
242
 
199
243
  describe "#down_host" do
200
244
  pending "need down hosts in scan.xml" do
201
245
  subject { super().down_host }
202
246
 
203
- it { is_expected.to be_kind_of(Host) }
247
+ it { is_expected.to be_kind_of(Nmap::XML::Host) }
204
248
 
205
249
  it "should contain only up hosts" do
206
250
  expect(subject.status.state).to be(:down)
@@ -212,7 +256,7 @@ describe XML do
212
256
  subject { super().each_up_host.first }
213
257
 
214
258
  it "should yield Host objects" do
215
- expect(subject).to be_kind_of(Host)
259
+ expect(subject).to be_kind_of(Nmap::XML::Host)
216
260
  end
217
261
 
218
262
  it "should be up" do
@@ -223,18 +267,18 @@ describe XML do
223
267
  describe "#up_hosts" do
224
268
  subject { super().up_hosts }
225
269
 
226
- it { is_expected.not_to be_empty }
227
- it { is_expected.to all(be_kind_of(Host)) }
270
+ it { expect(subject).not_to be_empty }
271
+ it { expect(subject).to all(be_kind_of(Nmap::XML::Host)) }
228
272
 
229
273
  it "should contain only up hosts" do
230
- expect(subject.all? { |host| host.status.state == :up }).to be_truthy
274
+ expect(subject.map { |host| host.status.state }).to all(eq(:up))
231
275
  end
232
276
  end
233
277
 
234
278
  describe "#up_host" do
235
279
  subject { super().up_host }
236
280
 
237
- it { is_expected.to be_kind_of(Host) }
281
+ it { is_expected.to be_kind_of(Nmap::XML::Host) }
238
282
 
239
283
  it "should contain only up hosts" do
240
284
  expect(subject.status.state).to be(:up)
@@ -248,14 +292,18 @@ describe XML do
248
292
  end
249
293
 
250
294
  describe "#to_s" do
251
- it "should convert to a String" do
252
- expect(subject.to_s).to eq(path)
295
+ context "when #path is set" do
296
+ subject { described_class.new(doc, path: path) }
297
+
298
+ it "must return #path" do
299
+ expect(subject.to_s).to eq(path)
300
+ end
253
301
  end
254
- end
255
302
 
256
- describe "#inspect" do
257
- it "should include the class and path" do
258
- expect(subject.inspect).to eq("#<#{described_class}: #{path}>")
303
+ context "when #path is not set" do
304
+ it "must return the raw XML" do
305
+ expect(subject.to_s).to eq(doc.to_s)
306
+ end
259
307
  end
260
308
  end
261
309
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rprogram
28
+ name: command_mapper
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
@@ -44,15 +44,16 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
55
- description: A Ruby interface to Nmap, the exploration tool and security / port scanner.
54
+ version: '2.0'
55
+ description: A Ruby API to nmap, the exploration tool and security / port scanner.
56
+ Allows automating nmap and parsing nmap XML files.
56
57
  email: postmodern.mod3@gmail.com
57
58
  executables: []
58
59
  extensions: []
@@ -60,87 +61,92 @@ extra_rdoc_files:
60
61
  - ChangeLog.md
61
62
  - LICENSE.txt
62
63
  - README.md
64
+ - UPGRADING.md
63
65
  files:
64
66
  - ".document"
67
+ - ".editorconfig"
68
+ - ".github/workflows/ruby.yml"
65
69
  - ".gitignore"
66
70
  - ".rspec"
67
- - ".travis.yml"
68
71
  - ".yardopts"
69
72
  - ChangeLog.md
70
73
  - Gemfile
71
74
  - LICENSE.txt
72
75
  - README.md
73
76
  - Rakefile
77
+ - UPGRADING.md
74
78
  - gemspec.yml
75
79
  - lib/nmap.rb
76
- - lib/nmap/address.rb
77
- - lib/nmap/cpe.rb
78
- - lib/nmap/cpe/url.rb
79
- - lib/nmap/hop.rb
80
- - lib/nmap/host.rb
81
- - lib/nmap/host_script.rb
82
- - lib/nmap/hostname.rb
83
- - lib/nmap/ip_id_sequence.rb
84
- - lib/nmap/os.rb
85
- - lib/nmap/os_class.rb
86
- - lib/nmap/os_match.rb
87
- - lib/nmap/port.rb
88
- - lib/nmap/postscript.rb
89
- - lib/nmap/prescript.rb
90
- - lib/nmap/program.rb
91
- - lib/nmap/run_stat.rb
92
- - lib/nmap/scan.rb
93
- - lib/nmap/scan_task.rb
94
- - lib/nmap/scanner.rb
95
- - lib/nmap/scripts.rb
96
- - lib/nmap/sequence.rb
97
- - lib/nmap/service.rb
98
- - lib/nmap/status.rb
99
- - lib/nmap/task.rb
100
- - lib/nmap/tcp_sequence.rb
101
- - lib/nmap/tcp_ts_sequence.rb
102
- - lib/nmap/traceroute.rb
103
- - lib/nmap/uptime.rb
80
+ - lib/nmap/command.rb
104
81
  - lib/nmap/version.rb
105
82
  - lib/nmap/xml.rb
83
+ - lib/nmap/xml/address.rb
84
+ - lib/nmap/xml/cpe.rb
85
+ - lib/nmap/xml/cpe/url.rb
86
+ - lib/nmap/xml/hop.rb
87
+ - lib/nmap/xml/host.rb
88
+ - lib/nmap/xml/host_script.rb
89
+ - lib/nmap/xml/hostname.rb
90
+ - lib/nmap/xml/ip_id_sequence.rb
91
+ - lib/nmap/xml/os.rb
92
+ - lib/nmap/xml/os_class.rb
93
+ - lib/nmap/xml/os_match.rb
94
+ - lib/nmap/xml/port.rb
95
+ - lib/nmap/xml/postscript.rb
96
+ - lib/nmap/xml/prescript.rb
97
+ - lib/nmap/xml/run_stat.rb
98
+ - lib/nmap/xml/scan.rb
99
+ - lib/nmap/xml/scan_task.rb
100
+ - lib/nmap/xml/scanner.rb
101
+ - lib/nmap/xml/script.rb
102
+ - lib/nmap/xml/scripts.rb
103
+ - lib/nmap/xml/sequence.rb
104
+ - lib/nmap/xml/service.rb
105
+ - lib/nmap/xml/status.rb
106
+ - lib/nmap/xml/tcp_sequence.rb
107
+ - lib/nmap/xml/tcp_ts_sequence.rb
108
+ - lib/nmap/xml/traceroute.rb
109
+ - lib/nmap/xml/uptime.rb
106
110
  - ruby-nmap.gemspec
107
- - spec/address_spec.rb
108
- - spec/cpe/url_spec.rb
109
- - spec/cpe_examples.rb
110
- - spec/hop_spec.rb
111
- - spec/host_script_spec.rb
112
- - spec/host_spec.rb
113
- - spec/hostname_spec.rb
114
- - spec/ip_id_sequence_spec.rb
115
- - spec/local_scan.xml
111
+ - spec/command_spec.rb
112
+ - spec/fixtures/down_host_scan.xml
113
+ - spec/fixtures/local_scan.xml
114
+ - spec/fixtures/scan.xml
116
115
  - spec/nmap_spec.rb
117
- - spec/os_class_spec.rb
118
- - spec/os_match_spec.rb
119
- - spec/os_spec.rb
120
- - spec/port_spec.rb
121
- - spec/postscript_spec.rb
122
- - spec/prescript_spec.rb
123
- - spec/run_stat_spec.rb
124
- - spec/scan.xml
125
- - spec/scan_spec.rb
126
- - spec/scan_task_spec.rb
127
- - spec/scanner_spec.rb
128
- - spec/scripts_examples.rb
129
- - spec/sequence_examples.rb
130
- - spec/service_spec.rb
131
116
  - spec/spec_helper.rb
132
- - spec/status_spec.rb
133
- - spec/task_spec.rb
134
- - spec/tcp_sequence_spec.rb
135
- - spec/tcp_ts_sequence_spec.rb
136
- - spec/traceroute_spec.rb
137
- - spec/uptime_spec.rb
117
+ - spec/xml/address_spec.rb
118
+ - spec/xml/cpe/url_spec.rb
119
+ - spec/xml/cpe_examples.rb
120
+ - spec/xml/hop_spec.rb
121
+ - spec/xml/host_script_spec.rb
122
+ - spec/xml/host_spec.rb
123
+ - spec/xml/hostname_spec.rb
124
+ - spec/xml/ip_id_sequence_spec.rb
125
+ - spec/xml/os_class_spec.rb
126
+ - spec/xml/os_match_spec.rb
127
+ - spec/xml/os_spec.rb
128
+ - spec/xml/port_spec.rb
129
+ - spec/xml/postscript_spec.rb
130
+ - spec/xml/prescript_spec.rb
131
+ - spec/xml/run_stat_spec.rb
132
+ - spec/xml/scan_spec.rb
133
+ - spec/xml/scan_task_spec.rb
134
+ - spec/xml/scanner_spec.rb
135
+ - spec/xml/script_spec.rb
136
+ - spec/xml/scripts_examples.rb
137
+ - spec/xml/sequence_examples.rb
138
+ - spec/xml/service_spec.rb
139
+ - spec/xml/status_spec.rb
140
+ - spec/xml/tcp_sequence_spec.rb
141
+ - spec/xml/tcp_ts_sequence_spec.rb
142
+ - spec/xml/traceroute_spec.rb
143
+ - spec/xml/uptime_spec.rb
138
144
  - spec/xml_spec.rb
139
- homepage: https://github.com/sophsec/ruby-nmap#readme
145
+ homepage: https://github.com/postmodern/ruby-nmap#readme
140
146
  licenses:
141
147
  - MIT
142
148
  metadata: {}
143
- post_install_message:
149
+ post_install_message:
144
150
  rdoc_options: []
145
151
  require_paths:
146
152
  - lib
@@ -153,38 +159,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
159
  requirements:
154
160
  - - ">="
155
161
  - !ruby/object:Gem::Version
156
- version: 2.0.0
162
+ version: '0'
157
163
  requirements:
158
164
  - nmap >= 5.00
159
- rubyforge_project:
160
- rubygems_version: 2.6.14
161
- signing_key:
165
+ rubygems_version: 3.3.7
166
+ signing_key:
162
167
  specification_version: 4
163
- summary: A Ruby interface to Nmap.
164
- test_files:
165
- - spec/address_spec.rb
166
- - spec/cpe/url_spec.rb
167
- - spec/hop_spec.rb
168
- - spec/host_script_spec.rb
169
- - spec/host_spec.rb
170
- - spec/hostname_spec.rb
171
- - spec/ip_id_sequence_spec.rb
172
- - spec/nmap_spec.rb
173
- - spec/os_class_spec.rb
174
- - spec/os_match_spec.rb
175
- - spec/os_spec.rb
176
- - spec/port_spec.rb
177
- - spec/postscript_spec.rb
178
- - spec/prescript_spec.rb
179
- - spec/run_stat_spec.rb
180
- - spec/scan_spec.rb
181
- - spec/scan_task_spec.rb
182
- - spec/scanner_spec.rb
183
- - spec/service_spec.rb
184
- - spec/status_spec.rb
185
- - spec/task_spec.rb
186
- - spec/tcp_sequence_spec.rb
187
- - spec/tcp_ts_sequence_spec.rb
188
- - spec/traceroute_spec.rb
189
- - spec/uptime_spec.rb
190
- - spec/xml_spec.rb
168
+ summary: A Ruby API to nmap.
169
+ test_files: []
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - sudo apt-get install libxml2-dev libxslt1-dev
4
- rvm:
5
- - 2.1.9
6
- - 2.2.4
7
- - 2.3.1
8
- - jruby
9
- - rbx
10
- matrix:
11
- allow_failures:
12
- - rvm: jruby
13
- - rvm: rbx
14
- script: rake test
data/lib/nmap/address.rb DELETED
@@ -1,34 +0,0 @@
1
- module Nmap
2
- #
3
- # Represents an IP or MAC address and Vendor name.
4
- #
5
- class Address < Struct.new(:type, :addr, :vendor)
6
-
7
- #
8
- # Initializes the address.
9
- #
10
- # @param [Symbol] type
11
- # The type of address.
12
- #
13
- # @param [String] addr
14
- # The address.
15
- #
16
- # @param [String, nil] vendor
17
- # The optional vendor.
18
- #
19
- def initialize(type,addr,vendor=nil)
20
- super(type,addr,vendor)
21
- end
22
-
23
- #
24
- # Converts the address to a String.
25
- #
26
- # @return [String]
27
- # The address.
28
- #
29
- def to_s
30
- self.addr.to_s
31
- end
32
-
33
- end
34
- end
data/lib/nmap/cpe/url.rb DELETED
@@ -1,78 +0,0 @@
1
- module Nmap
2
- module CPE
3
- #
4
- # Represets a [Common Platform Enumeration (CPE)][CPE] URL.
5
- #
6
- # [CPE]: http://nmap.org/book/output-formats-cpe.html
7
- #
8
- # @since 0.7.0
9
- #
10
- class URL < Struct.new(:part,:vendor,:product,:version,:update,:edition,
11
- :language)
12
-
13
- # CPE part codes
14
- PARTS = {
15
- '/a' => :application,
16
- '/h' => :hardware,
17
- '/o' => :os
18
- }
19
-
20
- #
21
- # Parses a CPE URL.
22
- #
23
- # @param [String] url
24
- # The raw URL.
25
- #
26
- # @return [URL]
27
- # The parsed URL.
28
- #
29
- def self.parse(url)
30
- scheme,
31
- part,
32
- vendor,
33
- product,
34
- version,
35
- update,
36
- edition,
37
- language = url.split(':',8)
38
-
39
- unless scheme == 'cpe'
40
- raise(ArgumentError,"CPE URLs must begin with 'cpe:'")
41
- end
42
-
43
- vendor = vendor.to_sym
44
- product = product.to_sym
45
- language = language.to_sym if language
46
-
47
- return new(
48
- PARTS[part],
49
- vendor,
50
- product,
51
- version,
52
- update,
53
- edition,
54
- language
55
- )
56
- end
57
-
58
- #
59
- # Converts the CPE URL back into a String.
60
- #
61
- # @return [String]
62
- # The raw CPE URL.
63
- #
64
- def to_s
65
- 'cpe:' + [
66
- PARTS.invert[part],
67
- vendor,
68
- product,
69
- version,
70
- update,
71
- edition,
72
- language
73
- ].compact.join(':')
74
- end
75
-
76
- end
77
- end
78
- end