zaproxy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -0
  3. data/lib/zap/result.rb +13 -0
  4. data/lib/{zap.rb → zap/zap.rb} +25 -4
  5. data/lib/zaproxy.rb +3 -0
  6. data/zaproxy.gemspec +1 -1
  7. metadata +52 -50
  8. /data/lib/{v2apis → zap/v2apis}/_template.rb +0 -0
  9. /data/lib/{v2apis → zap/v2apis}/access_control.rb +0 -0
  10. /data/lib/{v2apis → zap/v2apis}/acsrf.rb +0 -0
  11. /data/lib/{v2apis → zap/v2apis}/ajax_spider.rb +0 -0
  12. /data/lib/{v2apis → zap/v2apis}/alert.rb +0 -0
  13. /data/lib/{v2apis → zap/v2apis}/alert_filter.rb +0 -0
  14. /data/lib/{v2apis → zap/v2apis}/ascan.rb +0 -0
  15. /data/lib/{v2apis → zap/v2apis}/authentication.rb +0 -0
  16. /data/lib/{v2apis → zap/v2apis}/authorization.rb +0 -0
  17. /data/lib/{v2apis → zap/v2apis}/automation.rb +0 -0
  18. /data/lib/{v2apis → zap/v2apis}/autoupdate.rb +0 -0
  19. /data/lib/{v2apis → zap/v2apis}/break.rb +0 -0
  20. /data/lib/{v2apis → zap/v2apis}/client.rb +0 -0
  21. /data/lib/{v2apis → zap/v2apis}/context.rb +0 -0
  22. /data/lib/{v2apis → zap/v2apis}/core.rb +0 -0
  23. /data/lib/{v2apis → zap/v2apis}/exim.rb +0 -0
  24. /data/lib/{v2apis → zap/v2apis}/forced_user.rb +0 -0
  25. /data/lib/{v2apis → zap/v2apis}/graphql.rb +0 -0
  26. /data/lib/{v2apis → zap/v2apis}/http_sessions.rb +0 -0
  27. /data/lib/{v2apis → zap/v2apis}/hud.rb +0 -0
  28. /data/lib/{v2apis → zap/v2apis}/import_urls.rb +0 -0
  29. /data/lib/{v2apis → zap/v2apis}/keyboard.rb +0 -0
  30. /data/lib/{v2apis → zap/v2apis}/local_proxies.rb +0 -0
  31. /data/lib/{v2apis → zap/v2apis}/network.rb +0 -0
  32. /data/lib/{v2apis → zap/v2apis}/openapi.rb +0 -0
  33. /data/lib/{v2apis → zap/v2apis}/params.rb +0 -0
  34. /data/lib/{v2apis → zap/v2apis}/pnh.rb +0 -0
  35. /data/lib/{v2apis → zap/v2apis}/postman.rb +0 -0
  36. /data/lib/{v2apis → zap/v2apis}/pscan.rb +0 -0
  37. /data/lib/{v2apis → zap/v2apis}/quickstartlaunch.rb +0 -0
  38. /data/lib/{v2apis → zap/v2apis}/replacer.rb +0 -0
  39. /data/lib/{v2apis → zap/v2apis}/reports.rb +0 -0
  40. /data/lib/{v2apis → zap/v2apis}/retest.rb +0 -0
  41. /data/lib/{v2apis → zap/v2apis}/reveal.rb +0 -0
  42. /data/lib/{v2apis → zap/v2apis}/revisit.rb +0 -0
  43. /data/lib/{v2apis → zap/v2apis}/rule_config.rb +0 -0
  44. /data/lib/{v2apis → zap/v2apis}/script.rb +0 -0
  45. /data/lib/{v2apis → zap/v2apis}/search.rb +0 -0
  46. /data/lib/{v2apis → zap/v2apis}/selenium.rb +0 -0
  47. /data/lib/{v2apis → zap/v2apis}/session_management.rb +0 -0
  48. /data/lib/{v2apis → zap/v2apis}/soap.rb +0 -0
  49. /data/lib/{v2apis → zap/v2apis}/spider.rb +0 -0
  50. /data/lib/{v2apis → zap/v2apis}/stats.rb +0 -0
  51. /data/lib/{v2apis → zap/v2apis}/users.rb +0 -0
  52. /data/lib/{v2apis → zap/v2apis}/wappalyzer.rb +0 -0
  53. /data/lib/{v2apis → zap/v2apis}/websocket.rb +0 -0
  54. /data/lib/{zapv2.rb → zap/zapv2.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3095ddde4abca34f1e4e4f178fb336d6945becc2e9d88cc15230209e4670b302
4
- data.tar.gz: 3ca82263c062f3d0aa00cf9c170d8d3243b0e15064dde7ac8e7e88ddb44e9d43
3
+ metadata.gz: 7a7b42822cb0a62967e19adca8d3e95b48130326eb83e341800c2444f10584a1
4
+ data.tar.gz: 304679bf6e8f56dcb4a4970183a94e9e1bd734bfeb610ae68ea87a6fd092a162
5
5
  SHA512:
6
- metadata.gz: c68be8db5eec6a43f6a12d8ad06d0a643f6aeebecbba728110d8d713b095821b1171430ebf3116961b98a245da5d2f71afd7977fea983d839edfe15ce964164f
7
- data.tar.gz: fb31a558e8757deb5e0dd0c22548ac61d7c4dfe148cb481ac61b8b8e3fd548fb4f3b115965f39979fce8d918c9727d8e071130cf6310fc5466994d2e332b1258
6
+ metadata.gz: 307ffb225136f156106af51203e4ed3ba8614e43da79a391687f8fbc36ba9d46386aed2ffd585e0dc8f4cb9186fdd2405b495b753eea8f5f0c88c4783f5c17e3
7
+ data.tar.gz: b6e0c7694e9f50d7117bbb334a8e8362c445be1dd8b951f4a661fddc5ba08d8152a9ee419a2f6b98d411afa078a9ee9aa998d8a7e7d9289fdbe5c622cafc794d
data/README.md CHANGED
@@ -3,3 +3,36 @@
3
3
  # zaproxy-ruby
4
4
 
5
5
  A Ruby Implementation and Library for Easy Utilization of [ZAP API](https://www.zaproxy.org/docs/api/#introduction).
6
+
7
+ ```ruby
8
+ require 'zapv2'
9
+
10
+
11
+ ```
12
+
13
+ ## Getting started
14
+ The `zaproxy` gem provides Ruby bindings to the ZAP(Zed Attack Proxy) tool, allowing you to automate security testing and scanning of web applications. You can install the gem using either `gem` or `bundler`.
15
+
16
+ ### Gem
17
+ ```bash
18
+ gem install zaproxy
19
+ ```
20
+
21
+ ### Bundler
22
+ If you are managing dependencies with Bundler, you can add the zaproxy gem to your project's Gemfile and then use Bundler to install it.
23
+
24
+ Create a Gemfile in your project directory. and Open the Gemfile and add the following line to specify the zaproxy gem
25
+
26
+ ```ruby
27
+ # Gemfile
28
+ gem 'zaproxy'
29
+ ```
30
+
31
+ In your terminal, navigate to your project directory and run the following command to install the gem and its dependencies using Bundler
32
+
33
+ ```bash
34
+ bundle install
35
+ ```
36
+
37
+ ## Documents
38
+ - [RubyDocs](https://rubydoc.info/gems/zaproxy)
data/lib/zap/result.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ class Result
6
+ attr_accessor :success, :message, :object
7
+
8
+ def initialize(success, message)
9
+ @success = success
10
+ @message = message
11
+ @object = JSON.parse(message) if message.is_a?(String)
12
+ end
13
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'net/http'
4
+ require_relative 'result'
4
5
 
5
6
  class ZAP
6
7
  API_KEY_DEFAULT = ''
@@ -21,24 +22,44 @@ class ZAP
21
22
 
22
23
  def get(path)
23
24
  request = build_request(Net::HTTP::Get, path)
24
- send_request(request)
25
+ response = send_request(request)
26
+ if response.code == '200'
27
+ Result.new(true, response.body)
28
+ else
29
+ Result.new(false, response.body)
30
+ end
25
31
  end
26
32
 
27
33
  def post(path, data)
28
34
  request = build_request(Net::HTTP::Post, path)
29
35
  request.set_form_data(data)
30
- send_request(request)
36
+ response = send_request(request)
37
+ if response.code == '200'
38
+ Result.new(true, response.body)
39
+ else
40
+ Result.new(false, response.body)
41
+ end
31
42
  end
32
43
 
33
44
  def delete(path)
34
45
  request = build_request(Net::HTTP::Delete, path)
35
- send_request(request)
46
+ response = send_request(request)
47
+ if response.code == '200'
48
+ Result.new(true, response.body)
49
+ else
50
+ Result.new(false, response.body)
51
+ end
36
52
  end
37
53
 
38
54
  def put(path, data)
39
55
  request = build_request(Net::HTTP::Put, path)
40
56
  request.set_form_data(data)
41
- send_request(request)
57
+ response = send_request(request)
58
+ if response.code == '200'
59
+ Result.new(true, response.body)
60
+ else
61
+ Result.new(false, response.body)
62
+ end
42
63
  end
43
64
 
44
65
  private
data/lib/zaproxy.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'zap/zapv2'
data/zaproxy.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'zaproxy'
5
- spec.version = '0.0.2'
5
+ spec.version = '0.0.3'
6
6
  spec.authors = ['hahwul']
7
7
  spec.email = ['hahwul@gmail.com']
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hahwul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby Implementation and Library for Easy Utilization of ZAP API
14
14
  email:
@@ -22,54 +22,56 @@ files:
22
22
  - README.md
23
23
  - Rakefile
24
24
  - SECURITY.md
25
- - lib/v2apis/_template.rb
26
- - lib/v2apis/access_control.rb
27
- - lib/v2apis/acsrf.rb
28
- - lib/v2apis/ajax_spider.rb
29
- - lib/v2apis/alert.rb
30
- - lib/v2apis/alert_filter.rb
31
- - lib/v2apis/ascan.rb
32
- - lib/v2apis/authentication.rb
33
- - lib/v2apis/authorization.rb
34
- - lib/v2apis/automation.rb
35
- - lib/v2apis/autoupdate.rb
36
- - lib/v2apis/break.rb
37
- - lib/v2apis/client.rb
38
- - lib/v2apis/context.rb
39
- - lib/v2apis/core.rb
40
- - lib/v2apis/exim.rb
41
- - lib/v2apis/forced_user.rb
42
- - lib/v2apis/graphql.rb
43
- - lib/v2apis/http_sessions.rb
44
- - lib/v2apis/hud.rb
45
- - lib/v2apis/import_urls.rb
46
- - lib/v2apis/keyboard.rb
47
- - lib/v2apis/local_proxies.rb
48
- - lib/v2apis/network.rb
49
- - lib/v2apis/openapi.rb
50
- - lib/v2apis/params.rb
51
- - lib/v2apis/pnh.rb
52
- - lib/v2apis/postman.rb
53
- - lib/v2apis/pscan.rb
54
- - lib/v2apis/quickstartlaunch.rb
55
- - lib/v2apis/replacer.rb
56
- - lib/v2apis/reports.rb
57
- - lib/v2apis/retest.rb
58
- - lib/v2apis/reveal.rb
59
- - lib/v2apis/revisit.rb
60
- - lib/v2apis/rule_config.rb
61
- - lib/v2apis/script.rb
62
- - lib/v2apis/search.rb
63
- - lib/v2apis/selenium.rb
64
- - lib/v2apis/session_management.rb
65
- - lib/v2apis/soap.rb
66
- - lib/v2apis/spider.rb
67
- - lib/v2apis/stats.rb
68
- - lib/v2apis/users.rb
69
- - lib/v2apis/wappalyzer.rb
70
- - lib/v2apis/websocket.rb
71
- - lib/zap.rb
72
- - lib/zapv2.rb
25
+ - lib/zap/result.rb
26
+ - lib/zap/v2apis/_template.rb
27
+ - lib/zap/v2apis/access_control.rb
28
+ - lib/zap/v2apis/acsrf.rb
29
+ - lib/zap/v2apis/ajax_spider.rb
30
+ - lib/zap/v2apis/alert.rb
31
+ - lib/zap/v2apis/alert_filter.rb
32
+ - lib/zap/v2apis/ascan.rb
33
+ - lib/zap/v2apis/authentication.rb
34
+ - lib/zap/v2apis/authorization.rb
35
+ - lib/zap/v2apis/automation.rb
36
+ - lib/zap/v2apis/autoupdate.rb
37
+ - lib/zap/v2apis/break.rb
38
+ - lib/zap/v2apis/client.rb
39
+ - lib/zap/v2apis/context.rb
40
+ - lib/zap/v2apis/core.rb
41
+ - lib/zap/v2apis/exim.rb
42
+ - lib/zap/v2apis/forced_user.rb
43
+ - lib/zap/v2apis/graphql.rb
44
+ - lib/zap/v2apis/http_sessions.rb
45
+ - lib/zap/v2apis/hud.rb
46
+ - lib/zap/v2apis/import_urls.rb
47
+ - lib/zap/v2apis/keyboard.rb
48
+ - lib/zap/v2apis/local_proxies.rb
49
+ - lib/zap/v2apis/network.rb
50
+ - lib/zap/v2apis/openapi.rb
51
+ - lib/zap/v2apis/params.rb
52
+ - lib/zap/v2apis/pnh.rb
53
+ - lib/zap/v2apis/postman.rb
54
+ - lib/zap/v2apis/pscan.rb
55
+ - lib/zap/v2apis/quickstartlaunch.rb
56
+ - lib/zap/v2apis/replacer.rb
57
+ - lib/zap/v2apis/reports.rb
58
+ - lib/zap/v2apis/retest.rb
59
+ - lib/zap/v2apis/reveal.rb
60
+ - lib/zap/v2apis/revisit.rb
61
+ - lib/zap/v2apis/rule_config.rb
62
+ - lib/zap/v2apis/script.rb
63
+ - lib/zap/v2apis/search.rb
64
+ - lib/zap/v2apis/selenium.rb
65
+ - lib/zap/v2apis/session_management.rb
66
+ - lib/zap/v2apis/soap.rb
67
+ - lib/zap/v2apis/spider.rb
68
+ - lib/zap/v2apis/stats.rb
69
+ - lib/zap/v2apis/users.rb
70
+ - lib/zap/v2apis/wappalyzer.rb
71
+ - lib/zap/v2apis/websocket.rb
72
+ - lib/zap/zap.rb
73
+ - lib/zap/zapv2.rb
74
+ - lib/zaproxy.rb
73
75
  - openapi.yaml
74
76
  - zaproxy.gemspec
75
77
  homepage: https://github.com/hahwul/zaproxy-ruby
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes