Class: Msf::Util::DocumentGenerator::DocumentNormalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/util/document_generator/normalizer.rb

Constant Summary collapse

CSS_BASE_PATH =

Markdown templates

'markdown.css'
HTML_TEMPLATE =
'html_template.erb'
TEMPLATE_PATH =
'default_template.erb'
REMOTE_EXPLOIT_DEMO_TEMPLATE =

Demo templates

'remote_exploit_demo_template.erb'
BES_DEMO_TEMPLATE =
'bes_demo_template.erb'
HTTPSERVER_DEMO_TEMPLATE =
'httpserver_demo_template.erb'
GENERIC_DEMO_TEMPLATE =
'generic_demo_template.erb'
LOCALEXPLOIT_DEMO_TEMPLATE =
'localexploit_demo_template.erb'
POST_DEMO_TEMPLATE =
'post_demo_template.erb'
AUXILIARY_SCANNER_DEMO_TEMPLATE =
'auxiliary_scanner_template.erb'
PAYLOAD_DEMO_TEMPLATE =
'payload_demo_template.erb'
EVASION_DEMO_TEMPLATE =
'evasion_demo_template.erb'
NO_CVE_MESSAGE =

Special messages

%Q|CVE: [Not available](https://github.com/rapid7/metasploit-framework/wiki/Why-CVE-is-not-available)|

Instance Method Summary collapse

Instance Method Details

#get_md_content(items, kb) ⇒ String

Returns the module document in HTML form.

Parameters:

  • items (Hash)

    Items to be documented.

  • kb (String)

    Additional information to be added in the doc.

Returns:

  • (String)

    HTML.


78
79
80
81
82
83
84
85
86
# File 'lib/msf/util/document_generator/normalizer.rb', line 78

def get_md_content(items, kb)
  @md_template ||= lambda {
    template = ''
    path = File.expand_path(File.join(Msf::Config.data_directory, 'markdown_doc', TEMPLATE_PATH))
    File.open(path, 'rb') { |f| template = f.read }
    return template
  }.call
  md_to_html(ERB.new(@md_template).result(binding()), kb)
end