rapid7/metasploit-framework

View on GitHub
lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb

Summary

Maintainability
F
4 days
Test Coverage

File rftransceiver.rb has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Rex
module Post
module HWBridge
module Ui
###
Severity: Major
Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb - About 1 day to fix

    Class RFtransceiver has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Console::CommandDispatcher::RFtransceiver
      include Console::CommandDispatcher
      include Msf::Auxiliary::Report
    
      #
    Severity: Minor
    Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb - About 3 hrs to fix

      Method cmd_xmit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def cmd_xmit(*args)
          self.idx ||= 0
          data = nil
          repeat = -1
          offset = -1

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

          def cmd_recv(*args)
            self.idx ||= 0
            arg = {}
            timeout = -1
            blocksize = -1

          Method cmd_channel_bw has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def cmd_channel_bw(*args)
              self.idx ||= 0
              bandwidth = -1
              mhz = nil
              arg = {}

            Method cmd_deviation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def cmd_deviation(*args)
                self.idx ||= 0
                deviat = -1
                mhz = nil
                arg = {}

              Method cmd_baud has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def cmd_baud(*args)
                  self.idx ||= 0
                  baud = -1
                  mhz = nil
                  arg = {}

                Method cmd_freq has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def cmd_freq(*args)
                    self.idx ||= 0
                    freq = -1
                    mhz = nil
                    arg = {}

                  Method cmd_recv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cmd_recv(*args)
                      self.idx ||= 0
                      arg = {}
                      timeout = -1
                      blocksize = -1

                  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_xmit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def cmd_xmit(*args)
                      self.idx ||= 0
                      data = nil
                      repeat = -1
                      offset = -1
                  Severity: Minor
                  Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb - About 55 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

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

                    def cmd_channel_bw(*args)
                      self.idx ||= 0
                      bandwidth = -1
                      mhz = nil
                      arg = {}
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 404..432
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 438..466

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

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

                    def cmd_deviation(*args)
                      self.idx ||= 0
                      deviat = -1
                      mhz = nil
                      arg = {}
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 370..398
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 404..432

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

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

                    def cmd_baud(*args)
                      self.idx ||= 0
                      baud = -1
                      mhz = nil
                      arg = {}
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 370..398
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 438..466

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

                  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

                    def cmd_flen(*args)
                      self.idx ||= 0
                      flen = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 200..222
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 342..364
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 472..494
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 505..527
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 561..583

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

                  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

                    def cmd_preamble(*args)
                      self.idx ||= 0
                      preamble = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 172..194
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 200..222
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 342..364
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 472..494
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 561..583

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

                  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

                    def cmd_power(*args)
                      self.idx ||= 0
                      power = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 172..194
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 200..222
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 342..364
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 472..494
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 505..527

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

                  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

                    def cmd_channel(*args)
                      self.idx ||= 0
                      channel = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 172..194
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 200..222
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 472..494
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 505..527
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 561..583

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

                  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

                    def cmd_vlen(*args)
                      self.idx ||= 0
                      vlen = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 172..194
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 342..364
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 472..494
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 505..527
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 561..583

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

                  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

                    def cmd_sync_word(*args)
                      self.idx ||= 0
                      word = -1
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ],
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 172..194
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 200..222
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 342..364
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 505..527
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 561..583

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

                  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

                      all = {
                        'supported_idx'     => 'suppored USB indexes',
                        'idx'               => 'sets an active idx',
                        'freq'              => 'sets the frequency',
                        'modulation'        => 'sets the modulation',
                  lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb on lines 73..92

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

                  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 cmd_enable_crc(*args)
                      self.idx ||= 0
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ]
                      )
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 322..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 38.

                  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 cmd_enable_manchester(*args)
                      self.idx ||= 0
                      opts = Rex::Parser::Arguments.new(
                        '-h' => [ false, 'Help Banner' ]
                      )
                  lib/rex/post/hwbridge/ui/console/command_dispatcher/rftransceiver.rb on lines 302..316

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

                  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