Class: Ronin::Vulns::LFI::TestFile Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/vulns/lfi/test_file.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 single Local File Inclusion (LFI) test for a given file path and a regexp that matches the file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, regexp) ⇒ TestFile

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 Local File Inclusion (LFI) test.

Parameters:

  • path (String)

    The path to attempt including.

  • regexp (Regexp)

    The regexp to identify a successful Local File Inclusion (LFI) of the #path.



55
56
57
58
# File 'lib/ronin/vulns/lfi/test_file.rb', line 55

def initialize(path,regexp)
  @path   = path
  @regexp = regexp
end

Instance Attribute Details

#pathString (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 path of the file to attempt including.

Returns:

  • (String)


37
38
39
# File 'lib/ronin/vulns/lfi/test_file.rb', line 37

def path
  @path
end

#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 regexp to identify a successful Local File Inclusion (LFI) of the #path.

Returns:

  • (Regexp)


43
44
45
# File 'lib/ronin/vulns/lfi/test_file.rb', line 43

def regexp
  @regexp
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.



84
85
86
# File 'lib/ronin/vulns/lfi/test_file.rb', line 84

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 file was successfully included into the response body.

Parameters:

  • response_body (String)

    The HTTP response body.

Returns:

  • (MatchData, nil)

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



70
71
72
# File 'lib/ronin/vulns/lfi/test_file.rb', line 70

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