Land #6977, Add a more verbose message when generating module documentation

This commit is contained in:
thao doan
2016-06-15 14:55:55 -07:00
2 changed files with 18 additions and 11 deletions
+14 -4
View File
@@ -778,8 +778,13 @@ class Core
if dump_json
print(Serializer::Json.dump_module(active_module) + "\n")
elsif show_doc
print_status("Please wait, generating documentation for #{active_module.shortname}")
Msf::Util::DocumentGenerator.spawn_module_document(active_module)
f = Rex::Quickfile.new(["#{active_module.shortname}_doc", '.html'])
begin
print_status("Generating documentation for #{active_module.shortname}, then opening #{f.path} in a browser...")
Msf::Util::DocumentGenerator.spawn_module_document(active_module, f)
ensure
f.close if f
end
else
print(Serializer::ReadableText.dump_module(active_module))
end
@@ -801,8 +806,13 @@ class Core
elsif dump_json
print(Serializer::Json.dump_module(mod) + "\n")
elsif show_doc
print_status("Please wait, generating documentation for #{mod.shortname}")
Msf::Util::DocumentGenerator.spawn_module_document(mod)
f = Rex::Quickfile.new(["#{active_module.shortname}_doc", '.html'])
begin
print_status("Generating documentation for #{active_module.shortname}, then opening #{f.path} in a browser...")
Msf::Util::DocumentGenerator.spawn_module_document(active_module, f)
ensure
f.close if f
end
else
print(Serializer::ReadableText.dump_module(mod))
end
+4 -7
View File
@@ -15,15 +15,12 @@ module Msf
# Spawns a module document with a browser locally.
#
# @param mod [Msf::Module] Module to create document for.
# @param out_file [Rex::Quickfile] File handle to write the document to.
# @return [void]
def self.spawn_module_document(mod)
def self.spawn_module_document(mod, out_file)
md = get_module_document(mod)
f = Rex::Quickfile.new(["#{mod.shortname}_doc", '.html'])
f.write(md)
f.close
kb_path = f.path
Rex::Compat.open_webrtc_browser("file://#{kb_path}")
out_file.write(md)
Rex::Compat.open_webrtc_browser("file://#{out_file.path}")
end