rapid7/metasploit-framework

View on GitHub
modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb

Summary

Maintainability
D
2 days
Test Coverage

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

  def enum_instance(rhost)
    print_status("#{rhost}:#{rport} [SAP] Connecting to SAP Management Console SOAP Interface")
    success = false
    soapenv='http://schemas.xmlsoap.org/soap/envelope/'
    xsi='http://www.w3.org/2001/XMLSchema-instance'
Severity: Minor
Found in modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.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 enum_instance has 199 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def enum_instance(rhost)
    print_status("#{rhost}:#{rport} [SAP] Connecting to SAP Management Console SOAP Interface")
    success = false
    soapenv='http://schemas.xmlsoap.org/soap/envelope/'
    xsi='http://www.w3.org/2001/XMLSchema-instance'
Severity: Major
Found in modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb - About 7 hrs to fix

    Avoid too many return statements within this method.
    Open

          return
    Severity: Major
    Found in modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb - About 30 mins to fix

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

        def initialize
          super(
            'Name'         => 'SAP Management Console Instance Properties',
            'Description'  => %q{
              This module simply attempts to identify the instance properties
      modules/auxiliary/scanner/http/sap_businessobjects_user_brute.rb on lines 12..33
      modules/auxiliary/scanner/http/sap_businessobjects_user_enum.rb on lines 12..35
      modules/auxiliary/scanner/http/sap_businessobjects_version_enum.rb on lines 11..29
      modules/auxiliary/scanner/sap/sap_mgmt_con_abaplog.rb on lines 11..29
      modules/auxiliary/scanner/sap/sap_mgmt_con_extractusers.rb on lines 11..32
      modules/auxiliary/scanner/sap/sap_mgmt_con_getaccesspoints.rb on lines 11..32
      modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb on lines 11..32
      modules/auxiliary/scanner/sap/sap_mgmt_con_startprofile.rb on lines 11..32
      modules/auxiliary/scanner/sap/sap_mgmt_con_version.rb on lines 11..32

      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 33.

      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

            if dbstring
              print_good("#{rhost}:#{rport} [SAP] ABAP DATABASE: #{dbstring}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 210..217

      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 31.

      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

            if j2eedbstring
              print_good("#{rhost}:#{rport} [SAP] J2EE DATABASE: #{j2eedbstring}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 201..208

      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 31.

      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 6 locations. Consider refactoring.
      Open

            if instancename
              print_good("#{rhost}:#{rport} [SAP] Instance Name: #{instancename}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 153..159
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 161..167
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 169..175
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 185..191
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 193..199

      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 29.

      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 6 locations. Consider refactoring.
      Open

            if sapsystem
              print_good("#{rhost}:#{rport} [SAP] SAP System Number: #{sapsystem}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 161..167
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 169..175
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 177..183
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 185..191
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 193..199

      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 29.

      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 6 locations. Consider refactoring.
      Open

            if saplocalhost
              print_good("#{rhost}:#{rport} [SAP] SAP Localhost: #{saplocalhost}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 153..159
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 161..167
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 177..183
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 185..191
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 193..199

      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 29.

      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 6 locations. Consider refactoring.
      Open

            if icmurl
              print_good("#{rhost}:#{rport} [SAP] ICM URL: #{icmurl}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 153..159
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 161..167
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 169..175
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 177..183
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 193..199

      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 29.

      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 6 locations. Consider refactoring.
      Open

            if sapsystemname
              print_good("#{rhost}:#{rport} [SAP] SAP System Name: #{sapsystemname}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 153..159
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 169..175
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 177..183
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 185..191
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 193..199

      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 29.

      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 6 locations. Consider refactoring.
      Open

            if igsurl
              print_good("#{rhost}:#{rport} [SAP] IGS URL: #{igsurl}")
              report_note(:host => rhost,
                    :proto => 'tcp',
                    :port => rport,
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 153..159
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 161..167
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 169..175
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 177..183
      modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.rb on lines 185..191

      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 29.

      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 10 locations. Consider refactoring.
      Open

        def run_host(ip)
          res = send_request_cgi({
            'uri'      => normalize_uri(datastore['URI']),
            'method'   => 'GET'
          }, 25)
      modules/auxiliary/scanner/sap/sap_mgmt_con_abaplog.rb on lines 32..43
      modules/auxiliary/scanner/sap/sap_mgmt_con_extractusers.rb on lines 35..46
      modules/auxiliary/scanner/sap/sap_mgmt_con_getaccesspoints.rb on lines 35..46
      modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb on lines 35..46
      modules/auxiliary/scanner/sap/sap_mgmt_con_getprocesslist.rb on lines 38..49
      modules/auxiliary/scanner/sap/sap_mgmt_con_listconfigfiles.rb on lines 40..51
      modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb on lines 37..48
      modules/auxiliary/scanner/sap/sap_mgmt_con_startprofile.rb on lines 35..46
      modules/auxiliary/scanner/sap/sap_mgmt_con_version.rb on lines 35..46

      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 28.

      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