owasp_zap 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6415cfc68c22461c5b18b2b7315511d7e64d9aa0
4
- data.tar.gz: e0bbc86650835dae095481fa7576f79afa687063
3
+ metadata.gz: 12b7b8a9a5e467df211b540b1e37397c2010a3cc
4
+ data.tar.gz: 59631214ffc42c20e952f1bc4e0fdf0aa0dda8ca
5
5
  SHA512:
6
- metadata.gz: ff5f826fc805e9997b91b4283e2807fb5616d99f0ac538fdf2cb028b31b583023ae50ad482a255be2686df2473bea3cd5e31ec4b66babd69815f0063cd356bb3
7
- data.tar.gz: 6f7a3e5418e33f26e99aa2ec36dcb4c4275d5be00d8b7bbb0a572afd702190af724a6769660a5971710f60df37d60876a7af639a03a92b3553e2c81d3678f517
6
+ metadata.gz: bdd1bcfd595e647f0c78edd838052be844fe10b29f4b4f01d00f4e042f4ff814f87378282bce761b9841fe983b1a2147279d9bf089257722bd0ffb5fae762660
7
+ data.tar.gz: a1c5bee92a9674f37c2867127fb64aaa37d4d5266ced72e3dea4400bc9444d548f1540915dca9ffeb9da42b0e43abdf650a0ab527aaec005247b336685deeebc
@@ -8,10 +8,11 @@ module OwaspZap
8
8
 
9
9
  #
10
10
  # the API has an option to give an offset (start) and the amount of alerts (count) as parameter
11
- def view
11
+ def view(format = "JSON")
12
+ raise OwaspZap::WrongFormatException,"Output format not accepted" unless ["JSON","HTML","XML"].include?(format)
12
13
  #http://localhost:8080/JSON/core/view/alerts/?zapapiformat=JSON&baseurl=http%3A%2F%2F192.168.1.113&start=&count=
13
14
  url = Addressable::URI.parse "#{@base}/core/view/alerts/"
14
- url.query_values = {:zapapiformat=>"JSON",:baseurl=>@target}
15
+ url.query_values = {:zapapiformat=>format,:baseurl=>@target}
15
16
  RestClient::get url.normalize.to_str
16
17
  end
17
18
  end
@@ -0,0 +1,4 @@
1
+ module OwaspZap
2
+ class ZapException < ::Exception;end
3
+ class WrongFormatException < ::StandardError;end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module OwaspZap
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/owasp_zap.rb CHANGED
@@ -4,6 +4,7 @@ require "addressable/uri"
4
4
  require "cgi"
5
5
 
6
6
  require_relative "owasp_zap/version"
7
+ require_relative "owasp_zap/error"
7
8
  require_relative "owasp_zap/string_extension"
8
9
  require_relative "owasp_zap/spider"
9
10
  require_relative "owasp_zap/attack"
@@ -0,0 +1,23 @@
1
+ require 'helper'
2
+
3
+ describe OwaspZap::Alert do
4
+ before do
5
+ @alert = OwaspZap::Alert.new
6
+ end
7
+ it "should not be_nil" do
8
+ refute @alert.nil?
9
+ end
10
+ it "should respond_to view" do
11
+ assert_respond_to @alert, :view
12
+ end
13
+
14
+ it "should try WrongFormatException" do
15
+ assert_raises(OwaspZap::WrongFormatException) { @alert.view("FOO") }
16
+ end
17
+
18
+ it "view accept HTML, JSON and XML as param" do
19
+ ["JSON","HTML","XML"].each do |f|
20
+ assert_raises(WebMock::NetConnectNotAllowedError) { @alert.view(format=f) }
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: owasp_zap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pereira
@@ -125,10 +125,12 @@ files:
125
125
  - lib/owasp_zap/alert.rb
126
126
  - lib/owasp_zap/attack.rb
127
127
  - lib/owasp_zap/auth.rb
128
+ - lib/owasp_zap/error.rb
128
129
  - lib/owasp_zap/spider.rb
129
130
  - lib/owasp_zap/string_extension.rb
130
131
  - lib/owasp_zap/version.rb
131
132
  - owasp_zap.gemspec
133
+ - spec/alert_spec.rb
132
134
  - spec/auth_spec.rb
133
135
  - spec/helper.rb
134
136
  - spec/zap_spec.rb
@@ -157,6 +159,7 @@ signing_key:
157
159
  specification_version: 4
158
160
  summary: ruby wrapper for the zed application proxy
159
161
  test_files:
162
+ - spec/alert_spec.rb
160
163
  - spec/auth_spec.rb
161
164
  - spec/helper.rb
162
165
  - spec/zap_spec.rb