rapid7/metasploit-framework

View on GitHub

Showing 13,734 of 19,454 total issues

Method stager_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def stager_config(opts={})
    uri = generate_uri(opts)
    ds = opts[:datastore] || datastore
    c = super

Severity: Minor
Found in lib/msf/core/payload/java/reverse_http.rb - About 25 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 info_fixups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def info_fixups
    # Each reference should be an array consisting of two elements
    refs = module_info['References']
    if(refs and not refs.empty?)
      refs.each_index do |i|
Severity: Minor
Found in lib/msf/core/module/module_info.rb - About 25 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_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_info(info, opts)
    opts.each_pair { |name, val|
      # If the supplied option name is one of the ones that we should
      # override by default
      if (UpdateableOptions.include?(name) == true)
Severity: Minor
Found in lib/msf/core/module/module_info.rb - About 25 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 asm_block_recv_rc4 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def asm_block_recv_rc4(opts={})
    xorkey = Rex::Text.to_dword(opts[:xorkey]).chomp
    reliable     = opts[:reliable]
    asm = %Q^
      recv:
Severity: Minor
Found in lib/msf/core/payload/windows/bind_tcp_rc4.rb - About 25 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 asm_reverse_named_pipe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def asm_reverse_named_pipe(opts={})

    #reliable       = opts[:reliable]
    reliable       = false
    retry_count    = [opts[:retry_count].to_i, 1].max
Severity: Minor
Found in lib/msf/core/payload/windows/x64/reverse_named_pipe_x64.rb - About 25 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 actual_arch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def actual_arch
    arch = nil

    if explicit_arch.nil? == false
      arch = explicit_arch
Severity: Minor
Found in lib/msf/core/payload/generic.rb - About 25 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 set_channel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_channel(device, channel)
    return {} unless is_zigbee_hwbridge_session?
    device = client.zigbee.target_device unless device
    return {} unless verify_device(device)
    client.zigbee.set_channel(device, channel)
Severity: Minor
Found in lib/msf/core/post/hardware/zigbee/utils.rb - About 25 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 inject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def inject(device, data)
    return {} unless is_zigbee_hwbridge_session?
    device = client.zigbee.target_device unless device
    return {} unless verify_device(device)
    client.zigbee.inject(device, data)
Severity: Minor
Found in lib/msf/core/post/hardware/zigbee/utils.rb - About 25 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 clear_dtcs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def clear_dtcs(bus, src_id, dst_id, opt = {})
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
    end
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 25 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_monitor_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_monitor_status(bus, src_id, dst_id, opt = {})
    opt['MAXPKTS'] = 1
    packets = get_current_data(bus, src_id, dst_id, 0x01, opt)
    return {} if packets.nil?
    return packets if packets.key? "error"
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 25 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 recv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def recv(device)
    return {} unless is_zigbee_hwbridge_session?
    device = client.zigbee.target_device unless device
    return {} unless verify_device(device)
    client.zigbee.recv(device)
Severity: Minor
Found in lib/msf/core/post/hardware/zigbee/utils.rb - About 25 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 sniffer_off has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sniffer_off(device)
    return {} unless is_zigbee_hwbridge_session?
    device = client.zigbee.target_device unless device
    return {} unless verify_device(device)
    client.zigbee.sniffer_off(device)
Severity: Minor
Found in lib/msf/core/post/hardware/zigbee/utils.rb - About 25 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_powershell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def _read_file_powershell(filename)
    data = ''
    offset = 0
    chunk_size = 65536
    loop do
Severity: Minor
Found in lib/msf/core/post/file.rb - About 25 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 whoami has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def whoami
    shellpid = get_session_pid()
    status = read_file("/proc/#{shellpid}/status") 
    status.each_line do |line|
      split = line.split(":")
Severity: Minor
Found in lib/msf/core/post/unix.rb - About 25 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_freeze_frame_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_freeze_frame_data(bus, src_id, dst_id, pid, frame, opt = {})
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
    end
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 25 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 sniffer_on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sniffer_on(device)
    return {} unless is_zigbee_hwbridge_session?
    device = client.zigbee.target_device unless device
    return {} unless verify_device(device)
    client.zigbee.sniffer_on(device)
Severity: Minor
Found in lib/msf/core/post/hardware/zigbee/utils.rb - About 25 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_current_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_current_data(bus, src_id, dst_id, pid, opt = {})
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
    end
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 25 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_vehicle_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_vehicle_info(bus, src_id, dst_id, mode, opt = {})
    unless client.automotive
      print_error("Not an automotive hwbridge session")
      return {}
    end
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 25 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_profile_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def read_profile_list
    hives=[]
    registry_enumkeys('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList').each do |profkey|
      next unless profkey.include? "S-1-5-21"
      hive={}
Severity: Minor
Found in lib/msf/core/post/windows/user_profiles.rb - About 25 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 clean_up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def clean_up(script_file = nil, eof = '', running_pids = [], open_channels = [],
                     env_suffix = Rex::Text.rand_text_alpha(8), delete = false)
          # Remove environment variables
          env_del_command =  "[Environment]::GetEnvironmentVariables('User').keys|"
          env_del_command += "Select-String #{env_suffix}|%{"
Severity: Minor
Found in lib/msf/core/post/windows/powershell.rb - About 25 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