rapid7/metasploit-framework

View on GitHub
modules/post/multi/gather/skype_enum.rb

Summary

Maintainability
D
2 days
Test Coverage

Method process_db has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process_db(db_path, user)
    db = SQLite3::Database.new(db_path)

    # Extract information for accounts configured in Skype
    print_status('Enumerating accounts')
Severity: Major
Found in modules/post/multi/gather/skype_enum.rb - About 4 hrs to fix

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

      def run
        # syinfo is only on meterpreter sessions
        print_status("Running Skype enumeration against #{sysinfo['Computer']}") if !sysinfo.nil?
    
        # Ensure that SQLite3 gem is installed
    Severity: Minor
    Found in modules/post/multi/gather/skype_enum.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

    File skype_enum.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'csv'
    
    class MetasploitModule < Msf::Post
      include Msf::Post::File
      include Msf::Post::Windows::UserProfiles
    Severity: Minor
    Found in modules/post/multi/gather/skype_enum.rb - About 2 hrs to fix

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

        def download_db(profile)
          if session.type == 'meterpreter'
            if session.platform == 'osx'
              file = session.fs.file.search("#{profile['dir']}/Library/Application Support/Skype/", 'main.db', true)
            else
      Severity: Minor
      Found in modules/post/multi/gather/skype_enum.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 download_db has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def download_db(profile)
          if session.type == 'meterpreter'
            if session.platform == 'osx'
              file = session.fs.file.search("#{profile['dir']}/Library/Application Support/Skype/", 'main.db', true)
            else
      Severity: Minor
      Found in modules/post/multi/gather/skype_enum.rb - About 1 hr to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Multi Gather Skype User Data Enumeration',
        Severity: Minor
        Found in modules/post/multi/gather/skype_enum.rb - About 1 hr to fix

          Method process_db has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def process_db(db_path, user)
              db = SQLite3::Database.new(db_path)
          
              # Extract information for accounts configured in Skype
              print_status('Enumerating accounts')
          Severity: Minor
          Found in modules/post/multi/gather/skype_enum.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 run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run
              # syinfo is only on meterpreter sessions
              print_status("Running Skype enumeration against #{sysinfo['Computer']}") if !sysinfo.nil?
          
              # Ensure that SQLite3 gem is installed
          Severity: Minor
          Found in modules/post/multi/gather/skype_enum.rb - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status