rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

Method run has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    print_status('Checking if BulletProof FTP Client is installed...')
    if !check_installation
      print_error("BulletProof FTP Client isn't installed")
      return
Severity: Major
Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb - About 3 hrs to fix

    File bulletproof_ftp.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Post
      include Msf::Auxiliary::Report
      include Msf::Post::File
      include Msf::Post::Windows::UserProfiles
      include Msf::Post::Windows::Registry
    Severity: Minor
    Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb - About 2 hrs to fix

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

        def run
          print_status('Checking if BulletProof FTP Client is installed...')
          if !check_installation
            print_error("BulletProof FTP Client isn't installed")
            return
      Severity: Minor
      Found in modules/post/windows/gather/credentials/bulletproof_ftp.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 report_findings has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def report_findings(entries)
          entries.each do |entry|
            @credentials << [
              entry[:site_name],
              entry[:site_address],
      Severity: Minor
      Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb - About 1 hr to fix

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

          def get_bookmarks(path)
            bookmarks = []
        
            if !directory?(path)
              return bookmarks
        Severity: Minor
        Found in modules/post/windows/gather/credentials/bulletproof_ftp.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

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Windows Gather BulletProof FTP Client Saved Password Extraction',
        Severity: Major
        Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb and 5 other locations - About 25 mins to fix
        modules/post/windows/gather/credentials/sso.rb on lines 12..34
        modules/post/windows/gather/credentials/steam.rb on lines 10..31
        modules/post/windows/gather/credentials/winscp.rb on lines 13..36
        modules/post/windows/gather/enum_putty_saved_sessions.rb on lines 16..42
        modules/post/windows/gather/enum_termserv.rb on lines 11..31

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 30.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            session.fs.dir.foreach(program_files) do |dir|
              if dir =~ /BulletProof FTP Client/
                vprint_status("BulletProof Installation directory found at #{program_files}\\#{dir}")
                bullet_paths << "#{program_files}\\#{dir}"
        Severity: Minor
        Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb and 1 other location - About 20 mins to fix
        modules/post/multi/gather/apple_ios_backup.rb on lines 163..166

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 27.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            session.fs.dir.foreach(user_dir) do |directory|
              if directory =~ /BulletProof Software/
                vprint_status("BulletProof Data Directory found at #{user_dir}\\#{directory}")
                return "#{user_dir}\\#{directory}" # "\\BulletProof FTP Client\\2010\\sites\\Bookmarks"
        Severity: Minor
        Found in modules/post/windows/gather/credentials/bulletproof_ftp.rb and 1 other location - About 15 mins to fix
        modules/post/multi/gather/filezilla_client_cred.rb on lines 111..114

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 26.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status