Class: File

Ronin - A Ruby platform for exploit development and security research.

Copyright © 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Public Visibility

Public Class Method Summary

hexdump(path, output = STDOUT)

Hexdumps the contents of the File.

unhexdump(path, options = {})

Converts the hexdump at the specified path back into the original.

write(path, data)

Writes the specified data to the specified path.

Returns: nil

Public Class Method Details

hexdump

public hexdump(path, output = STDOUT)

Hexdumps the contents of the File.

Meta Tags

Parameters:

[String] path

The path to the File to hexdump.

[IO] output

The output stream to print the hexdump to.

[View source]


34
35
36
37
38
# File 'lib/ronin/ui/hexdump/extensions/file.rb', line 34

def self.hexdump(path,output=STDOUT)
  self.open(path) do |file|
    Ronin::UI::Hexdump.dump(file,output)
  end
end

unhexdump

public unhexdump(path, options = {})

Converts the hexdump at the specified path back into the original raw-data.

Meta Tags

See Also:

String#unhexdump.
[View source]


31
32
33
# File 'lib/ronin/formatting/extensions/binary/file.rb', line 31

def File.unhexdump(path,options={})
  File.read(path).unhexdump(options)
end

write

public nil write(path, data)

Writes the specified data to the specified path.

Meta Tags

Parameters:

[String] path

The path of the file to write to.

[String] data

The data to write to the file.

Returns:

[nil]
[View source]


34
35
36
# File 'lib/ronin/extensions/file.rb', line 34

def File.write(path,data)
  File.open(path,'w') { |file| file.write(data) }
end
Generated on Friday, September 25 2009 at 02:57:37 PM by YARD 0.2.3.5 (ruby-1.8.6).