Module: Ronin::Script::Deployable
- Includes:
- Testable, UI::Output::Helpers
- Defined in:
- lib/ronin/script/deployable.rb
Overview
Adds deployment methods to an Ronin::Script.
Instance Method Summary collapse
-
#deploy { ... } ⇒ Script
protected
Registers a given block to be called when the script is being deployed.
-
#deploy! { ... } ⇒ Script
Tests and then deploys the exploit.
-
#deploy_failed!(message) ⇒ Object
protected
Indicates the deployment of the exploit has failed.
-
#deployed? ⇒ Boolean
Determines whether the script was deployed.
-
#evacuate { ... } ⇒ Script
protected
Registers a given block to be called when the script is being evacuated.
-
#evacuate! { ... } ⇒ Script
Evacuates the deployed script.
-
#evacuated? ⇒ Boolean
Determines whether the script was evacuated.
-
#initialize(attributes = {}) ⇒ Object
Initializes the deployable script.
Methods included from Testable
#flunk, #test, #test!, #test?, #test_equal, #test_in, #test_match, #test_no_match, #test_not_equal, #test_not_in, #test_set
Instance Method Details
#deploy { ... } ⇒ Script (protected)
Registers a given block to be called when the script is being deployed.
177 178 179 180 |
# File 'lib/ronin/script/deployable.rb', line 177 def deploy(&block) @deploy_blocks << block return self end |
#deploy! { ... } ⇒ Script
Tests and then deploys the exploit. If a payload has been set, the payload will also be deployed.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ronin/script/deployable.rb', line 86 def deploy! test! print_info "Deploying #{script_type} #{self} ..." @deployed = false @deploy_blocks.each { |block| block.call() } @deployed = true @evacuated = false print_info "#{script_type} #{self} deployed!" yield if block_given? return self end |
#deploy_failed!(message) ⇒ Object (protected)
Indicates the deployment of the exploit has failed.
158 159 160 |
# File 'lib/ronin/script/deployable.rb', line 158 def deploy_failed!() raise(DeployFailed,) end |
#deployed? ⇒ Boolean
Determines whether the script was deployed.
65 66 67 |
# File 'lib/ronin/script/deployable.rb', line 65 def deployed? @deployed == true end |
#evacuate { ... } ⇒ Script (protected)
Registers a given block to be called when the script is being evacuated.
197 198 199 200 |
# File 'lib/ronin/script/deployable.rb', line 197 def evacuate(&block) @evacuate_blocks.unshift(block) return self end |
#evacuate! { ... } ⇒ Script
Evacuates the deployed script.
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/ronin/script/deployable.rb', line 132 def evacuate! yield if block_given? print_info "Evauating #{script_type} #{self} ..." @evacuated = false @evacuate_blocks.each { |block| block.call() } @evacuated = true @deployed = false print_info "#{script_type} #{self} evacuated." return self end |
#evacuated? ⇒ Boolean
Determines whether the script was evacuated.
112 113 114 |
# File 'lib/ronin/script/deployable.rb', line 112 def evacuated? @evacuated == true end |
#initialize(attributes = {}) ⇒ Object
Initializes the deployable script.
45 46 47 48 49 50 51 52 53 |
# File 'lib/ronin/script/deployable.rb', line 45 def initialize(attributes={}) super(attributes) @deploy_blocks = [] @deployed = false @evacuate_blocks = [] @evacuated = false end |