Module: Kernel
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 Instance Method Summary
| #attempt(&block) |
Calls the given block and ignores any raised exceptions. Returns: nil |
|---|---|
| #catch_all(verbose = true, &block) |
Attempts to run the given block and catches any SyntaxError,. Returns: nil |
| #hexdump(object, output = STDOUT) |
Hexdumps an object. |
| #require_within(directory, sub_path) |
Safely requires the specified sub_path from within the specified. Returns: Boolean |
| #ronin_extension(&block) |
Creates a new Ronin::Platform::Extension object using the given. |
Public Instance Method Details
attempt
Calls the given block and ignores any raised exceptions.
36 37 38 39 40 41 42 |
# File 'lib/ronin/extensions/kernel.rb', line 36 def attempt(&block) begin block.call() if block rescue Exception return nil end end |
catch_all
Attempts to run the given block and catches any SyntaxError, RuntimeError or StandardError exceptions.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ronin/extensions/kernel.rb', line 63 def catch_all(verbose=true,&block) begin block.call() if block rescue Exception => e if verbose STDERR.puts "#{e.class}: #{e}" e.backtrace[0,5].each { |trace| STDERR.puts "\t#{trace}" } end return nil end end |
hexdump
Hexdumps an object.
29 30 31 |
# File 'lib/ronin/ui/hexdump/extensions/kernel.rb', line 29 def hexdump(object,output=STDOUT) Ronin::UI::Hexdump.dump(object,output) end |
require_within
Safely requires the specified sub_path from within the specified directory.
93 94 95 96 |
# File 'lib/ronin/extensions/kernel.rb', line 93 def require_within(directory,sub_path) path = File.(File.join('',sub_path)) require File.join(directory,path) end |
ronin_extension
Creates a new Ronin::Platform::Extension object using the given block.
ronin_extension do ... end
46 |
# File 'lib/ronin/platform/extension.rb', line 46 contextify :ronin_extension |