File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
ui/console/command_dispatcher Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -778,8 +778,13 @@ def cmd_info(*args)
778
778
if dump_json
779
779
print ( Serializer ::Json . dump_module ( active_module ) + "\n " )
780
780
elsif show_doc
781
- print_status ( "Please wait, generating documentation for #{ active_module . shortname } " )
782
- Msf ::Util ::DocumentGenerator . spawn_module_document ( active_module )
781
+ f = Rex ::Quickfile . new ( [ "#{ active_module . shortname } _doc" , '.html' ] )
782
+ begin
783
+ print_status ( "Generating documentation for #{ active_module . shortname } , then opening #{ f . path } in a browser..." )
784
+ Msf ::Util ::DocumentGenerator . spawn_module_document ( active_module , f )
785
+ ensure
786
+ f . close if f
787
+ end
783
788
else
784
789
print ( Serializer ::ReadableText . dump_module ( active_module ) )
785
790
end
@@ -801,8 +806,13 @@ def cmd_info(*args)
801
806
elsif dump_json
802
807
print ( Serializer ::Json . dump_module ( mod ) + "\n " )
803
808
elsif show_doc
804
- print_status ( "Please wait, generating documentation for #{ mod . shortname } " )
805
- Msf ::Util ::DocumentGenerator . spawn_module_document ( mod )
809
+ f = Rex ::Quickfile . new ( [ "#{ active_module . shortname } _doc" , '.html' ] )
810
+ begin
811
+ print_status ( "Generating documentation for #{ active_module . shortname } , then opening #{ f . path } in a browser..." )
812
+ Msf ::Util ::DocumentGenerator . spawn_module_document ( active_module , f )
813
+ ensure
814
+ f . close if f
815
+ end
806
816
else
807
817
print ( Serializer ::ReadableText . dump_module ( mod ) )
808
818
end
Original file line number Diff line number Diff line change @@ -15,15 +15,12 @@ module DocumentGenerator
15
15
# Spawns a module document with a browser locally.
16
16
#
17
17
# @param mod [Msf::Module] Module to create document for.
18
+ # @param out_file [Rex::Quickfile] File handle to write the document to.
18
19
# @return [void]
19
- def self . spawn_module_document ( mod )
20
+ def self . spawn_module_document ( mod , out_file )
20
21
md = get_module_document ( mod )
21
- f = Rex ::Quickfile . new ( [ "#{ mod . shortname } _doc" , '.html' ] )
22
- f . write ( md )
23
- f . close
24
- kb_path = f . path
25
-
26
- Rex ::Compat . open_webrtc_browser ( "file://#{ kb_path } " )
22
+ out_file . write ( md )
23
+ Rex ::Compat . open_webrtc_browser ( "file://#{ out_file . path } " )
27
24
end
28
25
29
26
You can’t perform that action at this time.
0 commit comments