Skip to content

Commit 2a79319

Browse files
committed
Support local knowledge base documents
1 parent 6721b79 commit 2a79319

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/msf/util/document_generator.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ def self.spawn_module_document(mod, out_file)
2929
# @param mod [Msf::Module] Module to create document for.
3030
# @return [void]
3131
def self.get_module_document(mod)
32-
md = ''
33-
34-
kb_path = File.join(PullRequestFinder::MANUAL_BASE_PATH, "#{mod.fullname}.md")
32+
kb_path = nil
3533
kb = ''
3634

37-
if File.exist?(kb_path)
35+
if File.exists?(File.join(PullRequestFinder::MANUAL_BASE_PATH, "#{mod.fullname}.md"))
36+
kb_path = File.join(PullRequestFinder::MANUAL_BASE_PATH, "#{mod.fullname}.md")
37+
elsif File.exists?(File.join(PullRequestFinder::USER_MANUAL_BASE_PATH, "#{mod.fullname}.md"))
38+
kb_path = File.join(PullRequestFinder::USER_MANUAL_BASE_PATH, "#{mod.fullname}.md")
39+
end
40+
41+
unless kb_path.nil?
3842
File.open(kb_path, 'rb') { |f| kb = f.read }
3943
end
4044

lib/msf/util/document_generator/pull_request_finder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class PullRequestFinder
1111
class Exception < RuntimeError; end
1212

1313
MANUAL_BASE_PATH = File.expand_path(File.join(Msf::Config.module_directory, '..', 'documentation', 'modules' ))
14+
USER_MANUAL_BASE_PATH = File.expand_path(File.join(Msf::Config.user_module_directory, '..', 'documentation', 'modules' ))
1415

1516
# @return [Octokit::Client] Git client
1617
attr_accessor :git_client

0 commit comments

Comments
 (0)