Add URL scheme and Base64.encode64 checks to msftdiy

GSoC/Meterpreter_Web_Console
Brendan Coles 2019-02-04 21:16:01 +00:00
parent 7cddbcbc65
commit d38e12c124
1 changed files with 11 additions and 1 deletions

View File

@ -265,6 +265,10 @@ class Msftidy
if @source =~ /^# This file is part of the Metasploit Framework and may be subject to/
warn("Module contains old license comment.")
end
if @source =~ /^# This module requires Metasploit: http:/
warn("Module license comment link does not use https:// URL scheme.")
fixed('# This module requires Metasploit: https://metasploit.com/download', idx)
end
end
def check_old_keywords
@ -609,8 +613,14 @@ class Msftidy
if ln =~ /['"]ExitFunction['"]\s*=>/
warn("Please use EXITFUNC instead of ExitFunction #{ln}", idx)
fixed(line.gsub('ExitFunction', 'EXITFUNC'), idx)
end
# Output from Base64.encode64 method contains '\n' new lines
# for line wrapping and string termination
if ln =~ /Base64\.encode64/
info("Please use Base64.strict_encode64 instead of Base64.encode64")
end
end
end
@ -647,7 +657,7 @@ class Msftidy
# This module then got copied and committed 20+ times and is used in numerous other places.
# This ensures that this stops.
def check_invalid_url_scheme
test = @source.scan(/^#.+http\/\/(?:www\.)?metasploit.com/)
test = @source.scan(/^#.+https?\/\/(?:www\.)?metasploit.com/)
unless test.empty?
test.each { |item|
warn("Invalid URL: #{item}")