rapid7/metasploit-framework

View on GitHub
modules/post/multi/manage/screenshare.rb

Summary

Maintainability
D
2 days
Test Coverage

Method on_request_uri has 303 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def on_request_uri(cli, request)
    if request.uri =~ %r{/screenshot$}
      data = ''
      if supports_espia?(session)
        data = session.espia.espia_image_get_dev_screen
Severity: Major
Found in modules/post/multi/manage/screenshare.rb - About 1 day to fix

    File screenshare.rb has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Post
    
      include Msf::Exploit::Remote::HttpServer
    
      def initialize(info = {})
    Severity: Minor
    Found in modules/post/multi/manage/screenshare.rb - About 4 hrs to fix

      Method on_request_uri has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def on_request_uri(cli, request)
          if request.uri =~ %r{/screenshot$}
            data = ''
            if supports_espia?(session)
              data = session.espia.espia_image_get_dev_screen
      Severity: Minor
      Found in modules/post/multi/manage/screenshare.rb - About 2 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 initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'Multi Manage the screen of the target meterpreter session',
      Severity: Minor
      Found in modules/post/multi/manage/screenshare.rb - About 1 hr to fix

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

          def supports_espia?(session)
            return false unless session.platform == 'windows'
        
            session.core.use('espia') unless session.espia
            session.espia.present?
        Severity: Minor
        Found in modules/post/multi/manage/screenshare.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