rapid7/metasploit-framework

View on GitHub

Showing 22,004 of 22,004 total issues

File linksys_wrt54gl_apply_exec.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Exploit::Remote
  Rank = ManualRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::Remote::HttpServer
Severity: Minor
Found in modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb - About 4 hrs to fix

    File message.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Rex
    module Proto
    module NTLM
    class Message < Rex::Proto::NTLM::Base::FieldSet
    
    
    Severity: Minor
    Found in lib/rex/proto/ntlm/message.rb - About 4 hrs to fix

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

        def enum_interfaces(wlan_handle)
          iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
          pointer = iflist['ppInterfaceList']
      
          numifs = @host_process.memory.read(pointer, 4)
      Severity: Major
      Found in modules/post/windows/wlan/wlan_probe_request.rb and 3 other locations - About 4 hrs to fix
      modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
      modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
      modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345

      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

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

        def enum_interfaces(wlan_handle)
          iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
          pointer = iflist['ppInterfaceList']
      
          numifs = @host_process.memory.read(pointer, 4)
      Severity: Major
      Found in modules/post/windows/wlan/wlan_current_connection.rb and 3 other locations - About 4 hrs to fix
      modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
      modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345
      modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

      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

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

        def enum_interfaces(wlan_handle)
          iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
          pointer = iflist['ppInterfaceList']
      
          numifs = @host_process.memory.read(pointer, 4)
      Severity: Major
      Found in modules/post/windows/wlan/wlan_disconnect.rb and 3 other locations - About 4 hrs to fix
      modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
      modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
      modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

      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

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

        def enum_interfaces(wlan_handle)
          iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
          pointer = iflist['ppInterfaceList']
      
          numifs = @host_process.memory.read(pointer, 4)
      Severity: Major
      Found in modules/post/windows/wlan/wlan_bss_list.rb and 3 other locations - About 4 hrs to fix
      modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
      modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345
      modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

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

      class MetasploitModule < Msf::Auxiliary
        include Msf::Exploit::Remote::HttpClient
        include Msf::Auxiliary::Report
        include Msf::Module::Deprecated
      
      
      Severity: Minor
      Found in modules/auxiliary/gather/elasticsearch_enum.rb - About 4 hrs to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Monitorr unauthenticated Remote Code Execution (RCE)',
        Severity: Major
        Found in modules/exploits/multi/http/monitorr_webshell_rce_cve_2020_28871.rb - About 4 hrs to fix

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

            def initialize(info = {})
              super(
                update_info(
                  info,
                  'Name' => 'Apache Solr Remote Code Execution via Velocity Template',
          Severity: Major
          Found in modules/exploits/multi/http/solr_velocity_rce.rb - About 4 hrs to fix

            Method send_payload_objdata has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def send_payload_objdata
                # basic weblogic ClassTableEntry object (serialized)
                # TODO: WHAT DOES THIS DO?  CAN WE RANDOMIZE ANY OF IT?
                objdata = '056508000000010000001b0000005d0101007372017870737202787000000000'
                objdata << '00000000757203787000000000787400087765626c6f67696375720478700000'
            Severity: Major
            Found in modules/exploits/multi/misc/weblogic_deserialize_rawobject.rb - About 4 hrs to fix

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

                def initialize(info = {})
                  super(
                    update_info(
                      info,
                      {
              Severity: Major
              Found in modules/exploits/windows/local/bits_ntlm_token_impersonation.rb - About 4 hrs to fix

                File msadc.rb has 345 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'rex/exploitation'
                
                class MetasploitModule < Msf::Exploit::Remote
                  Rank = ExcellentRanking
                
                
                Severity: Minor
                Found in modules/exploits/windows/iis/msadc.rb - About 4 hrs to fix

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

                    def exploit
                  
                      @basename = rand_text_alpha(3)
                      @share_name = rand_text_alpha(3)
                      @extensions = "exe"
                  Severity: Major
                  Found in modules/exploits/windows/http/sap_host_control_cmd_exec.rb - About 4 hrs to fix

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

                      def exploit
                    
                        print_status("Creating '#{datastore['FILENAME']}' using target '#{target.name}' ...")
                    
                        sploit = "[CloneCD]\r\n"
                    Severity: Major
                    Found in modules/exploits/windows/fileformat/ultraiso_ccd.rb - About 4 hrs to fix

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

                        def run
                          case session.platform
                          when 'windows'
                            if command_exists?('wmic') == false
                              print_error("The 'wmic' command doesn't exist on this host!") # wmic is technically marked as depreciated so this command could very well be removed in future releases.
                      Severity: Major
                      Found in modules/post/multi/gather/enum_software_versions.rb - About 4 hrs to fix

                        Method init_proc has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def init_proc
                            %Q^
                              HANDLE* init_process(SOCKET s)
                              {
                                char cmd[] = { 'c', 'm', 'd', 0 };
                        Severity: Major
                        Found in lib/msf/core/payload/windows/encrypted_reverse_tcp.rb - About 4 hrs to fix

                          File uptime_file_upload_2.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'nokogiri'
                          
                          class MetasploitModule < Msf::Exploit::Remote
                            Rank = ExcellentRanking
                          
                          
                          Severity: Minor
                          Found in modules/exploits/multi/http/uptime_file_upload_2.rb - About 4 hrs to fix

                            File postbox.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class MetasploitModule < Msf::Post
                            
                              # this associative array defines the artifacts known to PackRat
                              include Msf::Post::File
                              include Msf::Post::Windows::UserProfiles
                            Severity: Minor
                            Found in modules/post/windows/gather/credentials/postbox.rb - About 4 hrs to fix

                              Method cmd_nessus_scan_list has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def cmd_nessus_scan_list(*args)
                                      search_term = nil
                                      while (arg = args.shift)
                                        case arg
                                        when '-h', '--help'
                              Severity: Minor
                              Found in plugins/nessus.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 cmd_nessus_db_import has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def cmd_nessus_db_import(*args)
                                      if args[0] == '-h'
                                        print_status('nessus_db_import <scan ID>')
                                        print_status('Example:> nessus_db_import 500')
                                        print_status('Use nessus_scan_list -c to list all completed scans')
                              Severity: Minor
                              Found in plugins/nessus.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

                              Severity
                              Category
                              Status
                              Source
                              Language