rapid7/metasploit-framework

View on GitHub

Showing 15,831 of 21,886 total issues

Method splunk_upload_app has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def splunk_upload_app(app_name, cookie)
    res = send_request_cgi({
      'uri' => splunk_upload_url,
      'method' => 'GET',
      'cookie' => cookie
Severity: Minor
Found in lib/msf/core/exploit/remote/http/splunk/apps.rb - About 1 hr 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 connect_dialup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def connect_dialup(global = true, opts={})

    if (not @telephony_loaded)
      print_status("The serialport module is not available: #{telephony_error}")
      raise RuntimeError, "Telephony not available"
Severity: Minor
Found in lib/msf/core/exploit/remote/dialup.rb - About 1 hr 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 vim_get_vms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def vim_get_vms
    vim_setup_references
    @vmrefs = []
    vmlist= []
    @dcs.each do |dc|
Severity: Minor
Found in lib/msf/core/exploit/remote/vim_soap.rb - About 1 hr 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 wordpress_and_online? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def wordpress_and_online?
    unless datastore['WPCHECK']
      vprint_status 'Skipping WordPress check...'
      return true
    end
Severity: Minor
Found in lib/msf/core/exploit/remote/http/wordpress/base.rb - About 1 hr 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 nagios_xi_rce_check has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def nagios_xi_rce_check(version)
    matching_exploits = {}

    # Storage area for known exploits that affect versions prior to the one in the hash key
    nagios_rce_version_prior = {
Severity: Minor
Found in lib/msf/core/exploit/remote/http/nagios_xi/rce_check.rb - About 1 hr 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_computer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_computer(opts = {})
    tree = opts[:tree] || connect_ipc

    samr_con = connect_samr(tree)

Severity: Minor
Found in lib/msf/core/exploit/remote/ms_samr/computer.rb - About 1 hr 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 authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def authenticate(service_name, username = 'Fortimanager_Access', password = nil)
      debug { 'Sending SSH_MSG_USERAUTH_REQUEST (password)' }

      send_message(userauth_request(
=begin
Severity: Minor
Found in lib/msf/core/exploit/remote/ssh/auth_methods/fortinet_backdoor.rb - About 1 hr 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_client_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def on_client_data(c)
    data = c.get_once
    return if not data

    cmd,arg = data.strip.split(/\s+/, 2)
Severity: Minor
Found in lib/msf/core/exploit/remote/ftp_server.rb - About 1 hr 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_connect_opts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_connect_opts
      opts = {
        username: datastore['USERNAME'],
        password: datastore['PASSWORD'],
        domain: datastore['DOMAIN'],
Severity: Minor
Found in lib/msf/core/exploit/remote/ldap.rb - About 1 hr 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 dns_get_a has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def dns_get_a(domain, type='DNS A records', displayed=false)
    resp = dns_query(domain, 'A')
    return if resp.blank? || resp.answer.blank?

    records = []
Severity: Minor
Found in lib/msf/core/exploit/remote/dns/enumeration.rb - About 1 hr 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 switchdns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def switchdns(domain)
    if datastore['NS'].blank?
      resp_soa = client.query(target, "SOA")
      if (resp_soa)
        (resp_soa.answer.select { |i| i.is_a?(Dnsruby::RR::SOA)}).each do |rr|
Severity: Minor
Found in lib/msf/core/exploit/remote/dns/client.rb - About 1 hr 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 to_xml_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def to_xml_file(path, &block)

    yield(:status, STATUS_START, "report") if block_given?
    extract_target_entries
    report_file = ::File.open(path, "wb")
Severity: Minor
Found in lib/msf/core/db_export.rb - About 1 hr 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 build_pkt_line_advertise has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def build_pkt_line_advertise(refs)
    body = ''

    body << Msf::Exploit::Git::PktLine.generate_pkt_line('# service=git-upload-pack')
    if refs.nil? || refs.empty?
Severity: Minor
Found in lib/msf/core/exploit/git/smart_http.rb - About 1 hr 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 inject_php_payload_png has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def inject_php_payload_png(payload, injection_method: 'PLTE')
    if payload.empty?
      print_error('PNG payload creation failed. No PHP payload provided.')
      return nil
    end
Severity: Minor
Found in lib/msf/core/exploit/format/php_payload_png.rb - About 1 hr 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_properties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_properties(file_content)
      results = []
      rows = file_content.split(/\n+/)
      rows.each do |row|
        property = row.match(/(?<name>.*[^\\])=(?<value>.*)/)
Severity: Minor
Found in lib/msf/core/exploit/local/sap_smd_agent_unencrypted_property.rb - About 1 hr 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 format_payload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def format_payload(shellcode)
      encryption_opts = {}
      encryption_opts[:format] = encryption_format if encryption_format
      encryption_opts[:iv] = encryption_iv if encryption_iv
      encryption_opts[:key] = encryption_key if encryption_key
Severity: Minor
Found in lib/msf/core/payload_generator.rb - About 1 hr 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 stack_adjustment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def stack_adjustment
    if target && target.payload_stack_adjustment
      adj = target.payload_stack_adjustment
    else
      adj = payload_info['StackAdjustment']
Severity: Minor
Found in lib/msf/core/exploit.rb - About 1 hr 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 handle_exception has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_exception e
    msg = setup_fail_detail_from_exception e

    case e
      when Msf::Exploit::Complete
Severity: Minor
Found in lib/msf/core/exploit.rb - About 1 hr 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 search_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def search_for(key)
      k = find_key_case(key)
      return search_result(:user_defined, @user_defined[k]) if @user_defined.key?(k)

      # Preference globally set values over a module's option default
Severity: Minor
Found in lib/msf/core/module_data_store_with_fallbacks.rb - About 1 hr 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_pgpass_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def process_pgpass_file(location = pgpass_file)
          return nil unless file_exist?(location)

          contents = read_file(location)
          return nil if contents.nil?
Severity: Minor
Found in lib/msf/core/post/vcenter/database.rb - About 1 hr 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