dradis-nexpose 3.8.0 → 3.9.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: 772ea8fbac2cac2a33e665405d77477b61dddd56
4
- data.tar.gz: cd0ad1efa74afed414f96aac1b40e1b6ab3a4e35
3
+ metadata.gz: 82ca17fb1e1f67e0647d8d1340c37a8a93e376c7
4
+ data.tar.gz: 4380aeb556cf35d8ddefc2b5306dac66b3b63141
5
5
  SHA512:
6
- metadata.gz: a02e3e026207ef125f8f58f81ce79c5c875b018a2dd175f679ce5b42c9d57af237f6b2a11db33e1e4d78a741f10130c26c8dab0154b9fe040d6e8c12d16e5c9b
7
- data.tar.gz: fe86b51bc4166a8a14ce62f5f2a69c89b59645f6ddbc0757501ca3594c4f204813230522d232f58f6af48a856504304dc04100e540c70effbb58e5588f3a3393
6
+ metadata.gz: 884ab9ece0604faa63ccc25e6dc2ea089908db16d42fedb52904051d0dc2d01cec9e79e4a951bd5bbd14a33f11add194cd0621cf4ce79aff3228990b8c446191
7
+ data.tar.gz: bc1e5fe3dd76bf02db753c1acdfda161e559368ee63e892a7206d3bbdd500a22687854d425fb13626de9fe3a7da25bf513be692da0e9fc72d64477be2ca52795
data/.gitignore CHANGED
@@ -9,3 +9,6 @@ Gemfile.lock
9
9
 
10
10
  # Gem artifacts
11
11
  /pkg/
12
+
13
+ # Misc
14
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## Dradis Framework 3.10 (XXX, 2018) ##
2
+
3
+ * Resolve duplicate content in nested `<Paragraph>` tags
4
+ * Import `<URLLink>` tags as textile links
5
+ * Import `<Paragraph preformat="true">` tags as code blocks
6
+ * Improve parsing of `<ListItem>` tags
7
+ * Import `vulnerability.tags` field as expected
8
+ * Create `hostname` and `os` Node properties (if present)
9
+
10
+ ## Dradis Framework 3.9 (January, 2018) ##
11
+
12
+ * No changes.
13
+
1
14
  ## Dradis Framework 3.8 (September, 2017) ##
2
15
 
3
16
  * No changes.
@@ -32,9 +32,11 @@ module Dradis::Plugins::Nexpose::Formats
32
32
  content_service.create_note(node: host_node, text: note_text)
33
33
 
34
34
  if host_node.respond_to?(:properties)
35
- logger.info{ "\tAdding host properties: :ip and :hostnames"}
35
+ logger.info{ "\tAdding host properties to #{nexpose_node.address}"}
36
36
  host_node.set_property(:ip, nexpose_node.address)
37
- host_node.set_property(:hostnames, nexpose_node.names)
37
+ host_node.set_property(:hostname, nexpose_node.site_name)
38
+ host_node.set_property(:os, nexpose_node.software)
39
+ host_node.save
38
40
  end
39
41
 
40
42
  # inject this node's address into any vulnerabilities identified
@@ -114,7 +116,6 @@ module Dradis::Plugins::Nexpose::Formats
114
116
  end
115
117
 
116
118
  # Third, parse vulnerability definitions
117
- definitions_node = content_service.create_node(label: 'Definitions')
118
119
  logger.info{ "\tProcessing issue definitions:" }
119
120
 
120
121
  doc.xpath('//VulnerabilityDefinitions/vulnerability').each do |xml_vulnerability|
@@ -8,7 +8,7 @@ module Dradis
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 3
11
- MINOR = 8
11
+ MINOR = 9
12
12
  TINY = 0
13
13
  PRE = nil
14
14
 
data/lib/nexpose/node.rb CHANGED
@@ -18,15 +18,15 @@ module Nexpose
18
18
  def supported_tags
19
19
  [
20
20
  # attributes
21
- :address, :status, :device_id, :hardware_address,
21
+ :address, :device_id, :hardware_address, :site_name, :status,
22
22
 
23
23
  # simple tags
24
24
 
25
25
  # multiple tags
26
- :names, :fingerprints,
26
+ :fingerprints, :names,
27
27
 
28
28
  # compounded tags
29
- :software, :tests, :endpoints
29
+ :endpoints, :software, :tests
30
30
  ]
31
31
  end
32
32
 
@@ -72,7 +72,8 @@ module Nexpose
72
72
  # hyphenated-case is used for some attributes
73
73
  translations_table = {
74
74
  :device_id => 'device-id',
75
- :hardware_address => 'hardware-address'
75
+ :hardware_address => 'hardware-address',
76
+ :site_name => 'site-name'
76
77
  }
77
78
 
78
79
  method_name = translations_table.fetch(method, method.to_s)
@@ -71,29 +71,17 @@ module Nexpose
71
71
 
72
72
  # Then we try simple children tags: description, solution
73
73
  tag = @xml.xpath("./#{method_name}/ContainerBlockElement").first
74
- if tag
75
- lines = []
76
-
77
- # Go through Paragraphs and extract them.
78
- # FIXME: we're using .//. to get paragraphs nested in Nexpose lists,
79
- # ideally we'd convert this lists into Textile bullet point lists.
80
- tag.xpath(".//Paragraph").each do |xml_paragraph|
81
- lines << xml_paragraph.text.split("\n").collect(&:strip).join(' ').strip
82
- end
83
-
84
- return lines.join("\n\n")
85
- end
86
-
87
- # Finally the enumerations: references, tags
88
- if method_name == 'references'
89
- references =
90
- @xml.xpath("./references/reference").map do |entry|
91
- {:source => entry['source'], :text => entry.text}
92
- end
93
-
94
- return references
95
- elsif method == 'tags'
96
- return @xml.xpath("./tags/tag").collect(&:text)
74
+ # Then we try the tags with nested content
75
+ nest = @xml.xpath("./#{method_name}").first
76
+
77
+ # We need to clean up tags that have HTML content in them
78
+ if tags_with_html_content.include?(method)
79
+ return cleanup_html(tag)
80
+ # And we need to clean up the tags with nested content in them
81
+ elsif tags_with_nested_content.include?(method)
82
+ return cleanup_nested(nest)
83
+ else
84
+ return tag
97
85
  end
98
86
 
99
87
  # Handle evidence creation
@@ -108,5 +96,45 @@ module Nexpose
108
96
 
109
97
  nil
110
98
  end
99
+
100
+ private
101
+
102
+ def cleanup_nested(source)
103
+ result = source.to_s
104
+ result.gsub!(/<references>/, '')
105
+ result.gsub!(/<\/references>/, '')
106
+ result.gsub!(/<reference source=\"(.*?)\">(.*?)<\/reference>/i) {"#{$1.strip}: #{$2.strip}\n"}
107
+ result.gsub!(/<tags>/, '')
108
+ result.gsub!(/<\/tags>/, '')
109
+ result.gsub!(/<tag>(.*?)<\/tag>/) {"#{$1}\n"}
110
+ result.gsub!(/ /, '')
111
+ result
112
+ end
113
+
114
+ def cleanup_html(source)
115
+ result = source.to_s
116
+ result.gsub!(/<ContainerBlockElement>(.*?)<\/ContainerBlockElement>/m){|m| "#{ $1 }"}
117
+ result.gsub!(/<Paragraph preformat=\"true\">(.*?)<\/Paragraph>/m){|m| "\nbc. #{ $1 }\n\n"}
118
+ result.gsub!(/<Paragraph>(.*?)<\/Paragraph>/m){|m| "#{ $1 }\n"}
119
+ result.gsub!(/<Paragraph>/, '')
120
+ result.gsub!(/<\/Paragraph>/, '')
121
+ result.gsub!(/<UnorderedList>(.*?)<\/UnorderedList>/m){|m| "#{ $1 }"}
122
+ result.gsub!(/<ListItem>(.*?)<\/ListItem>/m){|m| "#{ $1 }\n"}
123
+ result.gsub!(/ /, '')
124
+ result.gsub!(/<URLLink LinkTitle=\"(.*?)\" LinkURL=\"(.*?)\"\/>/i) { "\"#{$1.strip}\":#{$2.strip} " }
125
+ result.gsub!(/<URLLink LinkURL=\"(.*?)\" LinkTitle=\"(.*?)\"\/>/i) { "\"#{$2.strip}\":#{$1.strip} " }
126
+ result.gsub!(/<URLLink(.*)LinkURL=\"(.*?)\"(.*?)>(.*?)<\/URLLink>/m) {|m| "\"#{$4.strip}\":#{$2.strip} " }
127
+
128
+ result
129
+ end
130
+
131
+ def tags_with_html_content
132
+ [:description, :solution]
133
+ end
134
+
135
+ def tags_with_nested_content
136
+ [:references, :tags]
137
+ end
138
+
111
139
  end
112
140
  end
@@ -4,5 +4,6 @@ node.fingerprints
4
4
  node.hardware_address
5
5
  node.names
6
6
  node.tests
7
+ node.site_name
7
8
  node.status
8
9
  node.software
@@ -1,5 +1,6 @@
1
1
  <node
2
2
  address="10.0.0.1"
3
+ site-name="snorby"
3
4
  status="alive"
4
5
  device-id="211"
5
6
  hardware-address="00:de:ad:be:ef:00">
@@ -1,6 +1,9 @@
1
- #[Host]#
1
+ #[Title]#
2
2
  %node.address%
3
3
 
4
+ #[Hostname]#
5
+ %node.site_name%
6
+
4
7
  #[Details]#
5
8
  Status: %node.status%
6
9
  Device id: %node.device_id%
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-nexpose
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.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: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2018-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dradis-plugins
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubyforge_project:
172
- rubygems_version: 2.6.8
172
+ rubygems_version: 2.6.12
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Nexpose add-on for the Dradis Framework.