rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Method process_wlanconf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def process_wlanconf(lines, credential_data)
        lines.each do |line|
          ssid = line['name']
          mode = line['security']
          password = line['x_passphrase']
Severity: Minor
Found in lib/msf/core/auxiliary/ubiquiti.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 distance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def distance(a, b)
    case
    when a.empty?
      b.length
    when b.empty?
Severity: Minor
Found in lib/msf/core/auxiliary/wmap_module.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 fuzz_string_corrupt_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def fuzz_string_corrupt_byte(str,max=nil)
    res = []
    0.upto(max ? [max,str.length-1].min : (str.length - 1)) do |offset|
      0.upto(255) do |val|
        @last_fuzzer_input = "fuzz_string_corrupt_byte offset:#{offset}/#{str.length} byte:#{val}"
Severity: Minor
Found in lib/msf/core/auxiliary/fuzzer.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 adjust_credentials_by_max_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def adjust_credentials_by_max_user(credentials)
    max = datastore['MaxGuessesPerUser'].to_i.abs
    if max == 0
      new_credentials = credentials
    else
Severity: Minor
Found in lib/msf/core/auxiliary/auth_brute.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 bson_to_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def bson_to_json(byte_buffer)
      # This function takes a byte buffer (db file from Unifi read in), which is a bson string
      # it then converts it to JSON, where it uses the 'select collection' documents
      # as keys.  For instance a bson that contained the follow (displayed in json
      # for ease):
Severity: Minor
Found in lib/msf/core/auxiliary/ubiquiti.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 fuzz_string_corrupt_byte_reverse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def fuzz_string_corrupt_byte_reverse(str,max=nil)
    res = []
    (max ? [max,str.length-1].min : (str.length - 1)).downto(0) do |offset|
      0.upto(255) do |val|
        @last_fuzzer_input = "fuzz_string_corrupt_byte_reverse offset:#{offset}/#{str.length} byte:#{val}"
Severity: Minor
Found in lib/msf/core/auxiliary/fuzzer.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 xnode_authenticate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def xnode_authenticate(sock, username, password)
    res = send_to_sock(sock, action_authenticate(username, password))

    unless res.instance_of?(Hash) && res.keys.include?('response') && res['response'].instance_of?(Hash)
      return [2, 'Received unexpected response when trying to authenticate.']
Severity: Minor
Found in lib/msf/core/auxiliary/manage_engine_xnode/basic_checks.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 process_results has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def process_results(search_result, fields)
    return nil unless fields.is_a? Array
    results = []
    non_empty_val_ct = 0 # used to check the search results contains at least one non_empty value 
    # map the search returned values to the specified fields
Severity: Minor
Found in lib/msf/core/auxiliary/manage_engine_xnode/process.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_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_params(opts)
    # Parse the query params and format the hash to match what the console search `is_match` function expects
    # A param prefixed with '-' indicates "not", and will omit results matching that keyword
    #
    # Resulting Hash Example:
Severity: Minor
Found in lib/msf/core/web_services/module_search.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update(ut, name, crit)
    ti = nil
    self.each_index do |i|
      tt = self[i]
      next if not tt
Severity: Minor
Found in lib/msf/core/thread_manager.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(attributes={})
    @module_path = attributes[:module_path]
    @module_reference_name = attributes[:module_reference_name]

    message_parts = []
Severity: Minor
Found in lib/msf/core/modules/error.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 add_cached_module has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def add_cached_module(cached_module_metadata)
    case cached_module_metadata.payload_type
    when Payload::Type::Single
      single_name = cached_module_metadata.ref_name
      single_info = load_payload_component(Payload::Type::Single, single_name)
Severity: Minor
Found in lib/msf/core/payload_set.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 determine_likely_compatibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def determine_likely_compatibility
    if matches_host_os?
      @datastore['rhost'] = @host.address
    else
      @missing << :os_match
Severity: Minor
Found in lib/msf/core/analyze/result.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 crawl_target has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def crawl_target(t)
    cnt  = 0
    opts = crawler_options(t)
    url  = t.to_url

Severity: Minor
Found in lib/msf/core/auxiliary/http_crawler.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 initialize_scheduler_threads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize_scheduler_threads
    self.scheduler_threads = []
    1.upto(SCHEDULER_THREAD_COUNT) do |i|
      self.scheduler_threads << framework.threads.spawn("SessionScheduler-#{i}", true) do
        while true
Severity: Minor
Found in lib/msf/core/session_manager.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 check_for_session_readiness has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_for_session_readiness(tries=6)
      session_ready_count = 0
      session_ready = false
      until session.sys or session_ready_count > tries
        session_ready_count += 1
Severity: Minor
Found in lib/msf/core/session_compatibility.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_logging_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_logging_options(value)
      result = {}
      errors = []

      value = value.to_s.strip
Severity: Minor
Found in lib/msf/core/opt_meterpreter_debug_logging.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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?(value, check_empty: true)
      if check_empty && required?
        # required variable not set
        return false if (value.nil? || value.to_s.empty?)
      end
Severity: Minor
Found in lib/msf/core/opt_base.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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?(value, check_empty: true)
      return false if check_empty && empty_required_value?(value)
      return false unless value.is_a?(String) || value.is_a?(NilClass)

      if !value.nil? && value.empty? == false
Severity: Minor
Found in lib/msf/core/opt_rhosts.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 update_loot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.update_loot
    lambda {
      warden.authenticate!
      begin
        opts = parse_json_request(request, false)
Severity: Minor
Found in lib/msf/core/web_services/servlet/loot_servlet.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