Method: Buby#with_statefile
- Defined in:
- lib/buby.rb
#with_statefile(statefile = nil) {|_self| ... } ⇒ Object
This is a convenience wrapper which loads a given burp statefile and lets its caller perform actions via burp while its loaded on it inside of a block. The old state is restored after the block completes.
It can safely be run with a nil statefile argument in which the current burp session state is used.
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 |
# File 'lib/buby.rb', line 2167 def with_statefile(statefile=nil) if statefile # save current state: old_state=".#{$$}.#{Time.now.to_i}.state.bak" self.alert "Saving current state to temp statefile: #{old_state}" self.save_state(old_state) self.alert "Restoring state: #{statefile}" self.restore_state(statefile) end yield self if statefile # restore original state self.alert "Restoring temp statefile: #{old_state}" self.restore_state old_state self.alert "Deleting temp state file: #{old_state}" File.unlink old_state end end |