rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

Method backdoor_apk has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def backdoor_apk(apkfile, raw_payload, signature = true, manifest = true, apk_data = nil, service = true)
Severity: Minor
Found in lib/msf/core/payload/apk.rb - About 45 mins to fix

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

      def parse_pe(dll, loader_name: 'ReflectiveLoader', loader_ordinal: EXPORT_REFLECTIVELOADER)
        pe = Rex::PeParsey::Pe.new(Rex::ImageSource::Memory.new(dll))
        offset = nil
    
        unless loader_name.nil?
    Severity: Minor
    Found in lib/msf/core/reflective_dll_loader.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(opts={})
          @add_code   = opts.fetch(:add_code, '')
          @arch       = opts.fetch(:arch, '')
          @badchars   = opts.fetch(:badchars, '')
          @cli        = opts.fetch(:cli, false)
    Severity: Minor
    Found in lib/msf/core/payload_generator.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(opts=nil)
        opts = load_new if opts.nil?
        opts = load_uri(opts[:uri]) if opts[:uri]
        opts = load_raw(opts[:raw]) if opts[:raw]
    
    
    Severity: Minor
    Found in lib/msf/core/payload/uuid.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(major, minor, build, service_pack, revision, product_type)
    Severity: Minor
    Found in lib/msf/core/windows_version.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                return MajorRelease::Server2008R2 if windows_server?
      Severity: Major
      Found in lib/msf/core/windows_version.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                elsif _minor == 2
                  return MajorRelease::Server2012 if windows_server?
        
                  return MajorRelease::Win8
                elsif _minor == 3
        Severity: Major
        Found in lib/msf/core/windows_version.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    return MajorRelease::Server2016Plus if windows_server?
          Severity: Major
          Found in lib/msf/core/windows_version.rb - About 45 mins to fix

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

              def generate(_opts = {})
                # If we're staged, then we call the super to generate the STAGER
                if staged?
                  super
                # Otherwise, we'll be generating the stage, let's do that now
            Severity: Minor
            Found in lib/msf/core/payload/single.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def initialize(*args)
                self.platforms = [ ]
            
                args.each { |a|
                  if a.kind_of?(String)
            Severity: Minor
            Found in lib/msf/core/module/platform_list.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 alert_user has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def alert_user
                self.you_have_been_warned ||= {}
                errors.each do |msg|
                  if msg && !self.you_have_been_warned[msg.hash]
                    without_prompt { print_error(msg, prefix: '') }
            Severity: Minor
            Found in lib/msf/core/module/alert.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 generate_payload_uuid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def generate_payload_uuid(conf = {})
            
                conf[:arch] ||= self.arch
                conf[:platform] ||= self.platform
            
            
            Severity: Minor
            Found in lib/msf/core/payload/uuid/options.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 (datastore['PrependSetresuid'])
                    # setresuid(ruid=0, euid=0, suid=0)
                    pre << "\x00\x00\x20\xe0"     #    eor r0, r0, r0                    #
                    pre << "\x01\x10\x21\xe0"     #    eor r1, r1, r1                    #
                    pre << "\x02\x20\x22\xe0"     #    eor r2, r2, r2                    #
            Severity: Major
            Found in lib/msf/core/payload/linux.rb - About 45 mins to fix

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

                def rm_rf(*remote_dirs)
                  remote_dirs.each do |remote|
                    if session.type == 'meterpreter'
                      session.fs.dir.rmdir(remote) if exist?(remote)
                    elsif session.type == 'powershell'
              Severity: Minor
              Found in lib/msf/core/post/file.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_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def read_file(file_name)
                  if session.type == 'meterpreter'
                    return _read_file_meterpreter(file_name)
                  end
              
              
              Severity: Minor
              Found in lib/msf/core/post/file.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 copy_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def copy_file(src_file, dst_file)
                  return false if directory?(dst_file) || directory?(src_file)
              
                  verification_token = Rex::Text.rand_text_alpha_upper(8)
                  if session.type == 'meterpreter'
              Severity: Minor
              Found in lib/msf/core/post/file.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 _remote_destination_win has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def _remote_destination_win
                  return @remote_destination_win unless @remote_destination_win.nil?
                  writable_dir = datastore['FETCH_WRITABLE_DIR']
                  writable_dir += '\\' unless writable_dir.blank? || writable_dir[-1] == '\\'
                  payload_filename = datastore['FETCH_FILENAME']
              Severity: Minor
              Found in lib/msf/core/payload/adapter/fetch.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 get_users has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_users
                  cmd_output = cmd_exec("/usr/bin/dscacheutil -q user")
                  users = []
                  users_arry = cmd_output.tr("\r", "").split("\n\n")
                  users_arry.each do |u|
              Severity: Minor
              Found in lib/msf/core/post/osx/system.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 get_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_groups
                  cmd_output = cmd_exec("/usr/bin/dscacheutil -q group")
                  groups = []
                  groups_arry = cmd_output.split("\n\n")
                  groups_arry.each do |u|
              Severity: Minor
              Found in lib/msf/core/post/osx/system.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 (datastore['PrependSetuid'])
                      # setuid(0)
                      pre << "\x00\x00\x20\xe0"     #    eor r0, r0, r0                    #
                      pre << "\x17\x70\xa0\xe3"     #    mov r7, #23                       #
                      pre << "\x00\x00\x00\xef"     #    svc                               #
              Severity: Major
              Found in lib/msf/core/payload/linux.rb - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language