rapid7/metasploit-framework

View on GitHub
modules/post/windows/gather/credentials/xshell_xftp_password.rb

Summary

Maintainability
C
1 day
Test Coverage

Method enum_session_file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def enum_session_file(path, user_profiles)
    xsh_xfp = []
    tbl = []
    print_status("Search session files on #{path}")
    xsh_xfp += session.fs.file.search(path, '*.xsh')
Severity: Minor
Found in modules/post/windows/gather/credentials/xshell_xftp_password.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 run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    print_status("Gather Xshell and Xftp Passwords on #{sysinfo['Computer']}")
    profiles = grab_user_profiles
    result = []
    profiles.each do |user_profiles|
Severity: Minor
Found in modules/post/windows/gather/credentials/xshell_xftp_password.rb - About 1 hr to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Windows Gather Xshell and Xftp Passwords',
    Severity: Minor
    Found in modules/post/windows/gather/credentials/xshell_xftp_password.rb - About 1 hr to fix

      Method enum_session_file has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def enum_session_file(path, user_profiles)
          xsh_xfp = []
          tbl = []
          print_status("Search session files on #{path}")
          xsh_xfp += session.fs.file.search(path, '*.xsh')
      Severity: Minor
      Found in modules/post/windows/gather/credentials/xshell_xftp_password.rb - About 1 hr to fix

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

          def run
            print_status("Gather Xshell and Xftp Passwords on #{sysinfo['Computer']}")
            profiles = grab_user_profiles
            result = []
            profiles.each do |user_profiles|
        Severity: Minor
        Found in modules/post/windows/gather/credentials/xshell_xftp_password.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 try_encode_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def try_encode_file(data)
            # version 6.0 The character set of the session file will use Unicode
            # version <= 5.3 The character set of the session file will use ANSI
            if data[0].unpack('C') == [255] && data[1].unpack('C') == [254]
              data[2..].force_encoding('UTF-16LE').encode('UTF-8')
        Severity: Minor
        Found in modules/post/windows/gather/credentials/xshell_xftp_password.rb - About 25 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