ronin-rb/ronin-payloads

View on GitHub

Showing 17 of 17 total issues

Class Payload has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Payload

      include Core::Metadata::ID
      include Core::Metadata::Authors
      include Core::Metadata::Summary
Severity: Minor
Found in lib/ronin/payloads/payload.rb - About 2 hrs to fix

    Method print_encoder has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

              def print_encoder(encoder_class)
                puts "[ #{encoder_class.id} ]"
                puts
    
                indent do
    Severity: Minor
    Found in lib/ronin/payloads/cli/commands/encoder.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 print_payload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

              def print_payload(payload)
                puts "[ #{payload.id} ]"
                puts
    
                indent do
    Severity: Minor
    Found in lib/ronin/payloads/cli/commands/show.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 compile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def compile(*source_files, output: nil, target: nil, cfg: nil)
            args = ['rustc']
    
            if output
              args << '-o' << output
    Severity: Minor
    Found in lib/ronin/payloads/rust_payload.rb - About 1 hr to fix

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

                def print_encoder(encoder_class)
                  puts "[ #{encoder_class.id} ]"
                  puts
      
                  indent do
      Severity: Minor
      Found in lib/ronin/payloads/cli/commands/encoder.rb - About 1 hr to fix

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

                def initialize_payload(payload_class,**kwargs)
                  payload_class.new(**kwargs)
                rescue Core::Params::ParamError => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/payload_methods.rb and 1 other location - About 30 mins to fix
        lib/ronin/payloads/cli/encoder_methods.rb on lines 107..116

        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

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

                def initialize_encoder(encoder_class,**kwargs)
                  encoder_class.new(**kwargs)
                rescue Core::Params::ParamError => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/encoder_methods.rb and 1 other location - About 30 mins to fix
        lib/ronin/payloads/cli/payload_methods.rb on lines 85..94

        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

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

                  def load_data(file=nil)
                    if file
                      unless File.file?(file)
                        print_error "No such file or directory: #{file}"
                        exit(-1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/commands/encode.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

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

              def compile(*source_files, output: nil, target: nil, cfg: nil)
                args = ['rustc']
        
                if output
                  args << '-o' << output
        Severity: Minor
        Found in lib/ronin/payloads/rust_payload.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

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

                def load_encoder_from(file)
                  Payloads::Encoders.load_class_from_file(file)
                rescue Payloads::ClassNotFound => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/encoder_methods.rb and 1 other location - About 25 mins to fix
        lib/ronin/payloads/cli/encoder_methods.rb on lines 64..73

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 30.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                def load_encoder(name)
                  Payloads::Encoders.load_class(name)
                rescue Payloads::ClassNotFound => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/encoder_methods.rb and 1 other location - About 25 mins to fix
        lib/ronin/payloads/cli/encoder_methods.rb on lines 84..93

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 30.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                def load_payload(name)
                  Payloads.load_class(name)
                rescue Payloads::ClassNotFound => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/payload_methods.rb and 1 other location - About 25 mins to fix
        lib/ronin/payloads/cli/payload_methods.rb on lines 62..71

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 29.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                def load_payload_from(file)
                  Payloads.load_class_from_file(file)
                rescue Payloads::ClassNotFound => error
                  print_error(error.message)
                  exit(1)
        Severity: Minor
        Found in lib/ronin/payloads/cli/payload_methods.rb and 1 other location - About 25 mins to fix
        lib/ronin/payloads/cli/payload_methods.rb on lines 42..51

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 29.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                def host_ip_addresses
                  host = params[:host]
        
                  # check if the `host` value is already an IP address
                  if host =~ IPAddr::RE_IPV4ADDRLIKE ||
        Severity: Minor
        Found in lib/ronin/payloads/mixins/resolve_host.rb and 1 other location - About 20 mins to fix
        lib/ronin/payloads/mixins/resolve_host.rb on lines 43..53

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

        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 host_addresses
                  host = params[:host]
        
                  # check if the `host` value is already an IP address
                  if host =~ IPAddr::RE_IPV4ADDRLIKE ||
        Severity: Minor
        Found in lib/ronin/payloads/mixins/resolve_host.rb and 1 other location - About 20 mins to fix
        lib/ronin/payloads/mixins/resolve_host.rb on lines 70..80

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

        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

                                   prefix, value = str.split('=',2)
                                   encoder, name = prefix.split('.',2)
        
                                   @params[encoder][name.to_sym] = value
        Severity: Minor
        Found in lib/ronin/payloads/cli/commands/encode.rb and 1 other location - About 15 mins to fix
        lib/ronin/payloads/cli/commands/build.rb on lines 82..85

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

        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

                                           name, value              = str.split('=',2)
                                           encoder_name, param_name = name.split('.',2)
        
                                           @encoder_params[encoder_name][param_name.to_sym] = value
        Severity: Minor
        Found in lib/ronin/payloads/cli/commands/build.rb and 1 other location - About 15 mins to fix
        lib/ronin/payloads/cli/commands/encode.rb on lines 73..76

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

        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