Class: OwaspZap::Spider
- Inherits:
-
Object
- Object
- OwaspZap::Spider
- Defined in:
- lib/owasp_zap/spider.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Spider
constructor
A new instance of Spider.
- #running? ⇒ Boolean
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Spider
Returns a new instance of Spider.
4 5 6 7 8 9 |
# File 'lib/owasp_zap/spider.rb', line 4 def initialize(params = {}) #TODO #handle it @base = params[:base] @target = params[:target] end |
Instance Method Details
#running? ⇒ Boolean
31 32 33 |
# File 'lib/owasp_zap/spider.rb', line 31 def running? self.status != 100 end |
#start ⇒ Object
11 12 13 14 15 16 |
# File 'lib/owasp_zap/spider.rb', line 11 def start #http://localhost:8080/JSON/spider/action/scan/?zapapiformat=JSON&url= url = Addressable::URI.parse "#{@base}/JSON/spider/action/scan/" url.query_values = {:zapapiformat=>"JSON",:url=>@target} RestClient::get url.normalize.to_str end |
#status ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/owasp_zap/spider.rb', line 22 def status ret = JSON.parse(RestClient::get("#{@base}/JSON/spider/view/status/?zapapiformat=JSON")) if ret.has_key? "status" ret["status"].to_i else 100 # it means no running end end |
#stop ⇒ Object
18 19 20 |
# File 'lib/owasp_zap/spider.rb', line 18 def stop RestClient::get "#{@base}/JSON/spider/action/stop/?zapapiformat=JSON" end |