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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 699ef84ebbae450a8028495368bd78a6a1a37dfb
4
- data.tar.gz: 60f0b08be055ab6fa07665d895a7b41514b955a5
3
+ metadata.gz: 992cd75d7d286dbd1753f77d865997c480bca52a
4
+ data.tar.gz: 84027effa233dde232390219bf140943087b0d45
5
5
  SHA512:
6
- metadata.gz: 3af836b341c7aa7950e6b0b811acacef39f73e676394de8934f322ddd1115ccd9924305257ebc4e57a09360fbc68788ded8fd50b4867d26069ee10c9cefa5771
7
- data.tar.gz: 8ab08ba2f28e199ff3409eb5dbd435ceeb1607a61c9fe475b18710ebfc304827fddc796cb404a54db0838b4a425be7c1cc4e51aa561a6dae99aab024f29e4d31
6
+ metadata.gz: 277c27cdaf1bef181789223c624e16c1c15b0cc76e68c5e5849dc5e0da3d71cf8fdfe536adae5ec6f2d36d098bf066748322849cdfc57039b78094c82e53b792
7
+ data.tar.gz: 5932de1422c34276f7044aea1d784978b157c39e2f36055ec0c767704d1d606b2fb87c2e11b182a6f4105a7a24ba76ecba22a8bc6716c876f4fba6ded0f61ebc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Dradis Framework 3.10 (August, 2018) ##
2
+
3
+ * Create Issues from each finding `id` and a piece of
4
+ Evidence for each instance of that finding.
5
+
6
+ * Label the Node from the `targetip`.
7
+
1
8
  ## Dradis Framework 3.9 (January, 2018) ##
2
9
 
3
10
  * No changes.
@@ -8,7 +8,7 @@ module Dradis
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 3
11
- MINOR = 9
11
+ MINOR = 10
12
12
  TINY = 0
13
13
  PRE = nil
14
14
 
@@ -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
- if xml_scan.has_attribute? "sitename"
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
- item_label = xml_item.has_attribute?("id") ? xml_item["id"] : "Unknown"
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
- content_service.create_note(
66
- text: item_text,
67
- node: item_node)
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
 
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Nikto upload plugin' do
4
- describe "Importer" do
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(plugin: plugin)
16
- template_service = Dradis::Plugins::TemplateService.new(plugin: plugin)
14
+ @content_service = Dradis::Plugins::ContentService::Base.new(
15
+ logger: Logger.new(STDOUT),
16
+ plugin: plugin
17
+ )
17
18
 
18
- @importer = plugin::Importer.new(
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
- it "creates nodes, issues, notes and an evidences as needed" do
46
- # Host node and basic host info note
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('http://localhost:80/')
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
- expect(@content_service).to receive(:create_note) do |args|
53
- expect(args[:node].label).to eq("http://localhost:80/")
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
- expect(@content_service).to receive(:create_node) do |args|
66
- expect(args[:label]).to eq('750000')
67
- expect(args[:parent].label).to eq("http://localhost:80/")
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.once
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(:create_node) do |args|
79
- expect(args[:label]).to eq('600050')
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
- expect(@content_service).to receive(:create_note) do |args|
84
- expect(args[:node].label).to eq("600050")
85
- expect(args[:text]).to include("Apache/2.2.16 appears to be outdated")
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
- expect(@content_service).to receive(:create_node) do |args|
91
- expect(args[:label]).to eq('999990')
92
- expect(args[:parent].label).to eq("http://localhost:80/")
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
- expect(@content_service).to receive(:create_note) do |args|
96
- expect(args[:node].label).to eq("999990")
97
- expect(args[:text]).to include("Allowed HTTP Methods: GET, HEAD, POST, OPTIONS")
98
- expect(args[:text]).to_not include("not recognized by the plugin")
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(:create_node) do |args|
103
- expect(args[:label]).to eq('750000')
104
- expect(args[:parent].label).to eq("http://localhost:80/")
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
- expect(@content_service).to receive(:create_note) do |args|
108
- expect(args[:node].label).to eq("750000")
109
- expect(args[:text]).to include("/?show=http://cirt.net/rfiinc.txt??: Directory indexing found.")
110
- expect(args[:text]).to_not include("not recognized by the plugin")
111
- expect(args[:text]).to include("OSVDB: \"n/a\":n/a")
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
- # Run the import
116
- @importer.import(file: 'spec/fixtures/files/localhost.xml')
107
+ run_import!
117
108
  end
118
109
 
119
110
  end
@@ -0,0 +1,4 @@
1
+ item.request_method
2
+ item.uri
3
+ item.namelink
4
+ item.iplink
@@ -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>
@@ -0,0 +1,6 @@
1
+ #[Request]#
2
+ Request Method: %item.request_method%
3
+
4
+ #[Links]#
5
+ Link: %item.namelink%
6
+ IP Based Link: %item.iplink%
@@ -1,10 +1,8 @@
1
- #[Title]#
2
- Finding
3
-
1
+ ##[Title]#
2
+ %item.description%
4
3
 
5
4
  #[Details]#
6
- OSVDB: "%item.osvdbid%":%item.osvdblink%
7
- Request Method: %item.request_method%
8
- Description: %item.description%
9
- Link: %item.namelink%
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.9.0
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-01-08 00:00:00.000000000 Z
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.4.5
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.