dradis-nmap 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +23 -0
- data/LICENSE +339 -0
- data/README.md +22 -0
- data/Rakefile +1 -0
- data/dradis-nmap.gemspec +34 -0
- data/lib/dradis-nmap.rb +8 -0
- data/lib/dradis/plugins/nmap.rb +11 -0
- data/lib/dradis/plugins/nmap/engine.rb +13 -0
- data/lib/dradis/plugins/nmap/field_processor.rb +74 -0
- data/lib/dradis/plugins/nmap/gem_version.rb +19 -0
- data/lib/dradis/plugins/nmap/importer.rb +74 -0
- data/lib/dradis/plugins/nmap/version.rb +13 -0
- data/lib/tasks/thorfile.rb +42 -0
- data/spec/fixtures/files/invalid.xml +1 -0
- data/spec/fixtures/files/nse-01.xml +127 -0
- data/spec/fixtures/files/sample.xml +72 -0
- data/spec/nmap_upload_spec.rb +90 -0
- data/spec/spec_helper.rb +9 -0
- data/templates/host.fields +4 -0
- data/templates/host.sample +37 -0
- data/templates/host.template +19 -0
- data/templates/port.fields +8 -0
- data/templates/port.sample +14 -0
- data/templates/port.template +14 -0
- metadata +161 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Nmap upload plugin' do
|
4
|
+
describe "Importer" do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
# Stub template service
|
8
|
+
templates_dir = File.expand_path('../../templates', __FILE__)
|
9
|
+
expect_any_instance_of(Dradis::Plugins::TemplateService)
|
10
|
+
.to receive(:default_templates_dir).and_return(templates_dir)
|
11
|
+
|
12
|
+
# Init services
|
13
|
+
plugin = Dradis::Plugins::Nmap
|
14
|
+
|
15
|
+
@content_service = Dradis::Plugins::ContentService.new(plugin: plugin)
|
16
|
+
template_service = Dradis::Plugins::TemplateService.new(plugin: plugin)
|
17
|
+
|
18
|
+
@importer = plugin::Importer.new(
|
19
|
+
content_service: @content_service,
|
20
|
+
template_service: template_service
|
21
|
+
)
|
22
|
+
|
23
|
+
# Stub dradis-plugins methods
|
24
|
+
#
|
25
|
+
# They return their argument hashes as objects mimicking
|
26
|
+
# Nodes, Issues, etc
|
27
|
+
allow(@content_service).to receive(:create_node) do |args|
|
28
|
+
# puts "create_node: #{ args.inspect }"
|
29
|
+
OpenStruct.new(args)
|
30
|
+
end
|
31
|
+
allow(@content_service).to receive(:create_note) do |args|
|
32
|
+
# puts "create_note: #{ args.inspect }"
|
33
|
+
OpenStruct.new(args)
|
34
|
+
end
|
35
|
+
allow(@content_service).to receive(:create_issue) do |args|
|
36
|
+
# puts "create_issue: #{ args.inspect }"
|
37
|
+
OpenStruct.new(args)
|
38
|
+
end
|
39
|
+
allow(@content_service).to receive(:create_evidence) do |args|
|
40
|
+
# puts "create_evidence: #{ args.inspect }"
|
41
|
+
OpenStruct.new(args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "creates an error note when the xml is not valid" do
|
46
|
+
expect(@content_service).to receive(:create_note) do |args|
|
47
|
+
expect(args[:text]).to include("#[Title]#\nInvalid file format")
|
48
|
+
OpenStruct.new(args)
|
49
|
+
end.once
|
50
|
+
# Run the import
|
51
|
+
@importer.import(file: 'spec/fixtures/files/invalid.xml')
|
52
|
+
end
|
53
|
+
|
54
|
+
it "creates nodes, issues, notes and an evidences as needed" do
|
55
|
+
expect(@content_service).to receive(:create_node) do |args|
|
56
|
+
# puts "create_node: #{ args.inspect }"
|
57
|
+
expect(args[:label]).to eq('74.207.244.221')
|
58
|
+
expect(args[:type]).to eq(:host)
|
59
|
+
OpenStruct.new(args)
|
60
|
+
end.once
|
61
|
+
expect(@content_service).to receive(:create_note) do |args|
|
62
|
+
puts "create_note: #{ args.inspect }"
|
63
|
+
expect(args[:text]).to include("#[Title]#\nNmap info: 74.207.244.221")
|
64
|
+
expect(args[:text]).to_not include("not recognized by the plugin")
|
65
|
+
expect(args[:node].label).to eq("74.207.244.221")
|
66
|
+
OpenStruct.new(args)
|
67
|
+
end.once
|
68
|
+
expect(@content_service).to receive(:create_note) do |args|
|
69
|
+
puts "create_note: #{ args.inspect }"
|
70
|
+
expect(args[:text]).to include("#[Title]#\n22/tcp is open (syn-ack)")
|
71
|
+
expect(args[:text]).to_not include("not recognized by the plugin")
|
72
|
+
expect(args[:text]).to include("#[Host]#\n74.207.244.221")
|
73
|
+
expect(args[:node].label).to eq("74.207.244.221")
|
74
|
+
OpenStruct.new(args)
|
75
|
+
end.once
|
76
|
+
expect(@content_service).to receive(:create_note) do |args|
|
77
|
+
puts "create_note: #{ args.inspect }"
|
78
|
+
expect(args[:text]).to include("#[Title]#\n80/tcp is open (syn-ack)")
|
79
|
+
expect(args[:text]).to_not include("not recognized by the plugin")
|
80
|
+
expect(args[:text]).to include("#[Host]#\n74.207.244.221")
|
81
|
+
expect(args[:node].label).to eq("74.207.244.221")
|
82
|
+
OpenStruct.new(args)
|
83
|
+
end.once
|
84
|
+
|
85
|
+
# Run the import
|
86
|
+
@importer.import(file: 'spec/fixtures/files/sample.xml')
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
<host starttime="1378483073" endtime="1378483078">
|
2
|
+
<status state="up" reason="localhost-response" reason_ttl="0"/>
|
3
|
+
<address addr="127.0.0.1" addrtype="ipv4"/>
|
4
|
+
<hostnames>
|
5
|
+
<hostname name="localhost" type="user"/>
|
6
|
+
<hostname name="localhost" type="PTR"/>
|
7
|
+
</hostnames>
|
8
|
+
<ports>
|
9
|
+
<extraports state="closed" count="65529">
|
10
|
+
<extrareasons reason="resets" count="65529"/>
|
11
|
+
</extraports>
|
12
|
+
<port protocol="tcp" portid="25">
|
13
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
14
|
+
<service name="smtp" method="table" conf="3"/>
|
15
|
+
</port>
|
16
|
+
<port protocol="tcp" portid="80">
|
17
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
18
|
+
<service name="http" method="table" conf="3"/>
|
19
|
+
</port>
|
20
|
+
<port protocol="tcp" portid="443">
|
21
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
22
|
+
<service name="https" method="table" conf="3"/>
|
23
|
+
</port>
|
24
|
+
<port protocol="tcp" portid="3000">
|
25
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
26
|
+
<service name="ppp" method="table" conf="3"/>
|
27
|
+
</port>
|
28
|
+
<port protocol="tcp" portid="3306">
|
29
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
30
|
+
<service name="mysql" method="table" conf="3"/>
|
31
|
+
</port>
|
32
|
+
<port protocol="tcp" portid="22007">
|
33
|
+
<state state="open" reason="syn-ack" reason_ttl="64"/>
|
34
|
+
</port>
|
35
|
+
</ports>
|
36
|
+
<times srtt="35" rttvar="5" to="100000"/>
|
37
|
+
</host>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#[Title]#
|
2
|
+
Nmap info: %host.ip%
|
3
|
+
|
4
|
+
#[IP]#
|
5
|
+
%host.ip%
|
6
|
+
|
7
|
+
#[Hostnames]#
|
8
|
+
%host.hostnames%
|
9
|
+
|
10
|
+
#[OS]#
|
11
|
+
%host.os%
|
12
|
+
|
13
|
+
#[Services]#
|
14
|
+
|_. Port number |_. Protocol |_. State |_. Service |_. Product |_. Version |
|
15
|
+
%host.service_table%
|
16
|
+
|
17
|
+
|
18
|
+
#[Type]#
|
19
|
+
Properties
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dradis-nmap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Martin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dradis-plugins
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-nmap
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: combustion
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.5.2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.5.2
|
97
|
+
description: This add-on allows you to upload and parse output produced from Nmap
|
98
|
+
web server scanner into Dradis.
|
99
|
+
email:
|
100
|
+
- etd@nomejortu.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- CONTRIBUTING.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- dradis-nmap.gemspec
|
113
|
+
- lib/dradis-nmap.rb
|
114
|
+
- lib/dradis/plugins/nmap.rb
|
115
|
+
- lib/dradis/plugins/nmap/engine.rb
|
116
|
+
- lib/dradis/plugins/nmap/field_processor.rb
|
117
|
+
- lib/dradis/plugins/nmap/gem_version.rb
|
118
|
+
- lib/dradis/plugins/nmap/importer.rb
|
119
|
+
- lib/dradis/plugins/nmap/version.rb
|
120
|
+
- lib/tasks/thorfile.rb
|
121
|
+
- spec/fixtures/files/invalid.xml
|
122
|
+
- spec/fixtures/files/nse-01.xml
|
123
|
+
- spec/fixtures/files/sample.xml
|
124
|
+
- spec/nmap_upload_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
- templates/host.fields
|
127
|
+
- templates/host.sample
|
128
|
+
- templates/host.template
|
129
|
+
- templates/port.fields
|
130
|
+
- templates/port.sample
|
131
|
+
- templates/port.template
|
132
|
+
homepage: http://dradisframework.org
|
133
|
+
licenses:
|
134
|
+
- GPL-2
|
135
|
+
metadata: {}
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.2.3
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: Nmap add-on for the Dradis Framework.
|
156
|
+
test_files:
|
157
|
+
- spec/fixtures/files/invalid.xml
|
158
|
+
- spec/fixtures/files/nse-01.xml
|
159
|
+
- spec/fixtures/files/sample.xml
|
160
|
+
- spec/nmap_upload_spec.rb
|
161
|
+
- spec/spec_helper.rb
|