Module: Ronin::Exploits::CLI::ExploitMethods Private
- Included in:
- ExploitCommand
- Defined in:
- lib/ronin/exploits/cli/exploit_methods.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Mixin which adds methods for loading and running exploit classes.
Instance Method Summary collapse
-
#initialize_exploit(exploit_class, **kwargs) ⇒ Exploit
private
Initializes the exploit class.
-
#load_exploit(name) ⇒ Class<Exploit>
private
Loads a exploit class.
-
#load_exploit_from(file) ⇒ Class<Exploit>
private
Loads the exploit from a given file.
-
#validate_exploit(exploit) ⇒ Object
private
Validates the loaded exploit.
Instance Method Details
#initialize_exploit(exploit_class, **kwargs) ⇒ Exploit
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 exploit class.
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ronin/exploits/cli/exploit_methods.rb', line 85 def initialize_exploit(exploit_class,**kwargs) exploit_class.new(**kwargs) rescue Core::Params::ParamError => error print_error(error.) exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while initializing exploit #{exploit_class.id}") exit(-1) end |
#load_exploit(name) ⇒ Class<Exploit>
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.
Loads a exploit class.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ronin/exploits/cli/exploit_methods.rb', line 42 def load_exploit(name) Exploits.load_class(name) rescue Exploits::ClassNotFound => error print_error(error.) exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while loading exploit #{name}") exit(-1) end |
#load_exploit_from(file) ⇒ Class<Exploit>
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.
Loads the exploit from a given file.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ronin/exploits/cli/exploit_methods.rb', line 62 def load_exploit_from(file) Exploits.load_class_from_file(file) rescue Exploits::ClassNotFound => error print_error(error.) exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while loading exploit from file #{file}") exit(-1) end |
#validate_exploit(exploit) ⇒ Object
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.
Validates the loaded exploit.
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/ronin/exploits/cli/exploit_methods.rb', line 108 def validate_exploit(exploit) exploit.perform_validate rescue Core::Params::ParamError, ValidationError => error print_error("failed to validate the exploit #{exploit.class_id}: #{error.}") exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while validating the exploit #{exploit.class_id}") exit(-1) end |