rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Function valid_login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def valid_login(host, rport, username, password):
    payload = {
        "jsonrpc": "2.0", "id": 0, "method": "call", "params": ["0" * 32, "session", "login",
                                                                {
                                                                    "username": username,
Severity: Minor
Found in modules/auxiliary/scanner/http/onion_omega2_login.py - About 35 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

Function getTGT has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def getTGT(self):
        domain, _, TGT, _ = CCache.parseFile(self.__domain)
        if TGT is not None:
            return TGT

Severity: Minor
Found in modules/auxiliary/gather/get_user_spns.py - About 35 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

Function zip has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function zip(src, dst)
{
    var shell = new ActiveXObject('Shell.Application');
    var fso = new ActiveXObject('Scripting.FileSystemObject');

Severity: Minor
Found in data/post/zip/zip.js - About 35 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

Function get_users has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_users(user_file, in_q, max_threads):
    """Thread worker function. Load candidate usernames from file into input queue."""
    with open(user_file, "r") as f:
        for line in f:
            if SHUTDOWN_EVENT.is_set():
Severity: Minor
Found in modules/auxiliary/gather/office365userenum.py - About 35 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 on_socket_created has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def on_socket_created(_comm, sock, param)
        # Ignore local listening sockets
        return if !sock.peerhost

        if ((sock.peerhost != '0.0.0.0') && sock.peerport)
Severity: Minor
Found in plugins/db_tracker.rb - About 35 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 parse_args_http has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_args_http(args = [], _type = 'http')
        opt_parser = Rex::Parser::Arguments.new(
          '-0' => [ false, 'Use HTTP 1.0' ],
          '-1' => [ false, 'Use TLSv1 (SSL)' ],
          '-2' => [ false, 'Use SSLv2 (SSL)' ],
Severity: Minor
Found in plugins/request.rb - About 35 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 verify_migration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def verify_migration(sid)
        return unless config[:automigrate]
        return if state[sid][:migrated]

        sess = framework.sessions[sid]
Severity: Minor
Found in plugins/beholder.rb - About 35 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

Function extract_symbol_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_symbol_value(self, symbol_name):
        encoded_name = symbol_name.encode()
        dynamic_symbol = self.extract_section_by_name(DYNAMIC_SYMBOL)
        dynamic_string = self.extract_section_by_name(DYNAMIC_STRING)
        symbol_entry_size = 24 if self.architecture == 64 else 16
Severity: Minor
Found in data/exploits/CVE-2023-4911/cve_2023_4911.py - About 35 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

Function der2me has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def der2me(d):
    if d[0] != bt(pack('B', 0x30)):
        return (None, None)
    _, o = rs(d, 1)
    while o < len(d):
Severity: Minor
Found in data/meterpreter/python/met_rsa.py - About 35 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 cmd_nessus_db_scan has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cmd_nessus_db_scan(*args)
        if args[0] == '-h'
          print_status('nessus_db_scan <policy ID> <scan name> <scan description>')
          print_status('Creates a scan based on all the hosts listed in db_hosts.')
          print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')
Severity: Minor
Found in plugins/nessus.rb - About 35 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 cmd_besecure_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cmd_besecure_version
        req = Net::HTTP::Post.new('/json.cgi', { 'Host' => @hostname })
        req.set_form_data({ 'apikey' => @apikey, 'primary' => 'interface' })

        if @debug
Severity: Minor
Found in plugins/besecure.rb - About 35 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 cmd_nessus_scan_stop_all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cmd_nessus_scan_stop_all(*args)
        scan_ids = Array.new
        if args[0] == '-h'
          print_status('nessus_scan_stop_all')
          print_status('Example:> nessus_scan_stop_all')
Severity: Minor
Found in plugins/nessus.rb - About 35 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 cmd_nessus_template_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

      def cmd_lab_reset(*args)
        return lab_usage if args.empty?

        if args[0] == 'all'
          print_line 'Resetting all lab vms.'
Severity: Minor
Found in plugins/lab.rb - About 35 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 rpc_view_jobs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def rpc_view_jobs
        indent = '     '

        rpc_reconnect_nodes

Severity: Minor
Found in plugins/wmap.rb - About 35 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 view_modules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def view_modules
        indent = '     '

        wmaptype = %i[
          wmap_ssl
Severity: Minor
Found in plugins/wmap.rb - About 35 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 delete_sites has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def delete_sites(wmap_index)
        idx = 0
        to_del = {}
        # Rebuild the index from wmap_sites -l
        framework.db.hosts.each do |bdhost|
Severity: Minor
Found in plugins/wmap.rb - About 35 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 cmd_lab_help has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cmd_lab_help(*args)
        if args.empty?
          commands.each_pair { |k, v| print_line format("%-#{longest_cmd_size}s - %s", k, v) }
        else
          args.each do |c|
Severity: Minor
Found in plugins/lab.rb - About 35 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 cmd_lab_suspend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cmd_lab_suspend(*args)
        return lab_usage if args.empty?

        if args[0] == 'all'
          @controller.each(&:suspend)
Severity: Minor
Found in plugins/lab.rb - About 35 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 frfxplacesget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def frfxplacesget(path,usrnm)
  # Create the log
  ::FileUtils.mkdir_p(@logs)
  @client.fs.dir.foreach(path) {|x|
    next if x =~ /^(\.|\.\.)$/
Severity: Minor
Found in scripts/meterpreter/enum_firefox.rb - About 35 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