rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

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

  def run
    print_status("Running MS SQL Server Enumeration...")
    if session
      set_session(session.client)
    else
Severity: Minor
Found in modules/auxiliary/admin/mssql/mssql_enum.rb - About 2 days 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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  def query_current_connection(wlan_handle, guid)
    connection = {}
    conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)
    # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
    # We interpret the connection mode used first
Severity: Major
Found in modules/post/windows/wlan/wlan_current_connection.rb and 1 other location - About 2 days to fix
modules/post/windows/wlan/wlan_disconnect.rb on lines 124..296

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 538.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  def query_current_connection(wlan_handle, guid)
    connection = {}
    conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)

    # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
Severity: Major
Found in modules/post/windows/wlan/wlan_disconnect.rb and 1 other location - About 2 days to fix
modules/post/windows/wlan/wlan_current_connection.rb on lines 89..260

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 538.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  def make_pdf(swf, js)

    swf_name = rand_text_alpha(8 + rand(8)) + ".swf"

    xref = []
modules/exploits/windows/browser/adobe_flashplayer_newfunction.rb on lines 283..418
modules/exploits/windows/fileformat/adobe_flashplayer_newfunction.rb on lines 285..420

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 536.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  def make_pdf(swf, js)

    swf_name = rand_text_alpha(8 + rand(8)) + ".swf"

    xref = []
modules/exploits/windows/fileformat/adobe_flashplayer_button.rb on lines 289..424
modules/exploits/windows/fileformat/adobe_flashplayer_newfunction.rb on lines 285..420

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 536.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  def make_pdf(swf, js)

    swf_name = rand_text_alpha(8 + rand(8)) + ".swf"

    xref = []
modules/exploits/windows/browser/adobe_flashplayer_newfunction.rb on lines 283..418
modules/exploits/windows/fileformat/adobe_flashplayer_button.rb on lines 289..424

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 536.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method run_host has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
Open

  def run_host(ip)
    msg = "#{ip}:#{rhost} - DNS -"
    begin
      @lastdata = nil
      @probablyVuln = nil
Severity: Minor
Found in modules/auxiliary/fuzzers/dns/dns_fuzzer.rb - About 2 days 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_host has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_host(host, wspace, blacklist, allow_yaml, btag, args, &block)

    host_data = {}
    host_data[:task] = args[:task]
    host_data[:workspace] = wspace
Severity: Minor
Found in lib/msf/core/db_manager/import/metasploit_framework/xml.rb - About 2 days 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 run has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    dork = datastore['ZOOMEYE_DORK']
    resource = datastore['RESOURCE']
    maxpage = datastore['MAXPAGE']
    facets = datastore['FACETS']
Severity: Minor
Found in modules/auxiliary/gather/zoomeye_search.rb - About 2 days 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 creds_search has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

  def creds_search(*args)
    host_ranges   = []
    origin_ranges = []
    port_ranges   = []
    svcs          = []
Severity: Minor
Found in lib/msf/ui/console/command_dispatcher/creds.rb - About 2 days 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

File exceptions.rb has 838 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Rex
module Proto
module SMB
module Exceptions

Severity: Major
Found in lib/rex/proto/smb/exceptions.rb - About 2 days to fix

    Method run has 401 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def run
    
        loot = ""
        uri = "/"
        uri << (datastore['YEAR']).to_s if datastore['YEAR'].to_s != ""
    Severity: Major
    Found in modules/auxiliary/gather/corpwatch_lookup_id.rb - About 2 days to fix

      Method import_nmap_xml has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
      Open

        def import_nmap_xml(args={}, &block)
          return nil if args[:data].nil? or args[:data].empty?
          wspace = Msf::Util::DBManager.process_opts_workspace(args, framework)
          bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
      
      
      Severity: Minor
      Found in lib/msf/core/db_manager/import/nmap.rb - About 1 day 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

      File lm2ntcrack.rb has 822 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      msfbase = __FILE__
      while File.symlink?(msfbase)
        msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
      end
      
      
      Severity: Major
      Found in tools/password/lm2ntcrack.rb - About 1 day to fix

        Method initialize has 390 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(merge_info(info,
              'Name'          => 'NetWare Command Shell',
              'Description'   => 'Connect to the NetWare console (staged)',
              'Author'        => 'toto',
        Severity: Major
        Found in modules/payloads/stages/netware/shell.rb - About 1 day to fix

          Method arp_poisoning has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
          Open

            def arp_poisoning
              lsmac = datastore['LOCALSMAC'] || @smac
              raise 'Local Source Mac is not in correct format' unless is_mac?(lsmac)
          
              dhosts_range = Rex::Socket::RangeWalker.new(datastore['DHOSTS'])
          Severity: Minor
          Found in modules/auxiliary/spoof/arp/arp_poisoning.rb - About 1 day 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 run has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
          Open

              def run(self):
                  if self.__usersFile:
                      self.request_users_file_TGSs()
                      return
          
          
          Severity: Minor
          Found in modules/auxiliary/gather/get_user_spns.py - About 1 day 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 import_libpcap has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
          Open

            def import_libpcap(args={}, &block)
              data = args[:data]
              wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
              bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
              # seen_hosts is only used for determining when to yield an address. Once we get
          Severity: Minor
          Found in lib/msf/core/db_manager/import/libpcap.rb - About 1 day 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

          File cve_2019_0708_bluekeep_rce.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class MetasploitModule < Msf::Exploit::Remote
            prepend Msf::Exploit::Remote::AutoCheck
          
            Rank = ManualRanking
          
          
          Severity: Major
          Found in modules/exploits/windows/rdp/cve_2019_0708_bluekeep_rce.rb - About 1 day to fix

            File vcenter_secrets_dump.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'metasploit/framework/credential_collection'
            
            class MetasploitModule < Msf::Post
              include Msf::Post::Common
              include Msf::Post::File
            Severity: Major
            Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 1 day to fix
              Severity
              Category
              Status
              Source
              Language