Sha256: d172bb9aabb4e9fc1efe8c9d2cfe289c520763a80493c577cf25844023c22089

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

module OwaspZap
    class Attack
        def initialize(params = {})
            # TODO
            # handle it
            @base = params[:base]
            @target = params[:target]
        end

        def start
            url = Addressable::URI.parse("#{@base}/JSON/ascan/action/scan/")
            url.query_values = {:zapapiformat=>"JSON",:url=>@target}
            RestClient::get url.normalize.to_str
        end

        def status
            ret = JSON.parse(RestClient::get("#{@base}/JSON/ascan/view/status/?zapapiformat=JSON"))
            if ret.has_key? "status"
                ret["status"].to_i
            else
                100 # it means no running
            end
        end

        def running?
            self.status != 100
        end

    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
owasp_zap-0.1.0 lib/owasp_zap/attack.rb
owasp_zap-0.0.95 lib/owasp_zap/attack.rb
owasp_zap-0.0.94 lib/owasp_zap/attack.rb
owasp_zap-0.0.93 lib/owasp_zap/attack.rb
owasp_zap-0.0.92 lib/owasp_zap/attack.rb
owasp_zap-0.0.91 lib/owasp_zap/attack.rb