dradis-burp 4.15.0 → 4.16.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/dradis/plugins/burp/gem_version.rb +1 -1
- data/lib/dradis/plugins/burp/html/importer.rb +1 -1
- data/spec/html/importer_spec.rb +70 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/stubbed_mapping_service.rb +8 -0
- data/spec/{burp_upload_spec.rb → xml/importer_spec.rb} +24 -94
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b020b3796f439d717c5b889493eaaabb85d7ab654bd7cb0ae898dd839993bd7
|
4
|
+
data.tar.gz: 956ac5571512e4af5279ba2275dc12bd03dc5bdcb6ecd5d3c263cd987162a725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13a51ae2624b18c31ce471739d69e145e64634009fa2151808a09faa2eba248b409d999038339ef31c442f038f5c04618f902f10c6bdfe991cb8ac1520d451e3
|
7
|
+
data.tar.gz: 3c541cb0c9d279d73d828325be1bcabc00a33fd705312070c4bb290090b0baf910efccd240ddce10c8d63d1fa727f2de6d0a743e50cd58eee52dea5176b8f230
|
data/CHANGELOG.md
CHANGED
@@ -90,7 +90,7 @@ module Dradis::Plugins::Burp
|
|
90
90
|
evidence_id = html_evidence.attr('id').value
|
91
91
|
logger.info { "Processing evidence #{evidence_id}" }
|
92
92
|
|
93
|
-
host_td = html_evidence.
|
93
|
+
host_td = html_evidence.at_xpath(".//td[starts-with(.,'Host:')]")
|
94
94
|
host_label = host_td.next_element.text.split('//').last
|
95
95
|
host = content_service.create_node(label: host_label, type: :host)
|
96
96
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe 'Burp upload plugin' do
|
5
|
+
describe Dradis::Plugins::Burp::Html::Importer do
|
6
|
+
before(:each) do
|
7
|
+
# Stub mappings service
|
8
|
+
allow(Dradis::Plugins::MappingService).to receive(:new).and_return(
|
9
|
+
StubbedMappingService.new
|
10
|
+
)
|
11
|
+
|
12
|
+
# Init services
|
13
|
+
plugin = Dradis::Plugins::Burp::Html
|
14
|
+
|
15
|
+
@content_service = Dradis::Plugins::ContentService::Base.new(
|
16
|
+
logger: Logger.new(STDOUT),
|
17
|
+
plugin: plugin
|
18
|
+
)
|
19
|
+
|
20
|
+
@importer = plugin::Importer.new(
|
21
|
+
content_service: @content_service,
|
22
|
+
)
|
23
|
+
|
24
|
+
# Stub dradis-plugins methods
|
25
|
+
#
|
26
|
+
# They return their argument hashes as objects mimicking
|
27
|
+
# Nodes, Issues, etc
|
28
|
+
allow(@content_service).to receive(:create_node) do |args|
|
29
|
+
obj = OpenStruct.new(args)
|
30
|
+
obj.define_singleton_method(:set_property) { |_, __| }
|
31
|
+
obj
|
32
|
+
end
|
33
|
+
allow(@content_service).to receive(:create_issue) do |args|
|
34
|
+
OpenStruct.new(args)
|
35
|
+
end
|
36
|
+
allow(@content_service).to receive(:create_evidence) do |args|
|
37
|
+
OpenStruct.new(args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'creates nodes, issues, and evidence as needed' do
|
42
|
+
# Host node
|
43
|
+
#
|
44
|
+
# create_node should be called once for each issue in the xml,
|
45
|
+
# but ContentService knows it's already created and NOOPs
|
46
|
+
expect(@content_service).to receive(:create_node)
|
47
|
+
.with(hash_including label: 'github.com/dradis/dradis-burp')
|
48
|
+
.exactly(1).times
|
49
|
+
|
50
|
+
# # create_issue should be called once for each issue in the xml
|
51
|
+
expect(@content_service).to receive(:create_issue) do |args|
|
52
|
+
expect(args[:text]).to include("Strict transport security not enforced")
|
53
|
+
expect(args[:text]).to include('*application*', '@Wi-Fi@')
|
54
|
+
expect(args[:id]).to eq(16777984)
|
55
|
+
OpenStruct.new(args)
|
56
|
+
end.once
|
57
|
+
|
58
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
59
|
+
expect(args[:content]).to include('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
|
60
|
+
expect(args[:content]).to include("http://1.1.1.1/dradis/sessions")
|
61
|
+
expect(args[:issue].text).to include("Strict transport security not enforced")
|
62
|
+
expect(args[:issue].text).to include('*application*', '@Wi-Fi@')
|
63
|
+
expect(args[:node].label).to eq('github.com/dradis/dradis-burp')
|
64
|
+
end.once
|
65
|
+
|
66
|
+
# Run the import
|
67
|
+
@importer.import(file: 'spec/fixtures/files/burp.html')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
class StubbedMappingService
|
2
|
+
def apply_mapping(args)
|
3
|
+
processor = Dradis::Plugins::Burp::FieldProcessor.new(data: args[:data])
|
4
|
+
Dradis::Plugins::Burp::Mapping::SOURCE_FIELDS[args[:source].to_sym].map do |field|
|
5
|
+
processor.value(field: field)
|
6
|
+
end.join("\n")
|
7
|
+
end
|
8
|
+
end
|
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
require 'ostruct'
|
3
3
|
|
4
4
|
describe 'Burp upload plugin' do
|
5
|
-
|
6
5
|
describe Burp::Xml::Issue do
|
7
6
|
it 'handles invalid utf-8 bytes' do
|
8
7
|
doc = Nokogiri::XML(File.read('spec/fixtures/files/invalid-utf-issue.xml'))
|
@@ -15,10 +14,10 @@ describe 'Burp upload plugin' do
|
|
15
14
|
|
16
15
|
describe Dradis::Plugins::Burp::Xml::Importer do
|
17
16
|
before(:each) do
|
18
|
-
# Stub
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
# Stub mappings service
|
18
|
+
allow(Dradis::Plugins::MappingService).to receive(:new).and_return(
|
19
|
+
StubbedMappingService.new
|
20
|
+
)
|
22
21
|
|
23
22
|
# Init services
|
24
23
|
plugin = Dradis::Plugins::Burp::Xml
|
@@ -50,7 +49,6 @@ describe 'Burp upload plugin' do
|
|
50
49
|
end
|
51
50
|
|
52
51
|
it 'creates nodes, issues, and evidence as needed' do
|
53
|
-
|
54
52
|
# Host node
|
55
53
|
#
|
56
54
|
# create_node should be called once for each issue in the xml,
|
@@ -61,24 +59,24 @@ describe 'Burp upload plugin' do
|
|
61
59
|
|
62
60
|
# create_issue should be called once for each issue in the xml
|
63
61
|
expect(@content_service).to receive(:create_issue) do |args|
|
64
|
-
expect(args[:text]).to include("
|
62
|
+
expect(args[:text]).to include("Issue 1")
|
65
63
|
expect(args[:id]).to eq(8781630)
|
66
64
|
OpenStruct.new(args)
|
67
65
|
end.once
|
68
66
|
expect(@content_service).to receive(:create_evidence) do |args|
|
69
67
|
expect(args[:content]).to include('Lorem ipsum dolor sit amet')
|
70
|
-
expect(args[:issue].text).to include("
|
68
|
+
expect(args[:issue].text).to include("Issue 1")
|
71
69
|
expect(args[:node].label).to eq('10.0.0.1')
|
72
70
|
end.once
|
73
71
|
|
74
72
|
expect(@content_service).to receive(:create_issue) do |args|
|
75
|
-
expect(args[:text]).to include("
|
73
|
+
expect(args[:text]).to include("Issue 2")
|
76
74
|
expect(args[:id]).to eq(8781631)
|
77
75
|
OpenStruct.new(args)
|
78
76
|
end.once
|
79
77
|
expect(@content_service).to receive(:create_evidence) do |args|
|
80
78
|
expect(args[:content]).to include('Lorem ipsum dolor sit amet')
|
81
|
-
expect(args[:issue].text).to include("
|
79
|
+
expect(args[:issue].text).to include("Issue 2")
|
82
80
|
expect(args[:node].label).to eq('10.0.0.1')
|
83
81
|
end.once
|
84
82
|
|
@@ -86,24 +84,24 @@ describe 'Burp upload plugin' do
|
|
86
84
|
# that it triggers process_extension_issues instead of process_burp_issues
|
87
85
|
# and the plugin_id is not set to the Type (134217728)
|
88
86
|
expect(@content_service).to receive(:create_issue) do |args|
|
89
|
-
expect(args[:text]).to include("
|
87
|
+
expect(args[:text]).to include("Issue 3")
|
90
88
|
expect(args[:id]).to eq('Issue3')
|
91
89
|
OpenStruct.new(args)
|
92
90
|
end.once
|
93
91
|
expect(@content_service).to receive(:create_evidence) do |args|
|
94
92
|
expect(args[:content]).to include('Lorem ipsum dolor sit amet')
|
95
|
-
expect(args[:issue].text).to include("
|
93
|
+
expect(args[:issue].text).to include("Issue 3")
|
96
94
|
expect(args[:node].label).to eq('10.0.0.1')
|
97
95
|
end.once
|
98
96
|
|
99
97
|
expect(@content_service).to receive(:create_issue) do |args|
|
100
|
-
expect(args[:text]).to include("
|
98
|
+
expect(args[:text]).to include("Issue 4")
|
101
99
|
expect(args[:id]).to eq(8781633)
|
102
100
|
OpenStruct.new(args)
|
103
101
|
end.once
|
104
102
|
expect(@content_service).to receive(:create_evidence) do |args|
|
105
103
|
expect(args[:content]).to include('Lorem ipsum dolor sit amet')
|
106
|
-
expect(args[:issue].text).to include("
|
104
|
+
expect(args[:issue].text).to include("Issue 4")
|
107
105
|
expect(args[:node].label).to eq('10.0.0.1')
|
108
106
|
end.once
|
109
107
|
|
@@ -112,38 +110,37 @@ describe 'Burp upload plugin' do
|
|
112
110
|
end
|
113
111
|
|
114
112
|
it 'returns the highest <severity> at the Issue level' do
|
115
|
-
|
116
113
|
expect(@content_service).to receive(:create_issue) do |args|
|
117
114
|
expect(args[:id]).to eq(8781630)
|
118
|
-
expect(args[:text]).to include("
|
119
|
-
expect(args[:text]).to include("
|
115
|
+
expect(args[:text]).to include("Issue 1")
|
116
|
+
expect(args[:text]).to include("Information")
|
120
117
|
OpenStruct.new(args)
|
121
118
|
end
|
122
119
|
|
123
120
|
expect(@content_service).to receive(:create_evidence) do |args|
|
124
|
-
expect(args[:content]).to include("
|
125
|
-
expect(args[:issue].text).to include("
|
121
|
+
expect(args[:content]).to include("Information")
|
122
|
+
expect(args[:issue].text).to include("Issue 1")
|
126
123
|
expect(args[:node].label).to eq('10.0.0.1')
|
127
124
|
end.once
|
128
125
|
expect(@content_service).to receive(:create_evidence) do |args|
|
129
|
-
expect(args[:content]).to include("
|
130
|
-
expect(args[:issue].text).to include("
|
126
|
+
expect(args[:content]).to include("High")
|
127
|
+
expect(args[:issue].text).to include("Issue 2")
|
131
128
|
expect(args[:node].label).to eq('10.0.0.1')
|
132
129
|
OpenStruct.new(args)
|
133
130
|
end.once
|
134
131
|
expect(@content_service).to receive(:create_evidence) do |args|
|
135
|
-
expect(args[:content]).to include("
|
136
|
-
expect(args[:issue].text).to include("
|
132
|
+
expect(args[:content]).to include("Medium")
|
133
|
+
expect(args[:issue].text).to include("Issue 3")
|
137
134
|
expect(args[:node].label).to eq('10.0.0.1')
|
138
135
|
end.once
|
139
136
|
expect(@content_service).to receive(:create_evidence) do |args|
|
140
|
-
expect(args[:content]).to include("
|
141
|
-
expect(args[:issue].text).to include("
|
137
|
+
expect(args[:content]).to include("High")
|
138
|
+
expect(args[:issue].text).to include("Issue 4")
|
142
139
|
expect(args[:node].label).to eq('10.0.0.1')
|
143
140
|
end.once
|
144
141
|
expect(@content_service).to receive(:create_evidence) do |args|
|
145
|
-
expect(args[:content]).to include("
|
146
|
-
expect(args[:issue].text).to include("
|
142
|
+
expect(args[:content]).to include("Low")
|
143
|
+
expect(args[:issue].text).to include("Issue 5")
|
147
144
|
expect(args[:node].label).to eq('10.0.0.1')
|
148
145
|
end.once
|
149
146
|
|
@@ -151,71 +148,4 @@ describe 'Burp upload plugin' do
|
|
151
148
|
@importer.import(file: 'spec/fixtures/files/burp_issue_severity.xml')
|
152
149
|
end
|
153
150
|
end
|
154
|
-
|
155
|
-
describe Dradis::Plugins::Burp::Html::Importer do
|
156
|
-
before(:each) do
|
157
|
-
# Stub template service
|
158
|
-
templates_dir = File.expand_path('../../templates', __FILE__)
|
159
|
-
expect_any_instance_of(Dradis::Plugins::TemplateService)
|
160
|
-
.to receive(:default_templates_dir).and_return(templates_dir)
|
161
|
-
|
162
|
-
# Init services
|
163
|
-
plugin = Dradis::Plugins::Burp::Html
|
164
|
-
|
165
|
-
@content_service = Dradis::Plugins::ContentService::Base.new(
|
166
|
-
logger: Logger.new(STDOUT),
|
167
|
-
plugin: plugin
|
168
|
-
)
|
169
|
-
|
170
|
-
@importer = plugin::Importer.new(
|
171
|
-
content_service: @content_service,
|
172
|
-
)
|
173
|
-
|
174
|
-
# Stub dradis-plugins methods
|
175
|
-
#
|
176
|
-
# They return their argument hashes as objects mimicking
|
177
|
-
# Nodes, Issues, etc
|
178
|
-
allow(@content_service).to receive(:create_node) do |args|
|
179
|
-
obj = OpenStruct.new(args)
|
180
|
-
obj.define_singleton_method(:set_property) { |_, __| }
|
181
|
-
obj
|
182
|
-
end
|
183
|
-
allow(@content_service).to receive(:create_issue) do |args|
|
184
|
-
OpenStruct.new(args)
|
185
|
-
end
|
186
|
-
allow(@content_service).to receive(:create_evidence) do |args|
|
187
|
-
OpenStruct.new(args)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'creates nodes, issues, and evidence as needed' do
|
192
|
-
|
193
|
-
# Host node
|
194
|
-
#
|
195
|
-
# create_node should be called once for each issue in the xml,
|
196
|
-
# but ContentService knows it's already created and NOOPs
|
197
|
-
expect(@content_service).to receive(:create_node)
|
198
|
-
.with(hash_including label: 'github.com/dradis/dradis-burp')
|
199
|
-
.exactly(1).times
|
200
|
-
|
201
|
-
# # create_issue should be called once for each issue in the xml
|
202
|
-
expect(@content_service).to receive(:create_issue) do |args|
|
203
|
-
expect(args[:text]).to include("#[Title]#\nStrict transport security not enforced")
|
204
|
-
expect(args[:text]).to include('*application*', '@Wi-Fi@')
|
205
|
-
expect(args[:id]).to eq(16777984)
|
206
|
-
OpenStruct.new(args)
|
207
|
-
end.once
|
208
|
-
expect(@content_service).to receive(:create_evidence) do |args|
|
209
|
-
expect(args[:content]).to include('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
|
210
|
-
expect(args[:content]).to include("#[Location]#\nhttp://1.1.1.1/dradis/sessions")
|
211
|
-
expect(args[:issue].text).to include("#[Title]#\nStrict transport security not enforced")
|
212
|
-
expect(args[:issue].text).to include('*application*', '@Wi-Fi@')
|
213
|
-
expect(args[:node].label).to eq('github.com/dradis/dradis-burp')
|
214
|
-
end.once
|
215
|
-
|
216
|
-
# Run the import
|
217
|
-
@importer.import(file: 'spec/fixtures/files/burp.html')
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
151
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-burp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.16.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:
|
11
|
+
date: 2025-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dradis-plugins
|
@@ -126,13 +126,15 @@ files:
|
|
126
126
|
- lib/dradis/plugins/burp/version.rb
|
127
127
|
- lib/dradis/plugins/burp/xml/importer.rb
|
128
128
|
- lib/tasks/thorfile.rb
|
129
|
-
- spec/burp_upload_spec.rb
|
130
129
|
- spec/fixtures/files/burp.html
|
131
130
|
- spec/fixtures/files/burp.xml
|
132
131
|
- spec/fixtures/files/burp_issue_severity.xml
|
133
132
|
- spec/fixtures/files/invalid-utf-issue.xml
|
134
133
|
- spec/fixtures/files/without-base64.xml
|
134
|
+
- spec/html/importer_spec.rb
|
135
135
|
- spec/spec_helper.rb
|
136
|
+
- spec/support/stubbed_mapping_service.rb
|
137
|
+
- spec/xml/importer_spec.rb
|
136
138
|
- templates/html_evidence.sample
|
137
139
|
- templates/html_issue.sample
|
138
140
|
- templates/xml_evidence.sample
|
@@ -161,10 +163,12 @@ signing_key:
|
|
161
163
|
specification_version: 4
|
162
164
|
summary: Burp Scanner upload plugin for the Dradis Framework.
|
163
165
|
test_files:
|
164
|
-
- spec/burp_upload_spec.rb
|
165
166
|
- spec/fixtures/files/burp.html
|
166
167
|
- spec/fixtures/files/burp.xml
|
167
168
|
- spec/fixtures/files/burp_issue_severity.xml
|
168
169
|
- spec/fixtures/files/invalid-utf-issue.xml
|
169
170
|
- spec/fixtures/files/without-base64.xml
|
171
|
+
- spec/html/importer_spec.rb
|
170
172
|
- spec/spec_helper.rb
|
173
|
+
- spec/support/stubbed_mapping_service.rb
|
174
|
+
- spec/xml/importer_spec.rb
|