modules/post/windows/gather/credentials/outlook.rb
Method get_registry
has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_registry(outlook_ver)
# Determine if saved accounts exist within Outlook. Ignore the Address Book and Personal Folder registry entries.
outlook_exists = 0
saved_accounts = 0
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method get_registry
has 245 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_registry(outlook_ver)
# Determine if saved accounts exist within Outlook. Ignore the Address Book and Personal Folder registry entries.
outlook_exists = 0
saved_accounts = 0
File outlook.rb
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Registry
include Msf::Post::Windows::Priv
include Msf::Auxiliary::Report
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Windows Gather Microsoft Outlook Saved Password Extraction',
Avoid deeply nested control flow statements. Open
Open
if !imap_use_spa.nil? # Account for SPA (NTLM auth)
print_status(' Secure Password Authentication (SPA): Enabled')
end
Avoid deeply nested control flow statements. Open
Open
if http_server_url.include? "h\x00t\x00t\x00p\x00s"
portnum = 443
else
portnum = 80
end
Avoid deeply nested control flow statements. Open
Open
if smtp_use_ssl.nil?
print_status(' SMTP Use SSL: No')
else
print_status(' SMTP Use SSL: Yes')
end
Avoid deeply nested control flow statements. Open
Open
if imap_password.nil?
print_status(' User Password: <not stored>')
else
imap_password.slice!(0, 1)
pass = decrypt_password(imap_password)
Avoid deeply nested control flow statements. Open
Open
if imap_use_ssl.nil?
print_status(' IMAP Use SSL: No')
else
print_status(' IMAP Use SSL: Yes')
end
Avoid deeply nested control flow statements. Open
Open
if smtp_use_auth.nil? # Account for SMTP servers requiring authentication
print_status(" Outgoing Mail Server (SMTP): #{smtp_server}")
else
print_status(" Outgoing Mail Server (SMTP): #{smtp_server} [Authentication Required]")
# Check if smtp_auth_method is null. If so, the inbound credentials are utilized
Avoid deeply nested control flow statements. Open
Open
if imap_port.nil?
print_status(' IMAP Port: 143')
portnum = 143
else
print_status(" IMAP Port: #{imap_port}")
Avoid deeply nested control flow statements. Open
Open
if smtp_port.nil?
print_status(' SMTP Port: 25')
smtp_port = 25
else
print_status(" SMTP Port: #{smtp_port}")