rapid7/metasploit-framework

Complex class definition

# -*- coding: binary -*-
module Rex
module Proto
module IAX2
module Codecs
Found in Rex::Proto::IAX2::Codecs::G711 - About 4 mos to fix

    Very high overall complexity: 6191

    # -*- coding: binary -*-
    module Rex
    module Proto
    module IAX2
    module Codecs
    Found in Rex::Proto::IAX2::Codecs::G711 - About 2 mos to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very complex method in #initialize

      def initialize(info = {})
        super(update_info(info,
          'Name'          => 'Windows Inject DLL',
          'Description'   => 'Inject a custom DLL into the exploited process',
          'Author'        =>
    Found in Msf::Payload::Windows::DllInject - About 1 mo to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Very high overall complexity: 2714

    # -*- coding: binary -*-
    
    require 'rexml/document'
    require 'rex/parser/nmap_xml'
    require 'msf/core/db_export'
    Found in Msf::Ui::Console::CommandDispatcher::Db - About 3 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 2679

    # -*- coding: binary -*-
    module Rex
    module Proto
    module SMB
    class Client
    Found in Rex::Proto::SMB::Client - About 3 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 2472

    #
    # Web assessment for the metasploit framework
    # Efrain Torres    - et[ ] metasploit.com  2012
    #
    
    
    Found in Msf::Plugin::Wmap::WmapCommandDispatcher - About 3 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 2369

    # -*- coding: binary -*-
    
    #
    # Rex
    #
    Found in Msf::Ui::Console::CommandDispatcher::Core - About 3 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very complex method in #cmd_wmap_run

        def cmd_wmap_run(*args)
          # Stop everything
          self.masstop = false
          self.killwhenstop  = true
    
    
    Found in Msf::Plugin::Wmap::WmapCommandDispatcher - About 3 wks to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Very high overall complexity: 1935

    # -*- coding: binary -*-
    require 'msf/core'
    require 'msf/core/payload/windows'
    
    module Msf
    Found in Msf::Payload::Windows::DllInject - About 2 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 1836

    # $Id$ $Revision$
    require 'nessus_rest'
    require 'rex/parser/nessus_xml'
    
    module Msf
    Found in Msf::Plugin::Nessus::ConsoleCommandDispatcher - About 2 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 1709

    # -*- coding: binary -*-
    module Msf
    module RPC
    class RPC_Db < RPC_Base
    
    
    Found in Msf::RPC::RPC_Db - About 2 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 1709

    # -*- coding: binary -*-
    
    module Msf
    module Util
    #
    Found in Msf::Util::EXE - About 2 wks to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 1487

    # -*- coding: binary -*-
    require 'set'
    require 'rex/post/meterpreter'
    require 'rex/parser/arguments'
    
    

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very high overall complexity: 1436

    #    This file is part of Metasm, the Ruby assembly manipulation suite
    #    Copyright (C) 2006-2009 Yoann GUILLOT
    #
    #    Licence is LGPL, see LICENCE in the top-level directory
    
    
    Found in Metasm::Expression - About 1 wk to fix

    When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

    Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

    Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

    Refactorings

    Further Reading

    Very complex method in .create_library

      def self.create_library(constant_manager, library_path = 'kernel32')
        dll = Library.new(library_path, constant_manager)
    
        dll.add_function( 'GetConsoleWindow', 'LPVOID',[])
    
    

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Identical code found in 1 other location

    require 'metasploit/framework/tcp/client'
    require 'metasploit/framework/mssql/tdssslproxy'
    
    module Metasploit
      module Framework
    Found in Metasploit::Framework::MSSQL::Client and 1 other location - About 1 wk to fix
    lib/msf/core/exploit/mssql.rb on lines 795..873

    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).

    Refactorings

    Further Reading

    Identical code found in 1 other location

    # -*- coding: binary -*-
    require 'msf/core'
    require 'msf/core/exploit/mssql_commands'
    
    module Msf
    Found in Msf::Exploit::Remote::MSSQL and 1 other location - About 1 wk to fix
    lib/metasploit/framework/mssql/client.rb on lines 475..553

    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).

    Refactorings

    Further Reading

    Identical code found in 1 other location

    require 'metasploit/framework/tcp/client'
    require 'metasploit/framework/mssql/tdssslproxy'
    
    module Metasploit
      module Framework
    Found in Metasploit::Framework::MSSQL::Client and 1 other location - About 1 wk to fix
    lib/msf/core/exploit/mssql.rb on lines 686..754

    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).

    Refactorings

    Further Reading

    Identical code found in 1 other location

    # -*- coding: binary -*-
    require 'msf/core'
    require 'msf/core/exploit/mssql_commands'
    
    module Msf
    Found in Msf::Exploit::Remote::MSSQL and 1 other location - About 1 wk to fix
    lib/metasploit/framework/mssql/client.rb on lines 400..468

    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).

    Refactorings

    Further Reading

    Complex class definition

    # -*- coding: binary -*-
    
    module Msf::Post::Windows::Error
      SUCCESS = 0x0000
      INVALID_FUNCTION = 0x0001
    Found in Msf::Post::Windows::Error - About 1 wk to fix

      Very complex method in .create_library

        def self.create_library(constant_manager, library_path = 'user32')
          dll = Library.new(library_path, constant_manager)
      
          dll.add_function('ActivateKeyboardLayout', 'DWORD',[
            ["DWORD","hkl","in"],

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very high overall complexity: 1149

      # -*- coding: binary -*-
      
      require 'rex/ui/text/output/buffer/stdout'
      
      module Msf
      Found in Msf::Ui::Console::CommandDispatcher::Modules - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 1120

      # -*- coding: binary -*-
      require 'msf/core'
      require 'msf/core/exploit/mssql_commands'
      
      module Msf
      Found in Msf::Exploit::Remote::MSSQL - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Identical code found in 1 other location

      require 'metasploit/framework/tcp/client'
      
      module Metasploit
        module Framework
          module Telnet
      lib/msf/core/exploit/telnet.rb on lines 156..218

      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).

      Refactorings

      Further Reading

      Identical code found in 1 other location

      # -*- coding: binary -*-
      
      module Msf
      
      require 'msf/core/exploit/tcp'
      Found in Msf::Exploit::Remote::Telnet and 1 other location - About 1 wk to fix
      lib/metasploit/framework/telnet/client.rb on lines 140..202

      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).

      Refactorings

      Further Reading

      Very high overall complexity: 1040

      # -*- coding: binary -*-
      module Msf
      class Post
      module Hardware
      module Automotive
      Found in Msf::Post::Hardware::Automotive::UDS - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 982

      # -*- coding: binary -*-
      require 'rex/proto/ntlm/constants'
      require 'rex/proto/ntlm/crypt'
      require 'rex/proto/ntlm/exceptions'
      
      
      Found in Rex::Proto::NTLM::Utils - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very complex method in #apply_prepends

        def apply_prepends(buf)
          pre = ''
          app = ''
      
          test_arch = [ *(self.arch) ]
      Found in Msf::Payload::Linux - About 1 wk to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very complex method in #parse_host

        def parse_host(host, wspace, bl, allow_yaml, btag, args, &block)
      
          host_data = {}
          host_data[:task] = args[:task]
          host_data[:workspace] = wspace

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very complex method in #cmd_sessions

        def cmd_sessions(*args)
          begin
          method   = nil
          quiet    = false
          show_extended = false
      Found in Msf::Ui::Console::CommandDispatcher::Core - About 1 wk to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very complex method in #cmd_notes

        def cmd_notes(*args)
          return unless active?
        ::ActiveRecord::Base.connection_pool.with_connection {
          mode = :search
          data = nil
      Found in Msf::Ui::Console::CommandDispatcher::Db - About 1 wk to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very high overall complexity: 935

      # -*- coding: binary -*-
      require 'rex/post/meterpreter'
      
      module Rex
      module Post

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 933

      require 'metasploit/framework/tcp/client'
      require 'metasploit/framework/mssql/tdssslproxy'
      
      module Metasploit
        module Framework
      Found in Metasploit::Framework::MSSQL::Client - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 900

      # -*- coding: binary -*-
      require "rex/parser/nokogiri_doc_mixin"
      require "date"
      
      module Rex
      Found in Rex::Parser::NexposeRawDocument - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 878

      # -*- coding: binary -*-
      
      require 'uri'
      require 'digest'
      module Msf
      Found in Msf::Exploit::Remote::HttpClient - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Identical code found in 2 other locations

      require 'metasploit/framework/tcp/client'
      
      module Metasploit
        module Framework
          module Ftp
      Found in Metasploit::Framework::Ftp::Client and 2 other locations - About 1 wk to fix
      lib/msf/core/exploit/ftp.rb on lines 184..236
      lib/rex/proto/ftp/client.rb on lines 238..290

      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).

      Refactorings

      Further Reading

      Identical code found in 2 other locations

      # -*- coding: binary -*-
      module Msf
      
      require 'msf/core/exploit/tcp'
      
      
      Found in Msf::Exploit::Remote::Ftp and 2 other locations - About 1 wk to fix
      lib/metasploit/framework/ftp/client.rb on lines 138..190
      lib/rex/proto/ftp/client.rb on lines 238..290

      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).

      Refactorings

      Further Reading

      Identical code found in 2 other locations

      # -*- coding: binary -*-
      
      require 'rex/socket'
      
      module Rex
      Found in Rex::Proto::Ftp::Client and 2 other locations - About 1 wk to fix
      lib/metasploit/framework/ftp/client.rb on lines 138..190
      lib/msf/core/exploit/ftp.rb on lines 184..236

      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).

      Refactorings

      Further Reading

      Very high overall complexity: 806

      # -*- coding: binary -*-
      require 'tempfile'
      require 'filesize'
      require 'rex/post/meterpreter'
      
      

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 800

      # -*- coding: binary -*-
      module Msf
      
      module Exploit::Remote::VIMSoap
        include Msf::Exploit::Remote::HttpClient
      Found in Msf::Exploit::Remote::VIMSoap - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very complex method in #call

          def call(functions)
            request = Packet.create_request('stdapi_railgun_api_multi')
            function_results = []
            layouts          = []
            functions.each do |f|

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very high overall complexity: 774

      # -*- coding: binary -*-
      
      require 'rex/post/meterpreter/packet'
      require 'rex/post/meterpreter/extension'
      require 'rex/post/meterpreter/client'
      Found in Rex::Post::Meterpreter::ClientCore - About 1 wk to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 765

      # -*- coding: binary -*-
      require 'msf/core'
      require 'msf/core/module'
      
      module Msf
      Found in Msf::Exploit - About 6 days to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very complex method in #parse_sessionsetup

        def parse_sessionsetup(pkt, s)
          payload = pkt.payload.dup
          ntlmpayload = payload[/NTLMSSP\x00.*/m]
          if ntlmpayload
            ntlmmessagetype = ntlmpayload[8,4].unpack("V")[0]
      Found in SnifferSMB - About 6 days to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very complex method in #mssql_login

              def mssql_login(user='sa', pass='', db='', domain_name='')
      
                disconnect if self.sock
                connect
                mssql_prelogin
      Found in Metasploit::Framework::MSSQL::Client - About 6 days to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very complex method in #encode

        def encode
          # If the exploit has bad characters, we need to run the list of encoders
          # in ranked precedence and try to encode without them.
          if reqs['BadChars'].to_s.length > 0 or reqs['Encoder'] or reqs['ForceEncode']
            encoders = pinst.compatible_encoders
      Found in Msf::EncodedPayload - About 6 days to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Very high overall complexity: 747

      # -*- coding: binary -*-
      require 'rex/proto/smb'
      require 'rex/proto/ntlm'
      require 'rex/proto/dcerpc'
      require 'rex/encoder/ndr'
      Found in Msf::Exploit::Remote::SMB::Client - About 6 days to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 735

      # -*- coding: binary -*-
      require 'rex/post/meterpreter'
      require 'msf/core/auxiliary/report'
      require 'rex/google/geolocation'
      require 'date'

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very high overall complexity: 730

      # -*- coding: binary -*-
      module Msf
      module Serializer
      
      # This class formats information in a plain-text format that
      Found in Msf::Serializer::ReadableText - About 6 days to fix

      When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

      Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

      Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

      Refactorings

      Further Reading

      Very complex method in #mssql_login

        def mssql_login(user='sa', pass='', db='')
      
          disconnect if self.sock
          connect
      
      
      Found in Msf::Exploit::Remote::MSSQL - About 6 days to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More