Class: Ronin::Vulns::SQLI::ErrorPattern Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/vulns/sqli/error_pattern.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents a collection of patterns for SQL error messages for a particular database.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ ErrorPattern

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the error pattern.

Parameters:

  • regexp (Regexp)

    The combined of regular expression.



45
46
47
# File 'lib/ronin/vulns/sqli/error_pattern.rb', line 45

def initialize(regexp)
  @regexp = regexp
end

Instance Attribute Details

#regexpRegexp (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The combined error message regexp.

Returns:

  • (Regexp)


37
38
39
# File 'lib/ronin/vulns/sqli/error_pattern.rb', line 37

def regexp
  @regexp
end

Class Method Details

.[](*regexps) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates an error pattern from multiple different regexps.

Parameters:

  • regexps (Array<Regexp>)

    The collection of regular expressions.



55
56
57
# File 'lib/ronin/vulns/sqli/error_pattern.rb', line 55

def self.[](*regexps)
  new(Regexp.union(regexps))
end

Instance Method Details

#=~(response_body) ⇒ Integer?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Tests whether the file was successfully included into the response body.

Parameters:

  • response_body (String)

    The HTTP response body.

Returns:

  • (Integer, nil)

    Indicates whether the #regexp was found in the response body.



82
83
84
# File 'lib/ronin/vulns/sqli/error_pattern.rb', line 82

def =~(response_body)
  response_body =~ @regexp
end

#match(response_body) ⇒ MatchData?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Tests whether the response body contains a SQL error.

Parameters:

  • response_body (String)

    The HTTP response body.

Returns:

  • (MatchData, nil)

    The match data if the #regexp is found within the response body.



68
69
70
# File 'lib/ronin/vulns/sqli/error_pattern.rb', line 68

def match(response_body)
  @regexp.match(response_body)
end