ruby-nmap 0.1.1 → 0.2.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.
@@ -1,7 +1,4 @@
1
- require 'rubygems'
2
- gem 'rspec', '>=1.1.12'
3
- require 'spec'
4
-
1
+ require 'rspec'
5
2
  require 'nmap/version'
6
3
 
7
4
  include Nmap
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+ require 'nmap/task'
3
+
4
+ describe Task do
5
+ subject { Task.new }
6
+
7
+ describe "ports" do
8
+ it "should ignore empty port Arrays" do
9
+ subject.ports = []
10
+
11
+ subject.arguments.should == []
12
+ end
13
+
14
+ it "should format a String of ports" do
15
+ subject.ports = '80,21,25'
16
+
17
+ subject.arguments.should == %w[-p 80,21,25]
18
+ end
19
+
20
+ it "should format an Array of String ports" do
21
+ subject.ports = %w[80 21 25]
22
+
23
+ subject.arguments.should == %w[-p 80,21,25]
24
+ end
25
+
26
+ it "should format an Array of Integer ports" do
27
+ subject.ports = [80, 21, 25]
28
+
29
+ subject.arguments.should == %w[-p 80,21,25]
30
+ end
31
+
32
+ it "should format a Range of ports" do
33
+ subject.ports = [80, 21..25]
34
+
35
+ subject.arguments.should == %w[-p 80,21-25]
36
+ end
37
+ end
38
+ end
@@ -1,8 +1,8 @@
1
- require 'nmap/xml'
2
-
3
1
  require 'spec_helper'
4
2
  require 'helpers/xml'
5
3
 
4
+ require 'nmap/xml'
5
+
6
6
  describe XML do
7
7
  include Helpers
8
8
 
@@ -26,6 +26,10 @@ describe XML do
26
26
  @xml.scanner.arguments.should == 'nmap -v -oX samples/backspace.xml -O -P0 -sS 192.168.5.*'
27
27
  end
28
28
 
29
+ it "should parse the scanner start time" do
30
+ @xml.scanner.start_time.should == Time.at(1218934249)
31
+ end
32
+
29
33
  it "should parse the scan information" do
30
34
  scan_info = @xml.scan_info
31
35
 
@@ -42,6 +46,22 @@ describe XML do
42
46
  @xml.debugging.should == 0
43
47
  end
44
48
 
49
+ it "should parse the scan tasks" do
50
+ tasks = @xml.tasks
51
+
52
+ tasks.should_not be_empty
53
+
54
+ tasks.each do |task|
55
+ task.name.should_not be_nil
56
+ task.name.should_not be_empty
57
+
58
+ task.start_time.should > Time.at(0)
59
+
60
+ task.end_time.should > Time.at(0)
61
+ task.end_time.should >= task.start_time
62
+ end
63
+ end
64
+
45
65
  it "should parse the hosts" do
46
66
  @xml.hosts.length.should == 10
47
67
  end
metadata CHANGED
@@ -1,153 +1,187 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Postmodern
8
13
  autorequire:
9
14
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
14
- bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
15
- ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
16
- BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
17
- CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
18
- 1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
19
- mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
20
- W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
21
- 7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
22
- +Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
23
- T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
24
- sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
25
- ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
26
- xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
27
- cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
28
- GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
29
- /fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
30
- pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
31
- -----END CERTIFICATE-----
15
+ cert_chain: []
32
16
 
33
- date: 2010-01-02 00:00:00 -08:00
17
+ date: 2010-10-29 00:00:00 -07:00
34
18
  default_executable:
35
19
  dependencies:
36
20
  - !ruby/object:Gem::Dependency
37
21
  name: nokogiri
38
- type: :runtime
39
- version_requirement:
40
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
41
25
  requirements:
42
26
  - - ">="
43
27
  - !ruby/object:Gem::Version
44
- version: 1.4.0
45
- version:
28
+ segments:
29
+ - 1
30
+ - 3
31
+ - 0
32
+ version: 1.3.0
33
+ type: :runtime
34
+ version_requirements: *id001
46
35
  - !ruby/object:Gem::Dependency
47
36
  name: rprogram
48
- type: :runtime
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
51
40
  requirements:
52
- - - ">="
41
+ - - ~>
53
42
  - !ruby/object:Gem::Version
54
- version: 0.1.8
55
- version:
43
+ segments:
44
+ - 0
45
+ - 2
46
+ - 0
47
+ version: 0.2.0
48
+ type: :runtime
49
+ version_requirements: *id002
56
50
  - !ruby/object:Gem::Dependency
57
- name: rspec
58
- type: :development
59
- version_requirement:
60
- version_requirements: !ruby/object:Gem::Requirement
51
+ name: ore
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
61
55
  requirements:
62
- - - ">="
56
+ - - ~>
63
57
  - !ruby/object:Gem::Version
64
- version: 1.1.12
65
- version:
66
- - !ruby/object:Gem::Dependency
67
- name: yard
58
+ segments:
59
+ - 0
60
+ - 2
61
+ - 1
62
+ version: 0.2.1
68
63
  type: :development
69
- version_requirement:
70
- version_requirements: !ruby/object:Gem::Requirement
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: ore-tasks
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
71
70
  requirements:
72
- - - ">="
71
+ - - ~>
73
72
  - !ruby/object:Gem::Version
74
- version: 0.2.3.5
75
- version:
73
+ segments:
74
+ - 0
75
+ - 1
76
+ - 2
77
+ version: 0.1.2
78
+ type: :development
79
+ version_requirements: *id004
76
80
  - !ruby/object:Gem::Dependency
77
- name: hoe
81
+ name: rspec
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 2
90
+ - 0
91
+ - 0
92
+ version: 2.0.0
78
93
  type: :development
79
- version_requirement:
80
- version_requirements: !ruby/object:Gem::Requirement
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: yard
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
81
100
  requirements:
82
- - - ">="
101
+ - - ~>
83
102
  - !ruby/object:Gem::Version
84
- version: 2.4.0
85
- version:
103
+ segments:
104
+ - 0
105
+ - 6
106
+ - 0
107
+ version: 0.6.0
108
+ type: :development
109
+ version_requirements: *id006
86
110
  description: A Ruby interface to Nmap, the exploration tool and security / port scanner.
87
- email:
88
- - postmodern.mod3@gmail.com
111
+ email: postmodern.mod3@gmail.com
89
112
  executables: []
90
113
 
91
114
  extensions: []
92
115
 
93
116
  extra_rdoc_files:
94
- - Manifest.txt
117
+ - README.md
95
118
  files:
96
- - History.rdoc
97
- - Manifest.txt
98
- - README.rdoc
119
+ - .rspec
120
+ - .yardopts
121
+ - ChangeLog.md
122
+ - LICENSE.txt
123
+ - README.md
99
124
  - Rakefile
125
+ - gemspec.yml
100
126
  - lib/nmap.rb
101
- - lib/nmap/task.rb
102
- - lib/nmap/program.rb
103
127
  - lib/nmap/address.rb
104
128
  - lib/nmap/host.rb
129
+ - lib/nmap/os.rb
105
130
  - lib/nmap/os_class.rb
106
131
  - lib/nmap/os_match.rb
107
- - lib/nmap/os.rb
108
132
  - lib/nmap/port.rb
109
- - lib/nmap/scanner.rb
133
+ - lib/nmap/program.rb
110
134
  - lib/nmap/scan.rb
135
+ - lib/nmap/scan_task.rb
136
+ - lib/nmap/scanner.rb
111
137
  - lib/nmap/status.rb
112
- - lib/nmap/xml.rb
138
+ - lib/nmap/task.rb
113
139
  - lib/nmap/version.rb
114
- - tasks/spec.rb
115
- - tasks/yard.rb
116
- - spec/spec_helper.rb
140
+ - lib/nmap/xml.rb
141
+ - ruby-nmap.gemspec
117
142
  - spec/helpers/scan.xml
118
143
  - spec/helpers/xml.rb
119
- - spec/os_spec.rb
120
144
  - spec/host_spec.rb
121
- - spec/xml_spec.rb
122
145
  - spec/nmap_spec.rb
146
+ - spec/os_spec.rb
147
+ - spec/spec_helper.rb
148
+ - spec/task_spec.rb
149
+ - spec/xml_spec.rb
123
150
  has_rdoc: yard
124
- homepage: http://ruby-nmap.rubyforge.org/
125
- licenses: []
126
-
151
+ homepage: http://github.com/sophsec/ruby-nmap
152
+ licenses:
153
+ - MIT
127
154
  post_install_message:
128
- rdoc_options:
129
- - --main
130
- - README.rdoc
155
+ rdoc_options: []
156
+
131
157
  require_paths:
132
158
  - lib
133
159
  required_ruby_version: !ruby/object:Gem::Requirement
160
+ none: false
134
161
  requirements:
135
162
  - - ">="
136
163
  - !ruby/object:Gem::Version
164
+ segments:
165
+ - 0
137
166
  version: "0"
138
- version:
139
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
+ none: false
140
169
  requirements:
141
170
  - - ">="
142
171
  - !ruby/object:Gem::Version
172
+ segments:
173
+ - 0
143
174
  version: "0"
144
- version:
145
- requirements: []
146
-
175
+ requirements:
176
+ - nmap, 4.xx or greater
147
177
  rubyforge_project: ruby-nmap
148
- rubygems_version: 1.3.5
178
+ rubygems_version: 1.3.7
149
179
  signing_key:
150
180
  specification_version: 3
151
- summary: A Ruby interface to Nmap, the exploration tool and security / port scanner.
152
- test_files: []
153
-
181
+ summary: A Ruby interface to Nmap.
182
+ test_files:
183
+ - spec/host_spec.rb
184
+ - spec/nmap_spec.rb
185
+ - spec/os_spec.rb
186
+ - spec/xml_spec.rb
187
+ - spec/task_spec.rb
data.tar.gz.sig DELETED
Binary file
@@ -1,11 +0,0 @@
1
- === 0.1.1 / 2010-01-02
2
-
3
- * Require RProgram >= 0.1.8.
4
- * Adds +sudo+ and +sudo=+ instance methods to {Nmap::Task}.
5
-
6
- === 0.1.0 / 2009-11-13
7
-
8
- * Initial release.
9
- * Provides a Ruby interface for running Nmap.
10
- * Provides a Parser for enumerating Nmap XML scan files.
11
-
@@ -1,27 +0,0 @@
1
- History.rdoc
2
- Manifest.txt
3
- README.rdoc
4
- Rakefile
5
- lib/nmap.rb
6
- lib/nmap/task.rb
7
- lib/nmap/program.rb
8
- lib/nmap/address.rb
9
- lib/nmap/host.rb
10
- lib/nmap/os_class.rb
11
- lib/nmap/os_match.rb
12
- lib/nmap/os.rb
13
- lib/nmap/port.rb
14
- lib/nmap/scanner.rb
15
- lib/nmap/scan.rb
16
- lib/nmap/status.rb
17
- lib/nmap/xml.rb
18
- lib/nmap/version.rb
19
- tasks/spec.rb
20
- tasks/yard.rb
21
- spec/spec_helper.rb
22
- spec/helpers/scan.xml
23
- spec/helpers/xml.rb
24
- spec/os_spec.rb
25
- spec/host_spec.rb
26
- spec/xml_spec.rb
27
- spec/nmap_spec.rb
@@ -1,83 +0,0 @@
1
- = ruby-nmap
2
-
3
- * http://ruby-nmap.rubyforge.org/
4
- * http://github.com/sophsec/ruby-nmap
5
- * http://github.com/sophsec/ruby-nmap/issues
6
- * Postmodern (postmodern.mod3 at gmail.com)
7
-
8
- == DESCRIPTION:
9
-
10
- A Ruby interface to Nmap, the exploration tool and security / port scanner.
11
-
12
- == FEATURES:
13
-
14
- * Provides a Ruby interface for running Nmap.
15
- * Provides a Parser for enumerating Nmap XML scan files.
16
-
17
- == EXAMPLES:
18
-
19
- * Run Nmap from Ruby:
20
-
21
- require 'nmap/program'
22
-
23
- Nmap::Program.scan do |nmap|
24
- nmap.sudo = true
25
-
26
- nmap.syn_scan = true
27
- nmap.service_scan = true
28
- nmap.os_fingerprint = true
29
- nmap.xml = 'scan.xml'
30
- nmap.verbose = true
31
-
32
- nmap.ports = [20,21,22,23,25,80,110,443,512,522,8080,1080]
33
- nmap.targets = '192.168.1.*'
34
- end
35
-
36
- * Parse Nmap XML scan files:
37
-
38
- require 'nmap/xml'
39
-
40
- Nmap::XML.new('scan.xml') do |xml|
41
- xml.each_host do |host|
42
- puts "[#{host.ip}]"
43
-
44
- host.each_port do |port|
45
- puts " #{port.number}/#{port.protocol}\t#{port.state}\t#{port.service}"
46
- end
47
- end
48
- end
49
-
50
- == REQUIREMENTS:
51
-
52
- * {nmap}[http://www.insecure.org/]
53
- * {nokogiri}[http://nokogiri.rubyforge.org/] >= 1.4.0
54
- * {rprogram}[http://rprogram.rubyforge.org/] >= 0.1.8
55
-
56
- == INSTALL:
57
-
58
- $ sudo gem install ruby-nmap
59
-
60
- == LICENSE:
61
-
62
- The MIT License
63
-
64
- Copyright (c) 2009-2010 Hal Brodigan
65
-
66
- Permission is hereby granted, free of charge, to any person obtaining
67
- a copy of this software and associated documentation files (the
68
- 'Software'), to deal in the Software without restriction, including
69
- without limitation the rights to use, copy, modify, merge, publish,
70
- distribute, sublicense, and/or sell copies of the Software, and to
71
- permit persons to whom the Software is furnished to do so, subject to
72
- the following conditions:
73
-
74
- The above copyright notice and this permission notice shall be
75
- included in all copies or substantial portions of the Software.
76
-
77
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
78
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
80
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
81
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
82
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
83
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.