rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method get_filezilla_creds has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_filezilla_creds(paths)
    sitedata = ''
    recentdata = ''
    creds = []

Severity: Major
Found in modules/post/multi/gather/filezilla_client_cred.rb - About 2 hrs to fix

    Method enum_powershell has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def enum_powershell
        unless registry_enumkeys('HKLM\\SOFTWARE\\Microsoft').include?('PowerShell')
          print_error('PowerShell is not installed on this system.')
          return
        end
    Severity: Major
    Found in modules/post/windows/gather/enum_powershell_env.rb - About 2 hrs to fix

      Method extract_lnk_info has 62 lines of code (exceeds 25 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: Major
      Found in modules/post/windows/gather/dumplinks.rb - About 2 hrs to fix

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

          def run
            @chrome_files = [
              { raw: '', in_file: 'Web Data', sql: 'select * from autofill;' },
              { raw: '', in_file: 'Web Data', sql: 'SELECT username_value,origin_url,signon_realm FROM logins;' },
              { raw: '', in_file: 'Web Data', sql: 'select * from autofill_profiles;' },
        Severity: Major
        Found in modules/post/windows/gather/enum_chrome.rb - About 2 hrs to fix

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

            def initialize(info = {})
              super(
                update_info(
                  info,
                  'Name' => 'Execute .net Assembly (x64 only)',
          Severity: Major
          Found in modules/post/windows/manage/execute_dotnet_assembly.rb - About 2 hrs to fix

            Method inspect has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def inspect
                utype = type ^ TLV_META_TYPE_COMPRESSED
                group = false
                meta = case (utype & TLV_META_MASK)
                  when TLV_META_TYPE_STRING; "STRING"
            Severity: Major
            Found in lib/rex/post/meterpreter/packet.rb - About 2 hrs to fix

              Method create_library has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.create_library(constant_manager, library_path = 'iphlpapi')
                  dll = Library.new(library_path, constant_manager)
              
                  dll.add_function('CancelIPChangeNotify', 'BOOL',[
                    ["PBLOB","notifyOverlapped","in"],

                Method rpc_del_vuln has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def rpc_del_vuln(xopts)
                  ::ApplicationRecord.connection_pool.with_connection {
                    opts, wspace = init_db_opts_workspace(xopts)
                    opts[:workspace] = opts[:workspace].name
                    hosts  = []
                Severity: Major
                Found in lib/msf/core/rpc/v10/rpc_db.rb - About 2 hrs to fix

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

                    def initialize(module_instance, obj_hash = nil)
                      unless obj_hash.nil?
                        init_from_hash(obj_hash)
                        return
                      end
                  Severity: Major
                  Found in lib/msf/core/modules/metadata/obj.rb - About 2 hrs to fix

                    Method module_to_details_hash has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def module_to_details_hash(m)
                        res  = {}
                        bits = []
                    
                        res[:mtime]    = ::File.mtime(m.file_path) rescue Time.now
                    Severity: Major
                    Found in lib/msf/core/db_manager/module_cache.rb - About 2 hrs to fix

                      Method search_modules has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def search_modules(search_string)
                          search_string ||= ''
                          search_string += " "
                      
                          # Split search terms by space, but allow quoted strings
                      Severity: Major
                      Found in lib/msf/core/db_manager/module_cache.rb - About 2 hrs to fix

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

                            def on_request_uri(cli, request)
                              case request.uri
                              when '/', get_resource.chomp("/")
                                #
                                # This is the information gathering stage
                        Severity: Major
                        Found in lib/msf/core/exploit/remote/browser_exploit_server.rb - About 2 hrs to fix

                          Method dot_net_compiler has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def dot_net_compiler(opts = {})
                                  #TODO:
                                  # allow compilation entirely in memory with a b64 encoded product for export without disk access
                                  # Dynamically assign assemblies based on dot_net_code require/includes
                                  #   Enumerate assemblies available to session, pull requirements, assign accordingly, pass to PS
                          Severity: Major
                          Found in lib/msf/core/exploit/powershell/dot_net.rb - About 2 hrs to fix

                            Method parse has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def parse(pkt)
                            
                                # We want to return immediatly if we do not have a packet which is handled by us
                                return unless pkt.is_tcp?
                                return if (pkt.tcp_sport != 143 and pkt.tcp_dport != 143)
                            Severity: Major
                            Found in data/exploits/psnuffle/imap.rb - About 2 hrs to fix

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

                                def get_oracle_version(ip)
                                  begin
                                    res = send_request_cgi({
                                      'version' => '1.1',
                                      'uri'     => uri,
                              Severity: Major
                              Found in modules/auxiliary/scanner/oracle/isqlplus_sidbrute.rb and 1 other location - About 2 hrs to fix
                              modules/auxiliary/scanner/oracle/isqlplus_login.rb on lines 66..89

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

                              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 do_sqli(node, query)
                                  mark = Rex::Text.rand_text_alpha(5 + rand(3))
                                  random_and = Rex::Text.rand_text_numeric(4)
                                  injection = ") and(select 1 from(select count(*),concat((select (select concat('#{mark}',cast((#{query}) as char),'#{mark}')) "
                                  injection << "from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) "
                              Severity: Major
                              Found in modules/exploits/unix/webapp/vbulletin_vote_sqli_exec.rb and 1 other location - About 2 hrs to fix
                              modules/auxiliary/gather/vbulletin_vote_sqli.rb on lines 90..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 91.

                              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 get_oracle_version(ip)
                                  begin
                                    res = send_request_cgi({
                                      'version' => '1.1',
                                      'uri'     => uri,
                              Severity: Major
                              Found in modules/auxiliary/scanner/oracle/isqlplus_login.rb and 1 other location - About 2 hrs to fix
                              modules/auxiliary/scanner/oracle/isqlplus_sidbrute.rb on lines 85..108

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

                              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 do_sqli(node, query)
                                  mark = Rex::Text.rand_text_alpha(5 + rand(3))
                                  random_and = Rex::Text.rand_text_numeric(4)
                                  injection = ") and(select 1 from(select count(*),concat((select (select concat('#{mark}',cast((#{query}) as char),'#{mark}')) "
                                  injection << "from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) "
                              Severity: Major
                              Found in modules/auxiliary/gather/vbulletin_vote_sqli.rb and 1 other location - About 2 hrs to fix
                              modules/exploits/unix/webapp/vbulletin_vote_sqli_exec.rb on lines 100..126

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

                              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

                                module OptionalSession
                                  module MSSQL
                                    include Msf::OptionalSession
                              
                                    RHOST_GROUP_OPTIONS = %w[RHOSTS RPORT DATABASE USERNAME PASSWORD THREADS]
                              Severity: Major
                              Found in lib/msf/core/optional_session/mssql.rb and 1 other location - About 2 hrs to fix
                              lib/msf/core/optional_session/postgresql.rb on lines 4..41

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

                              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 rpc_encoders(module_info = nil, arch = nil)
                                  unless module_info.nil?
                                    module_info = module_info.strip.split(',').map(&:strip)
                                    module_info.map!(&:to_sym)
                                  end
                              Severity: Major
                              Found in lib/msf/core/rpc/v10/rpc_module.rb and 1 other location - About 2 hrs to fix
                              lib/msf/core/rpc/v10/rpc_module.rb on lines 157..178

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

                              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