rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method parse_new_config_file has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_new_config_file(raw_xml)
    db_table = Rex::Text::Table.new(
      'Header' => 'DbVisualizer Databases',
      'Indent' => 2,
      'Columns' =>
Severity: Minor
Found in modules/post/multi/gather/dbvis_enum.rb - About 5 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 gather_minion_data has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def gather_minion_data
    print_status('Gathering data from minions (this can take some time)')
    command = []
    if datastore['GETHOSTNAME']
      command << 'network.get_hostname'
Severity: Minor
Found in modules/post/multi/gather/saltstack_salt.rb - About 5 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 extract_lnk_info has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_lnk_info(path)
    session.fs.dir.foreach(path) do |file_name|
      if file_name =~ /\.lnk$/ # We have a .lnk file
        offset = 0 # TODO: Look at moving this to smaller scope
        lnk_file = session.fs.file.new(path + file_name, 'rb')
Severity: Minor
Found in modules/post/windows/gather/dumplinks.rb - About 5 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 get_creds has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def get_creds
    credentials = []
    # call credenumerate to get the ptr needed
    adv32 = session.railgun.advapi32
    begin
Severity: Minor
Found in modules/post/windows/gather/credentials/enum_cred_store.rb - About 5 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 list_path has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def list_path(path, columns, sort, order, short, recursive = false, depth = 0, search_term = nil)

    # avoid infinite recursion
    if depth > 100
      return
Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb - About 5 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

File shell.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'metasm'

module MetasploitModule

  include Msf::Sessions::CommandShellOptions
Severity: Minor
Found in modules/payloads/stages/netware/shell.rb - About 5 hrs to fix

    File developer.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Msf::Ui::Console::CommandDispatcher::Developer
    
      include Msf::Ui::Console::CommandDispatcher
    
      @@irb_opts = Rex::Parser::Arguments.new(
    Severity: Minor
    Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 5 hrs to fix

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

        def run_host(ip)
      
          #
          # Max string len
          #
      Severity: Major
      Found in modules/auxiliary/scanner/http/xpath.rb - About 5 hrs to fix

        Method initialize has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Script Web Delivery',
        Severity: Major
        Found in modules/exploits/multi/script/web_delivery.rb - About 5 hrs to fix

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

              this.asInt16 = function() {
                  var value = new Int64(0);
                  for (var i = 0; i < 8; i++) {
                      if (i < 2) {
                          value.bytes[i] = this.bytes[i];
          Severity: Major
          Found in data/exploits/javascript_utils/int64.js and 1 other location - About 5 hrs to fix
          data/exploits/javascript_utils/int64.js on lines 92..103

          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 146.

          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

              this.asInt32 = function() {
                  var value = new Int64(0);
                  for (var i = 0; i < 8; i++) {
                      if (i < 4) {
                          value.bytes[i] = this.bytes[i];
          Severity: Major
          Found in data/exploits/javascript_utils/int64.js and 1 other location - About 5 hrs to fix
          data/exploits/javascript_utils/int64.js on lines 105..116

          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 146.

          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 openssl_heartbeat_client_memory.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class MetasploitModule < Msf::Auxiliary
            include Msf::Exploit::Remote::TcpServer
            include Msf::Auxiliary::Report
          
            def initialize
          Severity: Minor
          Found in modules/auxiliary/server/openssl_heartbeat_client_memory.rb - About 5 hrs to fix

            File http_ntlm.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            NTLM_CONST = Rex::Proto::NTLM::Constants
            NTLM_CRYPT = Rex::Proto::NTLM::Crypt
            MESSAGE = Rex::Proto::NTLM::Message
            
            class MetasploitModule < Msf::Auxiliary
            Severity: Minor
            Found in modules/auxiliary/server/capture/http_ntlm.rb - About 5 hrs to fix

              File zyxel_lfi_unauth_ssh_rce.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'socket'
              require 'digest/md5'
              
              class MetasploitModule < Msf::Exploit::Remote
                Rank = ExcellentRanking
              Severity: Minor
              Found in modules/exploits/linux/http/zyxel_lfi_unauth_ssh_rce.rb - About 5 hrs to fix

                Method post_4a has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def post_4a
                    {
                      'ADD' => '4A',
                      'custom_fields_modify' => '0',
                      'user' => '111',
                Severity: Major
                Found in modules/auxiliary/scanner/http/vicidial_multiple_sqli.rb - About 5 hrs to fix

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

                    def capture_user_keys
                      users = {}
                      ok = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, 'SAM\\SAM\\Domains\\Account\\Users', KEY_READ)
                      return if !ok
                  
                  
                  Severity: Major
                  Found in modules/post/windows/gather/smart_hashdump.rb and 1 other location - About 5 hrs to fix
                  modules/post/windows/gather/hashdump.rb on lines 173..218

                  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 183.

                  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

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

                    def capture_user_keys
                      users = {}
                      ok = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, 'SAM\\SAM\\Domains\\Account\\Users', KEY_READ)
                      return if !ok
                  
                  
                  Severity: Major
                  Found in modules/post/windows/gather/hashdump.rb and 1 other location - About 5 hrs to fix
                  modules/post/windows/gather/smart_hashdump.rb on lines 92..137

                  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 183.

                  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 ms16_051_vbscript.rb has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class MetasploitModule < Msf::Exploit::Remote
                    Rank = NormalRanking
                  
                    include Msf::Exploit::Remote::HttpServer
                    include Msf::Exploit::EXE
                  Severity: Minor
                  Found in modules/exploits/windows/browser/ms16_051_vbscript.rb - About 5 hrs to fix

                    Class Post has 41 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Post
                    module Windows
                    
                    module Registry
                    
                    
                    Severity: Minor
                    Found in lib/msf/core/post/windows/registry.rb - About 5 hrs to fix

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

                        def process_propfind(cli, request)
                          path = request.uri
                          vprint_status("PROPFIND #{path}")
                      
                          if path !~ /\/$/
                      Severity: Major
                      Found in modules/exploits/windows/http/cogent_datahub_command.rb and 1 other location - About 5 hrs to fix
                      modules/exploits/windows/http/sap_host_control_cmd_exec.rb on lines 137..249

                      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 182.

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language