rapid7/metasploit-framework

View on GitHub
lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb

Summary

Maintainability
F
3 days
Test Coverage

Method cmd_execute_bof has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

          def cmd_execute_bof(*args)
            if args.empty?
              cmd_execute_bof_help
              return false
            end
Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 1 day 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 cmd_execute_bof has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def cmd_execute_bof(*args)
            if args.empty?
              cmd_execute_bof_help
              return false
            end
Severity: Major
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 4 hrs to fix

    Method get_executable_symbols has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

              def get_executable_symbols(coff)
                executable_symbols = []
                coff.symbols.each do |sym|
                  next unless sym
                  next unless sym.sec_nr.is_a? Integer
    Severity: Minor
    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 4 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 compile_c has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

              def compile_c(source)
                if client.arch == ARCH_X86
                  mingw = Metasploit::Framework::Compiler::Mingw::X86.new
                elsif client.arch == ARCH_X64
                  mingw = Metasploit::Framework::Compiler::Mingw::X64.new
    Severity: Minor
    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.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

    Avoid too many return statements within this method.
    Open

                          return false
    Severity: Major
    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                    return unless bof_data
      Severity: Major
      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                              return false
        Severity: Major
        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                        return
          Severity: Major
          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                          return
            Severity: Major
            Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                            return
              Severity: Major
              Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return
                Severity: Major
                Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                        return false
                  Severity: Major
                  Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return false
                    Severity: Major
                    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                    return
                      Severity: Major
                      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                      return
                        Severity: Major
                        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.rb - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status