rapid7/metasploit-framework

View on GitHub
modules/auxiliary/spoof/dns/bailiwicked_host.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)
Severity: Minor
Found in modules/auxiliary/spoof/dns/bailiwicked_host.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 186 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    check_pcaprub_loaded # Check first.

    target   = rhost()
    source   = Rex::Socket.source_address(target)
Severity: Major
Found in modules/auxiliary/spoof/dns/bailiwicked_host.rb - About 7 hrs to fix

    File bailiwicked_host.rb has 360 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_host.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_host.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_host.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_host.rb - About 2 hrs to fix

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

            def initialize(info = {})
              super(update_info(info,
                'Name'           => 'DNS BailiWicked Host Attack',
                'Description'    => %q{
                  This exploit attacks a fairly ubiquitous flaw in DNS implementations which
          Severity: Minor
          Found in modules/auxiliary/spoof/dns/bailiwicked_host.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_host.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

            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_host.rb and 1 other location - About 1 day to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 398..477

            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_host.rb and 1 other location - About 6 hrs to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 75..150

            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_host.rb and 1 other location - About 3 hrs to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 242..257

            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_host.rb and 1 other location - About 2 hrs to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 173..195

            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_host.rb and 1 other location - About 1 hr to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 341..353

            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_host.rb and 1 other location - About 40 mins to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 329..337

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

                super(update_info(info,
                  'Name'           => 'DNS BailiWicked Host Attack',
                  'Description'    => %q{
                    This exploit attacks a fairly ubiquitous flaw in DNS implementations which
                    Dan Kaminsky found and disclosed ~Jul 2008.  This exploit caches a single
            Severity: Major
            Found in modules/auxiliary/spoof/dns/bailiwicked_host.rb and 4 other locations - About 25 mins to fix
            modules/auxiliary/admin/http/vbulletin_upgrade_admin.rb on lines 12..32
            modules/auxiliary/admin/scada/ge_proficy_substitute_traversal.rb on lines 13..33
            modules/auxiliary/admin/vnc/realvnc_41_bypass.rb on lines 10..33
            modules/auxiliary/dos/windows/http/ms10_065_ii6_asp_dos.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 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

            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_host.rb and 1 other location - About 25 mins to fix
            modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 63..72

            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