ronin-rb/ronin-support

View on GitHub

Showing 114 of 202 total issues

Method initialize_ssl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def initialize_ssl(ca_bundle:        nil,
                           cert:             nil,
                           cert_store:       nil,
                           ciphers:          nil,
                           extra_chain_cert: nil,
Severity: Minor
Found in lib/ronin/support/network/http.rb - About 1 hr to fix

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

              def imap_connect(host, user: ,
                                     password: ,
                                     port:  DEFAULT_PORT,
                                     ssl:   nil,
                                     auth: :login)
    Severity: Minor
    Found in lib/ronin/support/network/imap/mixin.rb - About 1 hr to fix

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

              def get_string(offset,length=nil)
                if (offset < 0) || (offset >= size)
                  raise(IndexError,"offset #{offset} is out of bounds: 0...#{size - 1}")
                elsif (length && (offset + length) > size)
                  raise(IndexError,"offset #{offset} or length #{length} is out of bounds: 0...#{size - 1}")
      Severity: Minor
      Found in lib/ronin/support/binary/buffer.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 ip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

                def ip(ip)
                  address = ip.to_s
                  ip      = IPAddr.new(ip) unless ip.kind_of?(IPAddr)
      
                  prefixes = if ip.ipv6? then @ipv6_prefixes
      Severity: Minor
      Found in lib/ronin/support/network/asn/list.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 escape_byte has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.escape_byte(byte)
                if byte >= 0x00 && byte <= 0xff
                  if    byte == 0x22
                    "\\\""
                  elsif byte == 0x5d
      Severity: Minor
      Found in lib/ronin/support/encoding/hex.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 connect_uri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.connect_uri(url, ssl:      nil,
                                        user:     nil,
                                        password: nil,
                                        **kwargs, &block)
                case url
      Severity: Minor
      Found in lib/ronin/support/network/http.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 to_s has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def to_s
                  message = []
      
                  if @from
                    message << "From: #{@from}"
      Severity: Minor
      Found in lib/ronin/support/network/smtp/email.rb - About 1 hr to fix

        Method parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def self.parse(string)
                    kwargs = {}
                    params = {}
        
                    string.split(/;\s+/) do |field|
        Severity: Minor
        Found in lib/ronin/support/network/http/set_cookie.rb - About 1 hr to fix

          Method pop3_connect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def pop3_connect(host, port: DEFAULT_PORT,
                                           ssl:  nil,
                                           user: ,
                                           password: )
                      host = DNS::IDN.to_ascii(host)
          Severity: Minor
          Found in lib/ronin/support/network/pop3/mixin.rb - About 1 hr to fix

            Method connect_uri has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def self.connect_uri(url, ssl:      nil,
                                              user:     nil,
                                              password: nil,
                                              **kwargs, &block)
                      case url
            Severity: Minor
            Found in lib/ronin/support/network/http.rb - About 1 hr to fix

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

                def each_unique_substring(min=1,&block)
                  return enum_for(__method__,min) unless block
              
                  unique_strings = {}
              
              
              Severity: Minor
              Found in lib/ronin/support/core_ext/string.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 parse_line has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                        def parse_line(line)
                          if @type.kind_of?(CTypes::CharType)
                            # because od/hexdump print the ' ' char as white space,
                            # we need special parsing logic here.
                            if (start_index = line.index(' '))
              Severity: Minor
              Found in lib/ronin/support/binary/unhexdump/parser.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 padding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def self.padding(new_padding=nil)
                        unless new_padding.nil?
                          @padding = new_padding
                        else
                          if @padding.nil?
              Severity: Minor
              Found in lib/ronin/support/binary/struct.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 stream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def stream(io, block_size: 16384, output: nil)
                        unless block_given?
                          output ||= String.new(encoding: Encoding::ASCII_8BIT)
                        end
              
              
              Severity: Minor
              Found in lib/ronin/support/crypto/cipher.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 poll has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                        def poll
                          sockets = [@socket] + client_connections + server_connections
              
                          readable, _writtable, errors = IO.select(sockets,nil,sockets)
              
              
              Severity: Minor
              Found in lib/ronin/support/network/tcp/proxy.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                        def self.parse(string)
                          kwargs = {}
                          params = {}
              
                          string.split(/;\s+/) do |field|
              Severity: Minor
              Found in lib/ronin/support/network/http/set_cookie.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 build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                        def self.build(common_name: nil, email_address: nil, organizational_unit: nil, organization: nil, locality: nil, state: nil, province: nil, country: nil)
                          name = new
                          name.add_entry("CN",common_name)             if common_name
                          name.add_entry('emailAddress',email_address) if email_address
                          name.add_entry("OU",organizational_unit)     if organizational_unit
              Severity: Minor
              Found in lib/ronin/support/crypto/cert.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                        def self.parse(path=PATH)
                          return enum_for(__method__,path) unless block_given?
              
                          type = nil
              
              
              Severity: Minor
              Found in lib/ronin/support/network/public_suffix/list.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 join has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def join(*names)
                      joined_path = if root? then String.new(encoding: Encoding::UTF_8)
                                    else          self.to_s
                                    end
              
              
              Severity: Minor
              Found in lib/ronin/support/path.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 tld_regexp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                        def tld_regexp(tld,subtree)
                          if subtree
                            subtree_regexp = if subtree.length == 1
                                               tld_regexp(subtree.keys[0],subtree.values[0])
                                             else
              Severity: Minor
              Found in lib/ronin/support/network/public_suffix/list.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

              Severity
              Category
              Status
              Source
              Language