rapid7/metasploit-framework

View on GitHub
modules/auxiliary/spoof/dns/bailiwicked_domain.rb

Summary

Maintainability
F
6 days
Test Coverage

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

  def run
    check_pcaprub_loaded # Check first
    target  = rhost()
    source  = Rex::Socket.source_address(target)
    saddr   = datastore['SRCADDR']
Severity: Minor
Found in modules/auxiliary/spoof/dns/bailiwicked_domain.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 run has 187 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    check_pcaprub_loaded # Check first
    target  = rhost()
    source  = Rex::Socket.source_address(target)
    saddr   = datastore['SRCADDR']
Severity: Major
Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 7 hrs to fix

    File bailiwicked_domain.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'net/dns'
    require 'resolv'
    
    class MetasploitModule < Msf::Auxiliary
      include Msf::Exploit::Capture
    Severity: Minor
    Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 4 hrs to fix

      Method check has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def check
          targ = rhost
      
          srv_sock = Rex::Socket.create_udp(
            'PeerHost' => targ,
      Severity: Minor
      Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 3 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 check has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def check
          targ = rhost
      
          srv_sock = Rex::Socket.create_udp(
            'PeerHost' => targ,
      Severity: Major
      Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 2 hrs to fix

        Method calculate_race has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def calculate_race(server, domain, num=50)
        
            q_beg_t = nil
            q_end_t = nil
            cnt     = 0
        Severity: Major
        Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 2 hrs to fix

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

            def initialize(info = {})
              super(update_info(info,
                'Name'           => 'DNS BailiWicked Domain Attack',
                'Description'    => %q{
                  This exploit attacks a fairly ubiquitous flaw in DNS implementations which
          Severity: Minor
          Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 1 hr to fix

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

              def calculate_race(server, domain, num=50)
            
                q_beg_t = nil
                q_end_t = nil
                cnt     = 0
            Severity: Minor
            Found in modules/auxiliary/spoof/dns/bailiwicked_domain.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

            Avoid too many return statements within this method.
            Open

                            return
            Severity: Major
            Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 30 mins to fix

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

                def calculate_race(server, domain, num=50)
              
                  q_beg_t = nil
                  q_end_t = nil
                  cnt     = 0
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 1 day to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 395..474

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

              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

                def check
                  targ = rhost
              
                  srv_sock = Rex::Socket.create_udp(
                    'PeerHost' => targ,
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 6 hrs to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 71..146

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

              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

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

                  answer0.answer.each do |rr0|
                    print_status " Got an #{rr0.type} record: #{rr0.inspect}"
                    if rr0.type == 'NS'
                      print_status "  Querying recon nameserver for address of #{rr0.nsdname}..."
                      answer1 = res0.send(rr0.nsdname) # get the ns's answer for the hostname
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 3 hrs to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 238..253

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

              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

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

                  if sport.to_i == 0
                    req = Resolv::DNS::Message.new
                    txt = "spoofprobe-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com"
                    req.add_question(txt, Resolv::DNS::Resource::IN::TXT)
                    req.rd = 1
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 2 hrs to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 171..193

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

              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

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

                    if queries % 1000 == 0
                      print_status("Sent #{queries} queries and #{responses} spoofed responses...")
                      if(xids == 0)
                        print_status("Recalculating the number of spoofed replies to send per query...")
                        qcnt = calculate_race(target, domain, 25)
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 1 hr to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 340..352

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

              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

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

                    xidbase.upto(xidbase+numxids-1) do |id|
                      req.id = id
                      p.payload = req.encode
                      barbs.each do |barb|
                        p.ip_saddr = barb[:addr].to_s
              Severity: Minor
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 40 mins to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 328..336

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

              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

                  super(update_info(info,
                    'Name'           => 'DNS BailiWicked Domain Attack',
                    'Description'    => %q{
                      This exploit attacks a fairly ubiquitous flaw in DNS implementations which
                      Dan Kaminsky found and disclosed ~Jul 2008.  This exploit replaces the target
              Severity: Minor
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 25 mins to fix
              modules/auxiliary/dos/http/nodejs_pipelining.rb on lines 11..33

              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

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

                def cmd_racer(*args)
                  targ = args[0] || rhost()
                  dom  = args[1] || "example.com"
              
                  if !(targ and targ.length > 0)
              Severity: Minor
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 25 mins to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 59..68

              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

              There are no issues that match your filters.

              Category
              Status