ronin-rb/ronin-support

View on GitHub

Showing 197 of 197 total issues

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

class String

  #
  # Returns a random typo substitution for the String.
  #
Severity: Minor
Found in lib/ronin/support/text/typo/core_ext/string.rb and 1 other location - About 40 mins to fix
lib/ronin/support/text/homoglyph/core_ext/string.rb on lines 21..138

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

class String

  #
  # Returns a random homoglyph substitution of the String.
  #
Severity: Minor
Found in lib/ronin/support/text/homoglyph/core_ext/string.rb and 1 other location - About 40 mins to fix
lib/ronin/support/text/typo/core_ext/string.rb on lines 21..144

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

Method udp_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def udp_connect_and_send(data,host,port,**kwargs,&block)
Severity: Minor
Found in lib/ronin/support/network/udp/mixin.rb - About 35 mins to fix

    Method tls_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def tls_connect_and_send(data,host,port, version: 1.2, **kwargs, &block)
    Severity: Minor
    Found in lib/ronin/support/network/tls/mixin.rb - About 35 mins to fix

      Method tcp_connect_and_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                def tcp_connect_and_send(data,host,port,**kwargs,&block)
      Severity: Minor
      Found in lib/ronin/support/network/tcp/mixin.rb - About 35 mins to fix

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

                  def to_s
                    string = super()
                    string << "; Max-Age=#{@max_age}"          if @max_age
                    string << "; Expires=#{@expires.httpdate}" if @expires
                    string << "; Path=#{@path}"                if @path
        Severity: Minor
        Found in lib/ronin/support/network/http/set_cookie.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 to_s has a Cognitive Complexity of 7 (exceeds 5 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 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 unescape has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.unescape(data)
                  unescaped = String.new(encoding: Encoding::UTF_8)
                  scanner   = StringScanner.new(data)
        
                  until scanner.eos?
        Severity: Minor
        Found in lib/ronin/support/encoding/ruby.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 unescape has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.unescape(data)
                  unescaped = String.new(encoding: Encoding::UTF_8)
                  scanner   = StringScanner.new(data)
        
                  until scanner.eos?
        Severity: Minor
        Found in lib/ronin/support/encoding/powershell.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 pack has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def pack(hash)
                    unknown_keys = hash.keys - @members.keys
        
                    unless unknown_keys.empty?
                      raise(ArgumentError,"unknown union members: #{unknown_keys.map(&:inspect).join(', ')}")
        Severity: Minor
        Found in lib/ronin/support/binary/ctypes/union_type.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def initialize(name, direction: ,
                                     key:       nil,
                                     hash:      :sha256,
                                     password:  nil,
                                     iv:        nil,
        Severity: Minor
        Found in lib/ronin/support/crypto/cipher.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 escape_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.escape_byte(byte)
                  if byte >= 0x00 && byte <= 0xff
                    ESCAPE_BYTES.fetch(byte) do
                      if byte >= 0x20 && byte <= 0x7e
                        byte.chr
        Severity: Minor
        Found in lib/ronin/support/encoding/powershell.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def initialize(string)
                    @string = string
        
                    if @string.include?(':') # IPv6
                      @version   = 6
        Severity: Minor
        Found in lib/ronin/support/network/ip_range/glob.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 escape_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.escape_byte(byte)
                  if byte >= 0x00 && byte <= 0xff
                    ESCAPE_BYTES.fetch(byte) do
                      if byte >= 0x20 && byte <= 0x7e
                        byte.chr
        Severity: Minor
        Found in lib/ronin/support/encoding/shell.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 escape_byte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.escape_byte(byte)
                  if byte >= 0x00 && byte <= 0xff
                    ESCAPE_BYTES.fetch(byte) do
                      if byte >= 0x20 && byte <= 0x7e
                        byte.chr
        Severity: Minor
        Found in lib/ronin/support/encoding/c.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

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

          def self.decrypt(path,cipher, block_size: 16384, output: nil, **kwargs,&block)
            cipher = Ronin::Support::Crypto.cipher(cipher, direction: :decrypt,
                                                           **kwargs)
            file   = File.open(path,'rb')
        
        
        Severity: Minor
        Found in lib/ronin/support/crypto/core_ext/file.rb and 1 other location - About 35 mins to fix
        lib/ronin/support/crypto/core_ext/file.rb on lines 237..242

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

        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 self.encrypt(path,cipher, block_size: 16384, output: nil, **kwargs,&block)
            cipher = Ronin::Support::Crypto.cipher(cipher, direction: :encrypt,
                                                           **kwargs)
            file   = File.open(path,'rb')
        
        
        Severity: Minor
        Found in lib/ronin/support/crypto/core_ext/file.rb and 1 other location - About 35 mins to fix
        lib/ronin/support/crypto/core_ext/file.rb on lines 298..303

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

        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

        class String
        
          #
          # XML escapes the String.
          #
        Severity: Minor
        Found in lib/ronin/support/encoding/xml/core_ext/string.rb and 1 other location - About 35 mins to fix
        lib/ronin/support/encoding/html/core_ext/string.rb on lines 21..128

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

        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

        class String
        
          #
          # HTML escapes the String.
          #
        Severity: Minor
        Found in lib/ronin/support/encoding/html/core_ext/string.rb and 1 other location - About 35 mins to fix
        lib/ronin/support/encoding/xml/core_ext/string.rb on lines 21..122

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

        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 self.aes128_encrypt(path, block_size: 16384, output: nil, **kwargs,&block)
            cipher = Ronin::Support::Crypto.aes128_cipher(direction: :encrypt, **kwargs)
            file   = File.open(path,'rb')
        
            return cipher.stream(file, block_size: block_size, output: output,&block)
        Severity: Major
        Found in lib/ronin/support/crypto/core_ext/file.rb and 5 other locations - About 30 mins to fix
        lib/ronin/support/crypto/core_ext/file.rb on lines 355..359
        lib/ronin/support/crypto/core_ext/file.rb on lines 411..415
        lib/ronin/support/crypto/core_ext/file.rb on lines 517..521
        lib/ronin/support/crypto/core_ext/file.rb on lines 570..574
        lib/ronin/support/crypto/core_ext/file.rb on lines 623..627

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

        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

        Severity
        Category
        Status
        Source
        Language