rapid7/metasploit-framework

View on GitHub
modules/post/multi/recon/multiport_egress_traffic.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  def run
    type = datastore['METHOD']
    remote = datastore['TARGET']
    thread_num = datastore['THREADS']
    proto = datastore['PROTOCOL']
Severity: Minor
Found in modules/post/multi/recon/multiport_egress_traffic.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 run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    type = datastore['METHOD']
    remote = datastore['TARGET']
    thread_num = datastore['THREADS']
    proto = datastore['PROTOCOL']
Severity: Major
Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Generate TCP/UDP Outbound Traffic On Multiple Ports',
    Severity: Minor
    Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 1 hr to fix

      Method egress has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def egress(type, proto, remote, dport, num, gw)
      Severity: Minor
      Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 45 mins to fix

        Method native_init_connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def native_init_connect(proto, ip, port, num, gw)
            vprint_status("[#{num}:NATIVE] Connecting to #{ip} port #{proto}/#{port}")
            if proto == 'TCP'
              begin
                Rex::Socket::Tcp.create(
        Severity: Minor
        Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 45 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 egress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def egress(type, proto, remote, dport, num, gw)
            if type == 'WINAPI'
              if proto == 'ALL'
                winapi_egress_to_port('TCP', remote, dport, num)
                winapi_egress_to_port('UDP', remote, dport, num)
        Severity: Minor
        Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 45 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 native_init_connect has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def native_init_connect(proto, ip, port, num, gw)
        Severity: Minor
        Found in modules/post/multi/recon/multiport_egress_traffic.rb - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status