dradis-nikto 3.9.0 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/dradis/plugins/nikto/gem_version.rb +1 -1
- data/lib/dradis/plugins/nikto/importer.rb +16 -14
- data/spec/nikto_upload_spec.rb +52 -61
- data/templates/evidence.fields +4 -0
- data/templates/evidence.sample +6 -0
- data/templates/evidence.template +6 -0
- data/templates/item.template +6 -8
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 992cd75d7d286dbd1753f77d865997c480bca52a
|
4
|
+
data.tar.gz: 84027effa233dde232390219bf140943087b0d45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277c27cdaf1bef181789223c624e16c1c15b0cc76e68c5e5849dc5e0da3d71cf8fdfe536adae5ec6f2d36d098bf066748322849cdfc57039b78094c82e53b792
|
7
|
+
data.tar.gz: 5932de1422c34276f7044aea1d784978b157c39e2f36055ec0c767704d1d606b2fb87c2e11b182a6f4105a7a24ba76ecba22a8bc6716c876f4fba6ded0f61ebc
|
data/CHANGELOG.md
CHANGED
@@ -26,11 +26,7 @@ module Dradis::Plugins::Nikto
|
|
26
26
|
end
|
27
27
|
|
28
28
|
doc.xpath('/nikto/niktoscan/scandetails').each do |xml_scan|
|
29
|
-
|
30
|
-
host_label = xml_scan['sitename']
|
31
|
-
else
|
32
|
-
host_label = xml_scan['siteip']
|
33
|
-
end
|
29
|
+
host_label = xml_scan['targetip']
|
34
30
|
|
35
31
|
# Hack to include the file name in the xml
|
36
32
|
# so we can use it in the template
|
@@ -44,6 +40,14 @@ module Dradis::Plugins::Nikto
|
|
44
40
|
text: scan_text,
|
45
41
|
node: host_node)
|
46
42
|
|
43
|
+
# Add Node properties
|
44
|
+
if host_node.respond_to?(:properties)
|
45
|
+
host_node.set_property(:hostname, xml_scan['hostheader'])
|
46
|
+
host_node.set_property(:ip, xml_scan['targetip'])
|
47
|
+
host_node.set_property(:os, xml_scan['targetbanner'])
|
48
|
+
host_node.save
|
49
|
+
end
|
50
|
+
|
47
51
|
# Check for SSL cert tag and add that data in as well
|
48
52
|
unless xml_scan.at_xpath("ssl").nil?
|
49
53
|
xml_ssl = xml_scan.at_xpath("ssl")
|
@@ -55,16 +59,14 @@ module Dradis::Plugins::Nikto
|
|
55
59
|
|
56
60
|
# Items
|
57
61
|
xml_scan.xpath("item").each do |xml_item|
|
58
|
-
|
59
|
-
item_node = content_service.create_node(
|
60
|
-
label: item_label,
|
61
|
-
type: :default,
|
62
|
-
parent: host_node)
|
63
|
-
|
62
|
+
plugin_id = xml_item.has_attribute?("id") ? xml_item["id"] : "Unknown"
|
64
63
|
item_text = template_service.process_template(template: 'item', data: xml_item)
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
logger.info{ 'Creating Issue ID' + plugin_id }
|
65
|
+
issue = content_service.create_issue(text: item_text, id: plugin_id)
|
66
|
+
|
67
|
+
logger.info{ "\t\t => Creating new evidence" }
|
68
|
+
evidence_content = template_service.process_template(template: 'evidence', data: xml_item)
|
69
|
+
content_service.create_evidence(issue: issue, node: host_node, content: evidence_content)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
data/spec/nikto_upload_spec.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
describe
|
5
|
-
|
3
|
+
module Dradis::Plugins
|
4
|
+
describe 'Nikto upload plugin' do
|
6
5
|
before(:each) do
|
7
6
|
# Stub template service
|
8
7
|
templates_dir = File.expand_path('../../templates', __FILE__)
|
@@ -12,12 +11,13 @@ describe 'Nikto upload plugin' do
|
|
12
11
|
# Init services
|
13
12
|
plugin = Dradis::Plugins::Nikto
|
14
13
|
|
15
|
-
@content_service = Dradis::Plugins::ContentService.new(
|
16
|
-
|
14
|
+
@content_service = Dradis::Plugins::ContentService::Base.new(
|
15
|
+
logger: Logger.new(STDOUT),
|
16
|
+
plugin: plugin
|
17
|
+
)
|
17
18
|
|
18
|
-
@importer =
|
19
|
+
@importer = Dradis::Plugins::Nikto::Importer.new(
|
19
20
|
content_service: @content_service,
|
20
|
-
template_service: template_service
|
21
21
|
)
|
22
22
|
|
23
23
|
# Stub dradis-plugins methods
|
@@ -25,95 +25,86 @@ describe 'Nikto upload plugin' do
|
|
25
25
|
# They return their argument hashes as objects mimicking
|
26
26
|
# Nodes, Issues, etc
|
27
27
|
allow(@content_service).to receive(:create_node) do |args|
|
28
|
-
puts "create_node: #{ args.inspect }"
|
29
28
|
OpenStruct.new(args)
|
30
29
|
end
|
31
30
|
allow(@content_service).to receive(:create_note) do |args|
|
32
|
-
puts "create_note: #{ args.inspect }"
|
33
31
|
OpenStruct.new(args)
|
34
32
|
end
|
35
33
|
allow(@content_service).to receive(:create_issue) do |args|
|
36
|
-
puts "create_issue: #{ args.inspect }"
|
37
34
|
OpenStruct.new(args)
|
38
35
|
end
|
39
36
|
allow(@content_service).to receive(:create_evidence) do |args|
|
40
|
-
puts "create_evidence: #{ args.inspect }"
|
41
37
|
OpenStruct.new(args)
|
42
38
|
end
|
43
39
|
end
|
44
40
|
|
45
|
-
|
46
|
-
|
41
|
+
let(:example_xml) { 'spec/fixtures/files/localhost.xml' }
|
42
|
+
|
43
|
+
def run_import!
|
44
|
+
@importer.import(file: example_xml)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "creates nodes as needed" do
|
48
|
+
# Creates the Host Node
|
47
49
|
expect(@content_service).to receive(:create_node) do |args|
|
48
|
-
expect(args[:label]).to eq('
|
50
|
+
expect(args[:label]).to eq('127.0.0.1')
|
49
51
|
expect(args[:type]).to eq(:host)
|
50
52
|
OpenStruct.new(args)
|
51
53
|
end.once
|
52
|
-
|
53
|
-
|
54
|
-
expect(args[:text]).to include("#[Title]#\nNikto upload: localhost.xml")
|
55
|
-
expect(args[:text]).to_not include("not recognized by the plugin")
|
56
|
-
OpenStruct.new(args)
|
57
|
-
end.once
|
58
|
-
expect(@content_service).to receive(:create_note) do |args|
|
59
|
-
expect(args[:node].label).to eq("http://localhost:80/")
|
60
|
-
expect(args[:text]).to include("SSL Cert Information")
|
61
|
-
expect(args[:text]).to_not include("not recognized by the plugin")
|
62
|
-
OpenStruct.new(args)
|
63
|
-
end.once
|
54
|
+
run_import!
|
55
|
+
end
|
64
56
|
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
it "creates issues as needed" do
|
58
|
+
# Creates 3 Issues
|
59
|
+
expect(@content_service).to receive(:create_issue) do |args|
|
60
|
+
expect(args[:text]).to include("#[Title]#\n\/\: Directory indexing found.")
|
68
61
|
OpenStruct.new(args)
|
69
|
-
end
|
70
|
-
expect(@content_service).to receive(:create_note) do |args|
|
71
|
-
expect(args[:node].label).to eq("750000")
|
72
|
-
expect(args[:text]).to include("/: Directory indexing found.")
|
73
|
-
expect(args[:text]).to_not include("not recognized by the plugin")
|
74
|
-
expect(args[:text]).to include("OSVDB: \"3268\":3268_LINK")
|
75
|
-
OpenStruct.new(args)
|
76
|
-
end.once
|
62
|
+
end
|
77
63
|
|
78
|
-
expect(@content_service).to receive(:
|
79
|
-
expect(args[:
|
80
|
-
expect(args[:parent].label).to eq("http://localhost:80/")
|
64
|
+
expect(@content_service).to receive(:create_issue) do |args|
|
65
|
+
expect(args[:text]).to include("#[Title]#\nApache/2.2.16 appears to be outdated (current is at least Apache/2.2.19). Apache 1.3.42 (final release) and 2.0.64 are also current.")
|
81
66
|
OpenStruct.new(args)
|
82
67
|
end.once
|
83
|
-
|
84
|
-
|
85
|
-
expect(args[:text]).to include("
|
86
|
-
expect(args[:text]).to_not include("not recognized by the plugin")
|
68
|
+
|
69
|
+
expect(@content_service).to receive(:create_issue) do |args|
|
70
|
+
expect(args[:text]).to include("#[Title]#\nAllowed HTTP Methods: GET, HEAD, POST, OPTIONS")
|
87
71
|
OpenStruct.new(args)
|
88
72
|
end.once
|
89
73
|
|
90
|
-
|
91
|
-
|
92
|
-
|
74
|
+
run_import!
|
75
|
+
end
|
76
|
+
|
77
|
+
it "creates evidence as needed" do
|
78
|
+
# Creates 4 instances of Evidence for the 3 Issues
|
79
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
80
|
+
expect(args[:content]).to include("Link: http://localhost:80/")
|
81
|
+
expect(args[:issue].text).to include("Directory indexing found.")
|
82
|
+
expect(args[:node].label).to eq("127.0.0.1")
|
93
83
|
OpenStruct.new(args)
|
94
84
|
end.once
|
95
|
-
|
96
|
-
|
97
|
-
expect(args[:
|
98
|
-
expect(args[:text
|
85
|
+
|
86
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
87
|
+
expect(args[:content]).to include("Link: http://localhost:80/")
|
88
|
+
expect(args[:issue].text).to include("Apache/2.2.16 appears to be outdated (current is at least Apache/2.2.19). Apache 1.3.42 (final release) and 2.0.64 are also current.")
|
89
|
+
expect(args[:node].label).to eq("127.0.0.1")
|
99
90
|
OpenStruct.new(args)
|
100
91
|
end.once
|
101
92
|
|
102
|
-
expect(@content_service).to receive(:
|
103
|
-
expect(args[:
|
104
|
-
expect(args[:
|
93
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
94
|
+
expect(args[:content]).to include("Link: http://localhost:80/")
|
95
|
+
expect(args[:issue].text).to include("Allowed HTTP Methods: GET, HEAD, POST, OPTIONS")
|
96
|
+
expect(args[:node].label).to eq("127.0.0.1")
|
105
97
|
OpenStruct.new(args)
|
106
98
|
end.once
|
107
|
-
|
108
|
-
|
109
|
-
expect(args[:
|
110
|
-
expect(args[:text
|
111
|
-
expect(args[:
|
99
|
+
|
100
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
101
|
+
expect(args[:content]).to include("Link: http://localhost:80/?show=http://cirt.net/rfiinc.txt??")
|
102
|
+
expect(args[:issue].text).to include("Directory indexing found.")
|
103
|
+
expect(args[:node].label).to eq("127.0.0.1")
|
112
104
|
OpenStruct.new(args)
|
113
105
|
end.once
|
114
106
|
|
115
|
-
|
116
|
-
@importer.import(file: 'spec/fixtures/files/localhost.xml')
|
107
|
+
run_import!
|
117
108
|
end
|
118
109
|
|
119
110
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<item id="750000" method="GET" osvdbid="3268" osvdblink="3268_LINK">
|
2
|
+
<description><![CDATA[/: Directory indexing found.]]></description>
|
3
|
+
<uri><![CDATA[/]]></uri>
|
4
|
+
<namelink><![CDATA[http://localhost:80/]]></namelink>
|
5
|
+
<iplink><![CDATA[http://127.0.0.1:80/]]></iplink>
|
6
|
+
</item>
|
data/templates/item.template
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
##[Title]#
|
2
|
+
%item.description%
|
4
3
|
|
5
4
|
#[Details]#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
IP Based Link: %item.iplink%
|
5
|
+
%item.description%
|
6
|
+
|
7
|
+
#[OSVDB]#
|
8
|
+
"%item.osvdbid%":%item.osvdblink%
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-nikto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dradis-plugins
|
@@ -125,6 +125,9 @@ files:
|
|
125
125
|
- spec/fixtures/files/localhost.xml
|
126
126
|
- spec/nikto_upload_spec.rb
|
127
127
|
- spec/spec_helper.rb
|
128
|
+
- templates/evidence.fields
|
129
|
+
- templates/evidence.sample
|
130
|
+
- templates/evidence.template
|
128
131
|
- templates/item.fields
|
129
132
|
- templates/item.sample
|
130
133
|
- templates/item.template
|
@@ -154,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
157
|
version: '0'
|
155
158
|
requirements: []
|
156
159
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.6.8
|
158
161
|
signing_key:
|
159
162
|
specification_version: 4
|
160
163
|
summary: Nikto add-on for the Dradis Framework.
|