ronin-rb/ronin

View on GitHub

Showing 47 of 57 total issues

Method print_full_cert has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def print_full_cert(cert)
          fields = {}

          fields["Serial"]     = cert.serial
          fields["Version"]    = cert.version
Severity: Minor
Found in lib/ronin/cli/commands/cert_dump.rb - About 1 hr to fix

    Method headers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def headers(subcommand=nil,name=nil,value=nil)
            case subcommand
            when 'set'
              if (name && value)
                @http.headers[name] = value
    Severity: Minor
    Found in lib/ronin/cli/http_shell.rb - About 1 hr 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 define_network_options has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.define_network_options(command)
            command.option :mac_addr, desc: 'Searches for all MAC addresses' do
              @pattern = MAC_ADDR
            end
    
    
    Severity: Minor
    Found in lib/ronin/cli/pattern_options.rb - About 1 hr to fix

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

              def run
                if options[:generate_key]
                  log_info "Generating new #{options.fetch(:key_type,:rsa).upcase} key ..."
                end
      
      
      Severity: Minor
      Found in lib/ronin/cli/commands/cert_gen.rb - About 1 hr to fix

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

              def self.define_credentials_options(command)
                command.option :ssh_private_key, desc: 'Searches for all SSH private key data' do
                  @pattern = SSH_PRIVATE_KEY
                end
        
        
        Severity: Minor
        Found in lib/ronin/cli/pattern_options.rb - About 1 hr to fix

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

                  def process_value(url)
                    unless url =~ URL_REGEX
                      print_error "invalid URL: #{url.inspect}"
                      return
                    end
          Severity: Minor
          Found in lib/ronin/cli/commands/http.rb - About 1 hr to fix

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

                    def process_value(url)
                      uri = URI(url)
            
                      if options[:user]
                        puts uri.user
            Severity: Minor
            Found in lib/ronin/cli/commands/url.rb - About 1 hr to fix

              Method signing_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def signing_key
                        if options[:key_file]
                          if options[:key_type]
                            key_class.load_file(options[:key_file])
                          else
              Severity: Minor
              Found in lib/ronin/cli/commands/cert_gen.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

              Method match_line has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def match_line(line,**kwargs)
                        index = 0
              
                        printed_prefix = false
                        only_matching  = options[:only_matching]
              Severity: Minor
              Found in lib/ronin/cli/commands/grep.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

              Method process_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def process_value(string)
                        if options[:deobfuscate]
                          string = Support::Network::EmailAddress.deobfuscate(string)
                        end
              
              
              Severity: Minor
              Found in lib/ronin/cli/commands/email_addr.rb - About 45 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

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

                      def run
                        if !File.file?(options[:file])
                          download
                        elsif options[:update] || stale?
                          update
              Severity: Minor
              Found in lib/ronin/cli/commands/asn.rb - About 45 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

              Method parse_highlight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def parse_highlight(value)
                        if value.start_with?('/')
                          unless (index = value.rindex('/:'))
                            raise(OptionParser::InvalidArgument,"argument must be of the form /REGEXP/:STYLE but was: #{value}")
                          end
              Severity: Minor
              Found in lib/ronin/cli/commands/hexdump.rb - About 45 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 deeply nested control flow statements.
              Open

                        elsif options[:query]
                          print_records(host.get_records(options[:query]))
                        else
                          puts host.name
              Severity: Major
              Found in lib/ronin/cli/commands/host.rb - About 45 mins to fix

                Method process_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def process_value(ip)
                          ip = Support::Network::IP.new(ip)
                
                          if options[:reverse]
                            puts ip.reverse
                Severity: Minor
                Found in lib/ronin/cli/commands/ip.rb - About 45 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

                Method process_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                        def process_value(host)
                          host = Support::Network::Host.new(host)
                
                          if options[:change_suffix]
                            process_host(host.change_suffix(options[:change_suffix]))
                Severity: Minor
                Found in lib/ronin/cli/commands/host.rb - About 45 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 deeply nested control flow statements.
                Open

                            puts host unless records.empty?
                Severity: Major
                Found in lib/ronin/cli/commands/host.rb - About 45 mins to fix

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

                          def run
                            if options[:list_categories]
                              puts tip_category_names
                            else
                              category = options[:category]
                  Severity: Minor
                  Found in lib/ronin/cli/commands/tips.rb - About 45 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

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

                          def process_value(url)
                            unless url =~ URL_REGEX
                              print_error "invalid URL: #{url.inspect}"
                              return
                            end
                  Severity: Minor
                  Found in lib/ronin/cli/commands/http.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

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

                          def process_input(input)
                            buffer     = String.new
                            min_length = options[:min_length]
                  
                            input.each_char do |char|
                  Severity: Minor
                  Found in lib/ronin/cli/commands/strings.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

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

                        def run(*files)
                          if (files.empty? && @input_values.empty?)
                            process_input(stdin)
                          else
                            @input_values.each do |value|
                  Severity: Minor
                  Found in lib/ronin/cli/string_processor_command.rb - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language