File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
lib/msf/util/document_generator
spec/lib/msf/util/document_generator Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def normalize_pull_requests(pull_requests)
144
144
formatted_pr = [ ]
145
145
146
146
pull_requests . each_pair do |number , pr |
147
- formatted_pr << "* <a href= \" https://github.com/rapid7/metasploit-framework/pull/#{ number } \" ># #{ number } </a> - #{ pr [ :title ] } "
147
+ formatted_pr << "* [# #{ number } #{ pr [ :title ] } ]( https://github.com/rapid7/metasploit-framework/pull/#{ number } ) "
148
148
end
149
149
150
150
formatted_pr * "\n "
@@ -204,7 +204,23 @@ def normalize_targets(targets)
204
204
# @param refs [Array] Module references.
205
205
# @return [String]
206
206
def normalize_references ( refs )
207
- refs . collect { |r | "* <a href=\" #{ r } \" >#{ r } </a>" } * "\n "
207
+ normalized = ''
208
+ refs . each do |ref |
209
+ case ref . ctx_id
210
+ when 'AKA'
211
+ normalized << "* *Also known as:* #{ ref . ctx_val } "
212
+ when 'MSB'
213
+ normalized << "* [#{ ref . ctx_val } ](#{ ref . site } )"
214
+ when 'URL'
215
+ normalized << "* [#{ ref . site } ](#{ ref . site } )"
216
+ when 'US-CERT-VU'
217
+ normalized << "* [VU##{ ref . ctx_val } ](#{ ref . site } )"
218
+ else
219
+ normalized << "* [#{ ref . ctx_id } -#{ ref . ctx_val } ](#{ ref . site } )"
220
+ end
221
+ normalized << "\n "
222
+ end
223
+ normalized
208
224
end
209
225
210
226
Original file line number Diff line number Diff line change 1
1
require 'rex'
2
+ require 'msf/core/module/reference'
2
3
require 'msf/util/document_generator'
3
4
require 'msf/util/document_generator/pull_request_finder'
4
5
10
11
let ( :mod_shortname ) { 'ms08_067_netapi' }
11
12
let ( :mod_name ) { 'MS08-067' }
12
13
let ( :mod_pull_requests ) { good_pull_requests }
13
- let ( :mod_refs ) { [ 'URL' , 'http://example.com' ] }
14
+ let ( :mod_refs ) { [ Msf :: Module :: SiteReference . new ( 'URL' , 'http://example.com' ) ] }
14
15
let ( :mod_platforms ) { 'win' }
15
16
let ( :mod_options ) { { 'RHOST' => rhost_option } }
16
17
let ( :mod_normal_rank ) { 300 }
111
112
describe 'normalize_pull_requests' do
112
113
context 'when a hash of pull requests are given' do
113
114
it 'returns HTML links' do
114
- expect ( subject . send ( :normalize_pull_requests , good_pull_requests ) ) . to include ( '* <a href= ' )
115
+ expect ( subject . send ( :normalize_pull_requests , good_pull_requests ) ) . to include ( '](https://github.com/ ' )
115
116
end
116
117
end
117
118
159
160
describe 'normalize_references' do
160
161
context 'when an array of references is given' do
161
162
it 'returns the reference list in HTML' do
162
- expect ( subject . send ( :normalize_references , msf_mod . references ) ) . to include ( '* <a href= ' )
163
+ expect ( subject . send ( :normalize_references , msf_mod . references ) ) . to include ( '* [http:// ' )
163
164
end
164
165
end
165
166
end
You can’t perform that action at this time.
0 commit comments