ronin-rb/ronin-vulns

View on GitHub

Showing 30 of 30 total issues

File web_vuln.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'ronin/vulns/vuln'
require 'ronin/vulns/web_vuln/http_request'
require 'ronin/support/network/http'

require 'chars'
Severity: Minor
Found in lib/ronin/vulns/web_vuln.rb - About 2 hrs to fix

    Method scan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.scan(url, query_params:  nil,
                             header_names:  nil,
                             cookie_params: nil,
                             form_params:   nil,
                             http:          nil,
    Severity: Minor
    Found in lib/ronin/vulns/web_vuln.rb - About 2 hrs 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 scan has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.scan(url, query_params:  nil,
                             header_names:  nil,
                             cookie_params: nil,
                             form_params:   nil,
                             http:          nil,
    Severity: Minor
    Found in lib/ronin/vulns/web_vuln.rb - About 1 hr to fix

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

            def original_value
              if @query_param
                @url.query_params[@query_param]
              elsif @header_name
                @headers[@header_name] if @headers
      Severity: Minor
      Found in lib/ronin/vulns/web_vuln.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 vulnerable? has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def vulnerable?
              response = exploit(@test_url)
      
              case response.code
              when '301', '302', '303', '307', '308'
      Severity: Minor
      Found in lib/ronin/vulns/open_redirect.rb - About 1 hr to fix

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

              def self.scan_headers(url,header_names, http: nil, **kwargs)
                url    = URI(url)
                http ||= Support::Network::HTTP.connect_uri(url)
        
                vulns = []
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.rb and 1 other location - About 55 mins to fix
        lib/ronin/vulns/web_vuln.rb on lines 339..354

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

        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.scan_form_params(url,form_params, http: nil, **kwargs)
                url    = URI(url)
                http ||= Support::Network::HTTP.connect_uri(url)
        
                vulns = []
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.rb and 1 other location - About 55 mins to fix
        lib/ronin/vulns/web_vuln.rb on lines 248..263

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

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

              def escape(sql)
                sqli = if sql.start_with?(';')
                         "#{@escape_string}#{sql}"
                       else
                         "#{@escape_string} #{sql}"
        Severity: Minor
        Found in lib/ronin/vulns/sqli.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 to_http has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def to_http
                  request = []
                  request << "#{@request_method.upcase} #{@url.request_uri} HTTP/1.1"
        
                  if (@form_data && !@form_data.empty?)
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln/http_request.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def run(*urls)
                  unless (options[:input] || !urls.empty?)
                    print_error "must specify URL(s) or --input"
                    exit(-1)
                  end
        Severity: Minor
        Found in lib/ronin/vulns/cli/web_vuln_command.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 scan_cookie_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.scan_cookie_params(url,cookie_params=nil, http: nil, **kwargs)
                url    = URI(url)
                http ||= Support::Network::HTTP.connect_uri(url)
        
                unless cookie_params
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.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 identify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.identify(body,index)
                  prefix = body[0,index]
        
                  if    (match = prefix.match(IN_TAG_BODY))
                    new(:tag_body, tag: match[1])
        Severity: Minor
        Found in lib/ronin/vulns/reflected_xss/context.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 to_curl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def to_curl
                  escape = ->(str) { "'#{str.to_s.tr("'","\\'")}'" }
        
                  command = ['curl']
        
        
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln/http_request.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_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def process_url(url)
                  unless url.start_with?('http://') || url.start_with?('https://')
                    print_error("URL must start with http:// or https://: #{url.inspect}")
                    exit(-1)
                  end
        Severity: Minor
        Found in lib/ronin/vulns/cli/web_vuln_command.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 scan_query_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.scan_query_params(url,query_params=nil, http: nil, **kwargs)
                url    = URI(url)
                http ||= Support::Network::HTTP.connect_uri(url)
        
                query_params ||= url.query_params.keys
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.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 to_curl(payload='PAYLOAD')
                payload = encode_payload(payload)
        
                HTTPRequest.new(
                  @url, request_method: @request_method,
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.rb and 1 other location - About 30 mins to fix
        lib/ronin/vulns/web_vuln.rb on lines 757..769

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

        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 to_http(payload='PAYLOAD')
                payload = encode_payload(payload)
        
                HTTPRequest.new(
                  @url, request_method: @request_method,
        Severity: Minor
        Found in lib/ronin/vulns/web_vuln.rb and 1 other location - About 30 mins to fix
        lib/ronin/vulns/web_vuln.rb on lines 734..746

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

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

              def self.scan(url, lfi:  {},
                                 rfi:  {},
                                 sqli: {},
                                 ssti: {},
                                 reflected_xss: {},
        Severity: Minor
        Found in lib/ronin/vulns/url_scanner.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

                option :form_param, short: '-F',
                                    value: {
                                      type: /[^\s=]+=\w+/,
                                      usage: 'NAME=VALUE'
                                    },
        Severity: Minor
        Found in lib/ronin/vulns/cli/web_vuln_command.rb and 1 other location - About 25 mins to fix
        lib/ronin/vulns/cli/web_vuln_command.rb on lines 70..78

        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

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

              def test_sleep
                SLEEP_TESTS.each do |sql|
                  [sql, ";SELECT #{sql}"].each do |sqli|
                    start_time = Time.now
                    response   = exploit(sqli)
        Severity: Minor
        Found in lib/ronin/vulns/sqli.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