Class: Ronin::PHP::LFI::File
- Inherits:
-
StringIO
- Object
- StringIO
- Ronin::PHP::LFI::File
- Defined in:
- lib/ronin/php/lfi/file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Path to the file.
Instance Method Summary collapse
-
#contents ⇒ Object
Returns the contents of the File in String form.
-
#initialize(path, body) ⇒ File
constructor
Creates a new Inclusion with the specified path and response body.
- #inspect ⇒ Object
- #mirror(base) ⇒ Object
-
#save(destination) ⇒ Object
Saves the body to specified destination, returns the destination.
-
#to_s ⇒ Object
See contents.
Constructor Details
#initialize(path, body) ⇒ File
Creates a new Inclusion with the specified path and response body.
36 37 38 39 40 |
# File 'lib/ronin/php/lfi/file.rb', line 36 def initialize(path,body) super(body) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Path to the file
30 31 32 |
# File 'lib/ronin/php/lfi/file.rb', line 30 def path @path end |
Instance Method Details
#contents ⇒ Object
Returns the contents of the File in String form.
45 46 47 |
# File 'lib/ronin/php/lfi/file.rb', line 45 def contents string end |
#inspect ⇒ Object
56 57 58 |
# File 'lib/ronin/php/lfi/file.rb', line 56 def inspect "#<#{self.class}:#{@path}>" end |
#mirror(base) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ronin/php/lfi/file.rb', line 72 def mirror(base) dest = File.join(base,@path) dest_dir = File.dirname(dest) unless File.directory?(dest_dir) FileUtils.mkdir_p(dest_dir) end return save(dest) end |
#save(destination) ⇒ Object
Saves the body to specified destination, returns the destination.
64 65 66 67 68 69 70 |
# File 'lib/ronin/php/lfi/file.rb', line 64 def save(destination) File.open(destination,'w') do |dest| dest.write(string) end return destination end |
#to_s ⇒ Object
See contents.
52 53 54 |
# File 'lib/ronin/php/lfi/file.rb', line 52 def to_s contents end |