Created
January 9, 2013 18:50
-
-
Save kernelsmith/4495741 to your computer and use it in GitHub Desktop.
irb/ruby code snippets to find all the active Exceptions or open file handles etc. You may encounter and possibly want to handle these exceptions in code you are writing for msf.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# open file handles | |
ObjectSpace.each_object(File) {|o| puts o.inspect} | |
# finding all the active Exceptions which one might have to catch in metasploit | |
# start msfconsole, proceed to the environment you want to examine, for instance if | |
# you want to see what exceptions are available in a meterp session, then establish | |
# one, interace with it, and then... | |
# run the irb command and enter the following | |
ObjectSpace.each_object(Class) {|o| puts o.inspect if o.ancestors.include?(Exception)} | |
# Example from a psexec created meterpreter session: | |
# meterpreter > irb | |
# [*] Starting IRB shell | |
# [*] The 'client' variable holds the meterpreter client | |
# >> ObjectSpace.each_object(Class) {|o| puts o.inspect if o.ancestors.include?(Exception)} | |
# Rex::ConnectionProxyError | |
# Rex::UnsupportedProtocol | |
# Rex::AddressInUse | |
# Rex::ConnectionTimeout | |
# Rex::HostUnreachable | |
# Rex::ConnectionRefused | |
# Rex::ConnectionError | |
# Rex::StreamClosedError | |
# Rex::AmbiguousArgumentError | |
# Rex::ArgumentParseError | |
# Rex::ArgumentError | |
# Rex::RuntimeError | |
# Rex::NotImplementedError | |
# Rex::TimeoutError | |
# Rex::Text::IllegalSequence | |
# Msf::NoKeyError | |
# Msf::EncodingError | |
# Msf::ValidationError | |
# Msf::OptionValidateError | |
# Msf::NoNopsSucceededError | |
# Msf::NoCompatiblePayloadError | |
# Msf::IncompatiblePayloadError | |
# Msf::MissingActionError | |
# Msf::MissingPayloadError | |
# Msf::MissingTargetError | |
# Msf::BadGenerateError | |
# Msf::NoEncodersSucceededError | |
# Msf::BadcharError | |
# Msf::PluginLoadError | |
# Rex::Post::Meterpreter::RequestError | |
# Rex::Poly::InvalidRegisterError | |
# Example from a base msfconsole session | |
# msf > irb | |
# [*] Starting IRB shell... | |
# >> ObjectSpace.each_object(Class) {|o| puts o.inspect if o.ancestors.include?(Exception)} | |
# Msf::NoKeyError | |
# Msf::EncodingError | |
# Msf::ValidationError | |
# Msf::OptionValidateError | |
# Msf::NoNopsSucceededError | |
# Msf::NoCompatiblePayloadError | |
# Msf::IncompatiblePayloadError | |
# Msf::MissingActionError | |
# Msf::MissingPayloadError | |
# Msf::MissingTargetError | |
# Msf::BadGenerateError | |
# Msf::NoEncodersSucceededError | |
# Msf::BadcharError | |
# Msf::PluginLoadError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here's a possibly better one, haven't tried it yet tho