rapid7/metasploit-framework

View on GitHub
lib/rex/proto/dcerpc/packet.rb

Summary

Maintainability
C
1 day
Test Coverage

Method make_bind_fake_multi has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.make_bind_fake_multi(uuid, vers, bind_head=0, bind_tail=0)

    bind_head = bind_head.to_i
    bind_tail = bind_tail.to_i
    bind_head = rand(6)+10 if bind_head == 0
Severity: Major
Found in lib/rex/proto/dcerpc/packet.rb - About 2 hrs to fix

    Method make_bind has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.make_bind(uuid, vers, xfer_syntax_uuid=UUID.xfer_syntax_uuid, xfer_syntax_vers=UUID.xfer_syntax_vers)
    
        # Process the version strings ("1.0", 1.0, "1", 1)
        bind_vers_maj, bind_vers_min = UUID.vers_to_nums(vers)
        xfer_vers_maj, xfer_vers_min = UUID.vers_to_nums(xfer_syntax_vers)
    Severity: Minor
    Found in lib/rex/proto/dcerpc/packet.rb - About 1 hr to fix

      Method make_alter_context has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.make_alter_context(uuid, vers)
          u = Rex::Proto::DCERPC::UUID
      
          # Process the version strings ("1.0", 1.0, "1", 1)
          bind_vers_maj, bind_vers_min = UUID.vers_to_nums(vers)
      Severity: Minor
      Found in lib/rex/proto/dcerpc/packet.rb - About 1 hr to fix

        Method make_request_chunk has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.make_request_chunk(flags=3, opnum=0, data="", ctx=0, object_id = '')
        
            flags = flags.to_i
            opnum = opnum.to_i
            ctx   = ctx.to_i
        Severity: Minor
        Found in lib/rex/proto/dcerpc/packet.rb - About 1 hr to fix

          Method make_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def self.make_request(opnum=0, data="", size=data.length, ctx=0, object_id = '')
          Severity: Minor
          Found in lib/rex/proto/dcerpc/packet.rb - About 35 mins to fix

            Method make_request_chunk has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def self.make_request_chunk(flags=3, opnum=0, data="", ctx=0, object_id = '')
            Severity: Minor
            Found in lib/rex/proto/dcerpc/packet.rb - About 35 mins to fix

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

                  1.upto(bind_head) do ||
                    # Generate some random UUID and versions
                    rand_uuid = Rex::Text.rand_text(16)
                    rand_imaj = rand(6)
                    rand_imin = rand(4)
              Severity: Minor
              Found in lib/rex/proto/dcerpc/packet.rb and 1 other location - About 35 mins to fix
              lib/rex/proto/dcerpc/packet.rb on lines 123..141

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

              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

                  1.upto(bind_tail) do ||
                    # Generate some random UUID and versions
                    rand_uuid = Rex::Text.rand_text(16)
                    rand_imaj = rand(6)
                    rand_imin = rand(4)
              Severity: Minor
              Found in lib/rex/proto/dcerpc/packet.rb and 1 other location - About 35 mins to fix
              lib/rex/proto/dcerpc/packet.rb on lines 86..104

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

              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