rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

def get_log_details
  logs_detail = Array.new

  eventlog_list.each do |log_name|

Severity: Minor
Found in scripts/meterpreter/event_manager.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 listtokens has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def listtokens()
  begin
    print_status("Getting Tokens...")
    dt = ''
    @client.core.use("incognito")
Severity: Minor
Found in scripts/meterpreter/winenum.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 scan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def scan(path)
  begin
    dirs = client.fs.dir.foreach(path)
  rescue ::Rex::Post::Meterpreter::RequestError => e
    print_error("Error scanning #{path}: #{$!}")
Severity: Minor
Found in scripts/meterpreter/search_dwld.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
      print_error("A Service Name must be provided, service names are case sensitive.")
Severity: Major
Found in scripts/meterpreter/service_manager.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

      if srv_name
        begin
          print_status("Changing Service #{srv_name} Startup to #{srv_startup}")
          service_change_startup(srv_name,srv_startup)
          print_good("Service Startup changed!")
    Severity: Major
    Found in scripts/meterpreter/service_manager.rb - About 45 mins to fix

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

      def enum_users
        os = @client.sys.config.sysinfo['OS']
        users = []
        path4users = ""
        sysdrv = @client.sys.config.getenv('SystemDrive')
      Severity: Minor
      Found in scripts/meterpreter/enum_vmware.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

        elsif stdlkp == 1
          if dom != nil
            message(logs)
            stdlookup(session, dom, dest)
          else
      Severity: Major
      Found in scripts/meterpreter/netenum.rb - About 45 mins to fix

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

          def unlock(phone_name)
            res = send_request_cgi({
              'method'    => 'GET',
              'uri'       => '/IPSPCFG/user/Default.aspx',
              'headers'   => {
        Severity: Minor
        Found in modules/auxiliary/voip/telisca_ips_lock_control.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 lock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def lock(phone_name)
            res = send_request_cgi({
              'method'    => 'GET',
              'uri'       => '/IPSPCFG/user/Default.aspx',
              'headers'   => {
        Severity: Minor
        Found in modules/auxiliary/voip/telisca_ips_lock_control.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 passbf has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def passbf(session,passlist,target,user,opt,logfile)
        Severity: Minor
        Found in scripts/meterpreter/winbf.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

              print_status("Dumping memory for #{name}") if not query
          Severity: Major
          Found in scripts/meterpreter/process_memdump.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                  print_status("\tsize for #{name} in PID #{p} is #{get_mem_usage(p)}K") if query
            Severity: Major
            Found in scripts/meterpreter/process_memdump.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                  if dom != nil && hostlist!= nil &&
                    message(logs)
                    frwdlp(session, hostlist, dom, dest)
                  elsif dom == nil
                    print_error("Please add a domain name for DNS forward lookup: -d <value>")
              Severity: Major
              Found in scripts/meterpreter/netenum.rb - About 45 mins to fix

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

                      def cmd_sqlmap_get_option(*args)
                        @hid_tasks ||= {}
                        @tasks ||= {}
                
                        unless args.length == 2
                Severity: Minor
                Found in plugins/sqlmap.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 kill_frfx
                            kill_firefox
                          end
                Severity: Major
                Found in scripts/meterpreter/enum_firefox.rb - About 45 mins to fix

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

                  def abuse(session,targets,commands,username,password,delay)
                  Severity: Minor
                  Found in scripts/meterpreter/schtasksabuse.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                        elsif request.uri =~ /custom_methods$/i
                          print_status("Sending custom methods") if datastore['VERBOSE']
                          send_response_html(cli, get_custom_methods().to_json(), { 'Content-Type' => 'application/json' })
                        elsif request.uri =~ /custom\/sample_cmd\?data=(\S+)$/
                          print_status("Request for custom command with args #{$1}") if datastore['VERBOSE']
                    Severity: Major
                    Found in modules/auxiliary/server/local_hwbridge.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    resp << ( auth_tokens['nc'] ? auth_tokens['nc'] : "" )
                      Severity: Major
                      Found in modules/auxiliary/server/capture/sip.rb - About 45 mins to fix

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

                          def run
                            begin
                              # check Pcaprub is up to date
                              if not netifaces_implemented?
                                print_error("WARNING : Pcaprub is not up-to-date, some functionality will not be available")
                        Severity: Minor
                        Found in modules/auxiliary/server/icmp_exfil.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 cansend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def cansend(bus, id, data)
                            result = {}
                            result["Success"] = false
                            id = id.to_i(16).to_s(16)  # Clean up the HEX
                            bytes = data.scan(/../)  # Break up data string into 2 char (byte) chunks
                        Severity: Minor
                        Found in modules/auxiliary/server/local_hwbridge.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

                        Severity
                        Category
                        Status
                        Source
                        Language