rapid7/metasploit-framework

View on GitHub
lib/msf/base/sessions/ssh_command_shell_bind.rb

Summary

Maintainability
C
1 day
Test Coverage

File ssh_command_shell_bind.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'metasploit/framework/ssh/platform'
require 'rex/post/channel'
require 'rex/post/meterpreter/channels/socket_abstraction'

module Msf::Sessions
Severity: Minor
Found in lib/msf/base/sessions/ssh_command_shell_bind.rb - About 2 hrs to fix

    Method create_server_channel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_server_channel(params)
          msf_channel = nil
          mutex = Mutex.new
          condition = ConditionVariable.new
          timed_out = false
    Severity: Minor
    Found in lib/msf/base/sessions/ssh_command_shell_bind.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 create_client_channel has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_client_channel(params)
          msf_channel = nil
          mutex = Mutex.new
          condition = ConditionVariable.new
          opened = false
    Severity: Minor
    Found in lib/msf/base/sessions/ssh_command_shell_bind.rb - About 1 hr to fix

      Method create_client_channel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_client_channel(params)
            msf_channel = nil
            mutex = Mutex.new
            condition = ConditionVariable.new
            opened = false
      Severity: Minor
      Found in lib/msf/base/sessions/ssh_command_shell_bind.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 create_server_channel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def create_server_channel(params)
            msf_channel = nil
            mutex = Mutex.new
            condition = ConditionVariable.new
            timed_out = false
      Severity: Minor
      Found in lib/msf/base/sessions/ssh_command_shell_bind.rb - About 1 hr to fix

        Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def create(params)
              # Notify handlers before we create the socket
              notify_before_socket_create(self, params)
        
              if params.proto == 'tcp'
        Severity: Minor
        Found in lib/msf/base/sessions/ssh_command_shell_bind.rb - About 35 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

        There are no issues that match your filters.

        Category
        Status