rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method get_executable_symbols has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

          def get_executable_symbols(coff)
            executable_symbols = []
            coff.symbols.each do |sym|
              next unless sym
              next unless sym.sec_nr.is_a? Integer
Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 4 hrs to fix

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 creds_add has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def creds_add(*args)
    params = args.inject({}) do |hsh, n|
      opt = n.split(':') # Splitting the string on colons.
      hsh[opt[0]] = opt[1..-1].join(':') # everything before the first : is the key, reasembling everything after the colon. why ntlm hashes
      hsh
Severity: Minor
Found in lib/msf/ui/console/command_dispatcher/creds.rb - About 4 hrs to fix

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 check_multiple has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def check_multiple(mod)
    rhosts_walker = Msf::RhostsWalker.new(mod.datastore['RHOSTS'], mod.datastore).to_enum
    rhosts_walker_count = rhosts_walker.count

    # Short-circuit check_multiple if it's a single host, or doesn't have any hosts set
Severity: Minor
Found in lib/msf/ui/console/module_command_dispatcher.rb - About 4 hrs to fix

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 start_handler has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def start_handler

    # Maximum number of seconds to run the handler
    ctimeout = 150

Severity: Minor
Found in lib/msf/core/handler/bind_udp.rb - About 4 hrs to fix

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 import_nessus_nbe has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def import_nessus_nbe(args={}, &block)
    nbe_data = args[:data]
    wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
    bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []

Severity: Minor
Found in lib/msf/core/db_manager/import/nessus/nbe.rb - About 4 hrs to fix

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 update_all_module_details has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def update_all_module_details
    return if not self.migrated
    return if self.modules_caching

    self.framework.cache_thread = Thread.current
Severity: Minor
Found in lib/msf/core/db_manager/module_cache.rb - About 4 hrs to fix

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 http_fingerprint has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def http_fingerprint(opts={})
    res    = nil
    uri    = opts[:uri] || '/'
    method = opts[:method] || 'GET'

Severity: Minor
Found in lib/msf/core/exploit/remote/http_client.rb - About 4 hrs to fix

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 arkeia_info has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def arkeia_info
    connect

    info = { }
    resp = ''
Severity: Minor
Found in lib/msf/core/exploit/remote/arkeia.rb - About 4 hrs to fix

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 load_credential_from_file has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def load_credential_from_file(file_path, options = {})
    unless File.readable?(file_path.to_s)
      wlog("Failed to load ticket file '#{file_path}' (file not readable)")
      return nil
    end
Severity: Minor
Found in lib/msf/core/exploit/remote/kerberos/service_authenticator/base.rb - About 4 hrs to fix

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 dump_table_fields has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def dump_table_fields(table, columns, condition = '', num_limit = 0)
      return '' if columns.empty?

      columns = columns.map do |col|
        col = "cast(isnull(#{col},'#{@null_replacement}') as varchar(max))"
Severity: Minor
Found in lib/msf/core/exploit/sqli/mssqli/common.rb - About 4 hrs to fix

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            elif self.__dcomObject == 'ShellBrowserWindow':
                # ShellBrowserWindow CLSID (Windows 10, Windows Server 2012R2)
                iInterface = dcom.CoCreateInstanceEx(string_to_bin('C08AFD90-F2A1-11D1-8455-00A0C91F3880'), IID_IDispatch)
                iMMC = IDispatch(iInterface)
                resp = iMMC.GetIDsOfNames(('Document',))
Severity: Major
Found in modules/auxiliary/scanner/smb/impacket/dcomexec.py and 1 other location - About 4 hrs to fix
modules/auxiliary/scanner/smb/impacket/dcomexec.py on lines 150..155

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            elif self.__dcomObject == 'MMC20':
                iInterface = dcom.CoCreateInstanceEx(string_to_bin('49B2791A-B1AE-4C90-9B8E-E860BA07F889'), IID_IDispatch)
                iMMC = IDispatch(iInterface)
                resp = iMMC.GetIDsOfNames(('Document',))
                resp = iMMC.Invoke(resp[0], 0x409, DISPATCH_PROPERTYGET, dispParams, 0, [], [])
Severity: Major
Found in modules/auxiliary/scanner/smb/impacket/dcomexec.py and 1 other location - About 4 hrs to fix
modules/auxiliary/scanner/smb/impacket/dcomexec.py on lines 143..149

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  def get_dtcs(bus, src_id, dst_id, opt = {})
    dtcs = []
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
Severity: Major
Found in lib/msf/core/post/hardware/automotive/uds.rb and 1 other location - About 4 hrs to fix
lib/msf/core/post/hardware/automotive/uds.rb on lines 469..509

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  def get_frozen_dtcs(bus, src_id, dst_id, opt = {})
    dtcs = []
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
Severity: Major
Found in lib/msf/core/post/hardware/automotive/uds.rb and 1 other location - About 4 hrs to fix
lib/msf/core/post/hardware/automotive/uds.rb on lines 387..427

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File blind_sql_query.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HttpClient
  include Msf::Auxiliary::WmapScanUniqueQuery
  include Msf::Auxiliary::Scanner
  include Msf::Auxiliary::Report
Severity: Minor
Found in modules/auxiliary/scanner/http/blind_sql_query.rb - About 4 hrs to fix

    File cracker.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Metasploit
      module Framework
        module PasswordCracker
          class PasswordCrackerNotFoundError < StandardError
          end
    Severity: Minor
    Found in lib/metasploit/framework/password_crackers/cracker.rb - About 4 hrs to fix

      Method on_request_uri has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def on_request_uri(cli, request)
          print_status("Request '#{request.method} #{request.uri}'")
      
          if request.method.downcase == 'post'
            collect_data(request)
      Severity: Major
      Found in modules/auxiliary/gather/android_stock_browser_uxss.rb - About 4 hrs to fix

        Method run has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run
            # Add padding to bypass TYPO3 security filters
            #
            # Null byte fixed in PHP 5.3.4
            #
        Severity: Major
        Found in modules/auxiliary/admin/http/typo3_winstaller_default_enc_keys.rb - About 4 hrs to fix

          Method run_host has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run_host(ip)
              extensions = [
                '.null',
                '.backup',
                '.bak',
          Severity: Major
          Found in modules/auxiliary/scanner/http/files_dir.rb - About 4 hrs to fix

            Method exploit has 114 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def exploit
                uri = target_uri.path
            
                print_status("Grabbing version and login CSRF token...")
                response = send_request_cgi({
            Severity: Major
            Found in modules/exploits/multi/http/mediawiki_thumb.rb - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language