rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    return unless session_good?

    print_status("Running module against #{sysinfo['Computer']}")

Severity: Minor
Found in modules/post/multi/manage/autoroute.rb - About 45 mins 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 find_db_paths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def find_db_paths(path, browser, account)
    paths = []

    vprint_status "Checking #{account}'s #{browser}"
    if browser == 'IE' # Special case for IE
Severity: Minor
Found in modules/post/multi/gather/lastpass_creds.rb - About 45 mins 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 show_report has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def show_report(res, filename)
    md5 = res['md5'] || ''
    sha1 = res['sha1'] || ''
    sha256 = res['sha256'] || ''

Severity: Minor
Found in modules/post/multi/gather/check_malware.rb - About 45 mins 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 read_registry_key_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def read_registry_key_value(key, value)
    begin
      root_key, base_key = session.sys.registry.splitkey(key)
      reg_key = session.sys.registry.open_key(root_key, base_key, KEY_READ)
      return nil unless reg_key
Severity: Minor
Found in modules/post/multi/gather/lastpass_creds.rb - About 45 mins 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 winhome has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def winhome
    home = []
    exec = cmd_exec('WMIC PROCESS get Caption,Commandline').split("\n")
    exec.each do |line|
      next unless line.downcase.include?('java.exe') && line.downcase.include?('jboss')
Severity: Minor
Found in modules/post/multi/gather/jboss_gather.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

              rescue Rex::Post::Meterpreter::RequestError
                print_error("Failed to resolve SLD hostname: #{sld_hostname}")
Severity: Major
Found in modules/post/multi/sap/smdagent_get_properties.rb - About 45 mins to fix

    Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        unless check
          fail_with Failure::NotVulnerable, 'Target is not vulnerable'
        end
    
    
    Severity: Minor
    Found in modules/post/solaris/escalate/srsexec_readline.rb - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        id = cmd_exec('id')
        unless id =~ (/root/) || id =~ (/shell/)
          print_error('This module requires shell or root permissions')
          return
    Severity: Minor
    Found in modules/post/android/capture/screen.rb - About 45 mins 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 connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def connect(host)
        if @adv.nil?
          return
        end
    
    
    Severity: Minor
    Found in modules/post/windows/gather/local_admin_search_enum.rb - About 45 mins 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 virtualbox? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def virtualbox?
        vboxprocs = [
          'vboxservice.exe',
          'vboxtray.exe'
        ]
    Severity: Minor
    Found in modules/post/windows/gather/checkvm.rb - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        fields = datastore['FIELDS'].gsub(/\s+/, '').split(',')
        search_filter = datastore['FILTER']
        max_search = datastore['MAX_SEARCH']
    
    
    Severity: Minor
    Found in modules/post/windows/gather/enum_ad_user_comments.rb - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        fields = datastore['FIELDS'].gsub(/\s+/, '').split(',')
        search_filter = datastore['FILTER']
        max_search = datastore['MAX_SEARCH']
    
    
    Severity: Minor
    Found in modules/post/windows/gather/enum_ad_bitlocker.rb - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

              if migrate_system
                print_status('Trying to get SYSTEM privilege')
                results = session.priv.getsystem
                if results[0]
                  print_good('Got SYSTEM privilege')
    Severity: Major
    Found in modules/post/windows/gather/smart_hashdump.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (loc['flags'] & 0x01) > 0
      
                      @data_out += "\tShortcut file is on a local volume.\n"
      
                      lnk_file.sysseek(offset + loc['vol_ofs'], ::IO::SEEK_SET)
      Severity: Major
      Found in modules/post/windows/gather/dumplinks.rb - About 45 mins to fix

        Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            @user_fields = USER_FIELDS.dup
        
            if datastore['ADDITIONAL_FIELDS']
              additional_fields = datastore['ADDITIONAL_FIELDS'].gsub(/\s+/, '').split(',')
        Severity: Minor
        Found in modules/post/windows/gather/enum_ad_managedby_groups.rb - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                next unless user['Favorites']
        Severity: Major
        Found in modules/post/windows/gather/get_bookmarks.rb - About 45 mins to fix

          Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def run
              unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Extapi::COMMAND_ID_EXTAPI_WMI_QUERY)
                fail_with(Failure::NoTarget, 'Session does not support Meterpreter ExtAPI WMI queries')
              end
          
          
          Severity: Minor
          Found in modules/post/windows/gather/enum_patches.rb - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def run
              domain = get_domain_name
          
              fail_with(Failure::Unknown, 'Could not retrieve domain name. Is the host part of a domain?') unless domain && !domain.empty?
          
          
          Severity: Minor
          Found in modules/post/windows/gather/enum_domain.rb - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                    next if ['.', '..'].include?(file)
          Severity: Major
          Found in modules/post/windows/gather/get_bookmarks.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                          if loc['base_ofs'] > 0
                            @data_out += get_target_path(loc['base_ofs'] + offset, lnk_file)
                          elsif loc['path_ofs'] > 0
                            @data_out += get_target_path(loc['path_ofs'] + offset, lnk_file)
                          end
            Severity: Major
            Found in modules/post/windows/gather/dumplinks.rb - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language