Class: Ronin::Recon::CLI::WorkerCommand Private
- Defined in:
- lib/ronin/recon/cli/worker_command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for commands which load an individual worker.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#worker_class ⇒ Class<Worker>?
readonly
private
The loaded worker class.
Instance Method Summary collapse
-
#load_worker(id) ⇒ Object
private
Loads the recon worker class and sets #worker_class.
-
#load_worker_from(file) ⇒ Object
private
Loads the recon worker class from the given file and sets #worker_class.
-
#run(name = nil) ⇒ Class<Worker>
private
Loads the recon worker class.
Instance Attribute Details
#worker_class ⇒ Class<Worker>? (readonly)
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.
The loaded worker class.
47 48 49 |
# File 'lib/ronin/recon/cli/worker_command.rb', line 47 def worker_class @worker_class end |
Instance Method Details
#load_worker(id) ⇒ 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.
Loads the recon worker class and sets #worker_class.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ronin/recon/cli/worker_command.rb', line 73 def load_worker(id) @worker_class = Recon.load_class(id) rescue Recon::ClassNotFound => error print_error(error.) exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while loading recon worker #{id}") exit(-1) end |
#load_worker_from(file) ⇒ 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.
Loads the recon worker class from the given file and sets #worker_class.
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ronin/recon/cli/worker_command.rb', line 91 def load_worker_from(file) @worker_class = Recon.load_class_from_file(file) rescue Recon::ClassNotFound => error print_error(error.) exit(1) rescue => error print_exception(error) print_error("an unhandled exception occurred while loading recon worker from file #{file}") exit(-1) end |
#run(name = nil) ⇒ Class<Worker>
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 recon worker class.
58 59 60 61 62 63 64 65 |
# File 'lib/ronin/recon/cli/worker_command.rb', line 58 def run(name=nil) if name then load_worker(name) elsif [:file] then load_worker_from([:file]) else print_error("must specify --file or a NAME") exit(-1) end end |