rapid7/metasploit-framework

View on GitHub
modules/auxiliary/gather/darkcomet_filedownloader.rb

Summary

Maintainability
F
4 days
Test Coverage

Method try_exploit has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

  def try_exploit(exploit_string, keystream, bruting)
    connect
    idtype_msg = sock.get_once(12)

    if idtype_msg.length != 12
Severity: Minor
Found in modules/auxiliary/gather/darkcomet_filedownloader.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

Method crypto_attack has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def crypto_attack(exploit_string)
    getsin_msg = fetch_getsin
    if getsin_msg.nil?
      return nil
    end
Severity: Minor
Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 5 hrs 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 try_exploit has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def try_exploit(exploit_string, keystream, bruting)
    connect
    idtype_msg = sock.get_once(12)

    if idtype_msg.length != 12
Severity: Major
Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 4 hrs to fix

    File darkcomet_filedownloader.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Auxiliary
      include Msf::Exploit::Remote::Tcp
      include Msf::Auxiliary::Report
    
      def initialize(info = {})
    Severity: Minor
    Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 3 hrs to fix

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

        def run
          # Determine exploit string
          if datastore['NEWVERSION'] == true
            if (datastore['TARGETFILE'] != '') && (datastore['KEY'] != '')
              exploit_string = 'QUICKUP1|' + datastore['TARGETFILE'] + '|'
      Severity: Minor
      Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 3 hrs 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 crypto_attack has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def crypto_attack(exploit_string)
          getsin_msg = fetch_getsin
          if getsin_msg.nil?
            return nil
          end
      Severity: Major
      Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 2 hrs to fix

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

          def run
            # Determine exploit string
            if datastore['NEWVERSION'] == true
              if (datastore['TARGETFILE'] != '') && (datastore['KEY'] != '')
                exploit_string = 'QUICKUP1|' + datastore['TARGETFILE'] + '|'
        Severity: Minor
        Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 1 hr to fix

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

            def initialize(info = {})
              super(update_info(info,
                'Name'           => 'DarkComet Server Remote File Download Exploit',
                'Description'    => %q{
                  This module exploits an arbitrary file download vulnerability in the DarkComet C&C server versions 3.2 and up.
          Severity: Minor
          Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 1 hr to fix

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

              def parse_password(filedata)
                filedata.each_line { |line|
                  elem = line.strip.split('=')
                  if elem.length >= 1
                    if elem[0] == 'PASSWD'
            Severity: Minor
            Found in modules/auxiliary/gather/darkcomet_filedownloader.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

            Avoid deeply nested control flow statements.
            Open

                          if (getsin_observation[index][x] != getsin_observation[next_index][x]) && (getsin_observation[index][x - 1] != getsin_observation[next_index][x - 1]) && ((getsin_observation[(index - 1) % 4][x - 1] == getsin_observation[index][x - 1]) || (getsin_observation[next_index][x - 1] == getsin_observation[(next_index + 1) % 4][x - 1]))
                            target_offset_range.delete(x)
                            inference_results[x] = xor_strings(getsin_observation[index][x], '9')
                            break
                          end
            Severity: Major
            Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 45 mins to fix

              Avoid too many return statements within this method.
              Open

                      return nil
              Severity: Major
              Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return nil
                Severity: Major
                Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return nil
                  Severity: Major
                  Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return nil
                    Severity: Major
                    Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                return nil
                      Severity: Major
                      Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return nil
                        Severity: Major
                        Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                    return nil
                          Severity: Major
                          Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return filedata
                            Severity: Major
                            Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                    return filedata
                              Severity: Major
                              Found in modules/auxiliary/gather/darkcomet_filedownloader.rb - About 30 mins to fix

                                There are no issues that match your filters.

                                Category
                                Status