zaproxy 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +213 -0
  4. data/README.md +36 -1
  5. data/Rakefile +21 -0
  6. data/SECURITY.md +21 -0
  7. data/lib/zap/result.rb +13 -0
  8. data/lib/zap/v2apis/_template.rb +13 -0
  9. data/lib/zap/v2apis/access_control.rb +25 -0
  10. data/lib/zap/v2apis/acsrf.rb +33 -0
  11. data/lib/zap/v2apis/ajax_spider.rb +153 -0
  12. data/lib/zap/v2apis/alert.rb +61 -0
  13. data/lib/zap/v2apis/alert_filter.rb +57 -0
  14. data/lib/zap/v2apis/ascan.rb +361 -0
  15. data/lib/zap/v2apis/authentication.rb +41 -0
  16. data/lib/zap/v2apis/authorization.rb +17 -0
  17. data/lib/zap/v2apis/automation.rb +21 -0
  18. data/lib/zap/v2apis/autoupdate.rb +133 -0
  19. data/lib/zap/v2apis/break.rb +57 -0
  20. data/lib/zap/v2apis/client.rb +25 -0
  21. data/lib/zap/v2apis/context.rb +93 -0
  22. data/lib/zap/v2apis/core.rb +389 -0
  23. data/lib/zap/v2apis/exim.rb +37 -0
  24. data/lib/zap/v2apis/forced_user.rb +25 -0
  25. data/lib/zap/v2apis/graphql.rb +89 -0
  26. data/lib/zap/v2apis/http_sessions.rb +73 -0
  27. data/lib/zap/v2apis/hud.rb +157 -0
  28. data/lib/zap/v2apis/import_urls.rb +13 -0
  29. data/lib/zap/v2apis/keyboard.rb +17 -0
  30. data/lib/zap/v2apis/local_proxies.rb +21 -0
  31. data/lib/zap/v2apis/network.rb +201 -0
  32. data/lib/zap/v2apis/openapi.rb +17 -0
  33. data/lib/zap/v2apis/params.rb +13 -0
  34. data/lib/zap/v2apis/pnh.rb +41 -0
  35. data/lib/zap/v2apis/postman.rb +17 -0
  36. data/lib/zap/v2apis/pscan.rb +77 -0
  37. data/lib/zap/v2apis/quickstartlaunch.rb +13 -0
  38. data/lib/zap/v2apis/replacer.rb +25 -0
  39. data/lib/zap/v2apis/reports.rb +21 -0
  40. data/lib/zap/v2apis/retest.rb +13 -0
  41. data/lib/zap/v2apis/reveal.rb +17 -0
  42. data/lib/zap/v2apis/revisit.rb +21 -0
  43. data/lib/zap/v2apis/rule_config.rb +29 -0
  44. data/lib/zap/v2apis/script.rb +105 -0
  45. data/lib/zap/v2apis/search.rb +57 -0
  46. data/lib/zap/v2apis/selenium.rb +93 -0
  47. data/lib/zap/v2apis/session_management.rb +29 -0
  48. data/lib/zap/v2apis/soap.rb +17 -0
  49. data/lib/zap/v2apis/spider.rb +293 -0
  50. data/lib/zap/v2apis/stats.rb +61 -0
  51. data/lib/zap/v2apis/users.rb +69 -0
  52. data/lib/zap/v2apis/wappalyzer.rb +21 -0
  53. data/lib/zap/v2apis/websocket.rb +33 -0
  54. data/lib/zap/zap.rb +77 -0
  55. data/lib/zap/zapv2.rb +102 -0
  56. data/lib/zaproxy.rb +3 -0
  57. data/openapi.yaml +11314 -0
  58. data/zaproxy.gemspec +4 -3
  59. metadata +60 -5
  60. data/lib/zap.rb +0 -8
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Replacer
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def rules
10
+ @client.get('/JSON/replacer/view/rules/')
11
+ end
12
+
13
+ def add_rule(description, enabled, match_type, match_regex, match_string, replacement, initiators, url)
14
+ @client.get("/JSON/replacer/action/addRule/?description=#{description}&enabled=#{enabled}&matchType=#{match_type}&matchRegex=#{match_regex}&matchString=#{match_string}&replacement=#{replacement}&initiators=#{initiators}&url=#{url}")
15
+ end
16
+
17
+ def remove_rule(description)
18
+ @client.get("/JSON/replacer/action/removeRule/?description=#{description}")
19
+ end
20
+
21
+ def set_enabled(description, bool)
22
+ @client.get("/JSON/replacer/action/setEnabled/?description=#{description}&bool=#{bool}")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Reports
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def template_details(template)
10
+ @client.get("/JSON/reports/view/templateDetails/?template=#{template}")
11
+ end
12
+
13
+ def templates
14
+ @client.get('/JSON/reports/view/templates/')
15
+ end
16
+
17
+ def generate(title, template, theme, description, contexts, sites, sections, included_confidences, included_risks, report_file_name, report_file_name_pattern, report_dir, display)
18
+ @client.get("/JSON/reports/action/generate/?title=#{title}&template=#{template}&theme=#{theme}&description=#{description}&contexts=#{contexts}&sites=#{sites}&sections=#{sections}&includedConfidences=#{included_confidences}&includedRisks=#{included_risks}&reportFileName=#{report_file_name}&reportFileNamePattern=#{report_file_name_pattern}&reportDir=#{report_dir}&display=#{display}")
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Retest
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def retest(alert_ids)
10
+ @client.get("/JSON/retest/action/retest/?alertIds=#{alert_ids}")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Reveal
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def reveal
10
+ @client.get('/JSON/reveal/view/reveal/')
11
+ end
12
+
13
+ def set_reveal(reveal)
14
+ @client.get("/JSON/reveal/action/setReveal/?reveal=#{reveal}")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Revisit
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def revisit_list
10
+ @client.get('/JSON/revisit/view/revisitList/')
11
+ end
12
+
13
+ def revisit_site_off(site)
14
+ @client.get("/JSON/revisit/action/revisitSiteOff/?site=#{site}")
15
+ end
16
+
17
+ def revisit_site_on(site, start_time, end_time)
18
+ @client.get("/JSON/revisit/action/revisitSiteOn/?site=#{site}&startTime=#{start_time}&endTime=#{end_time}")
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class RuleConfig
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def all_rule_configs
10
+ @client.get('/JSON/ruleConfig/view/allRuleConfigs/')
11
+ end
12
+
13
+ def rule_config_value(key)
14
+ @client.get("/JSON/ruleConfig/view/ruleConfigValue/?key=#{key}")
15
+ end
16
+
17
+ def reset_all_rule_config_values
18
+ @client.get('/JSON/ruleConfig/action/resetAllRuleConfigValues/')
19
+ end
20
+
21
+ def reset_rule_config_value(key)
22
+ @client.get("/JSON/ruleConfig/action/resetRuleConfigValue/?key=#{key}")
23
+ end
24
+
25
+ def set_rule_config_value(key, value)
26
+ @client.get("/JSON/ruleConfig/action/setRuleConfigValue/?key=#{key}&value=#{value}")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Script
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def global_custom_var(var_key)
10
+ @client.get("/JSON/script/view/globalCustomVar/?varKey=#{var_key}")
11
+ end
12
+
13
+ def global_custom_vars
14
+ @client.get('/JSON/script/view/globalCustomVars/')
15
+ end
16
+
17
+ def global_var(var_key)
18
+ @client.get("/JSON/script/view/globalVar/?varKey=#{var_key}")
19
+ end
20
+
21
+ def global_vars
22
+ @client.get('/JSON/script/view/globalVars/')
23
+ end
24
+
25
+ def list_engines
26
+ @client.get('/JSON/script/view/listEngines/')
27
+ end
28
+
29
+ def list_scripts
30
+ @client.get('/JSON/script/view/listScripts/')
31
+ end
32
+
33
+ def list_types
34
+ @client.get('/JSON/script/view/listTypes/')
35
+ end
36
+
37
+ def script_custom_var(script_name, var_key)
38
+ @client.get("/JSON/script/view/scriptCustomVar/?scriptName=#{script_name}&varKey=#{var_key}")
39
+ end
40
+
41
+ def script_custom_vars(script_name)
42
+ @client.get("/JSON/script/view/scriptCustomVars/?scriptName=#{script_name}")
43
+ end
44
+
45
+ def script_var(script_name, var_key)
46
+ @client.get("/JSON/script/view/scriptVar/?scriptName=#{script_name}&varKey=#{var_key}")
47
+ end
48
+
49
+ def script_vars(script_name)
50
+ @client.get("/JSON/script/view/scriptVars/?scriptName=#{script_name}")
51
+ end
52
+
53
+ def clear_global_custom_var(var_key)
54
+ @client.get("/JSON/script/action/clearGlobalCustomVar/?varKey=#{var_key}")
55
+ end
56
+
57
+ def clear_global_var(var_key)
58
+ @client.get("/JSON/script/action/clearGlobalVar/?varKey=#{var_key}")
59
+ end
60
+
61
+ def clear_global_vars
62
+ @client.get('/JSON/script/action/clearGlobalVars/')
63
+ end
64
+
65
+ def clear_script_custom_var(script_name, var_key)
66
+ @client.get("/JSON/script/action/clearScriptCustomVar/?scriptName=#{script_name}&varKey=#{var_key}")
67
+ end
68
+
69
+ def clear_script_var(script_name, var_key)
70
+ @client.get("/JSON/script/action/clearScriptVar/?scriptName=#{script_name}&varKey=#{var_key}")
71
+ end
72
+
73
+ def clear_script_vars(script_name)
74
+ @client.get("/JSON/script/action/clearScriptVars/?scriptName=#{script_name}")
75
+ end
76
+
77
+ def disable(script_name)
78
+ @client.get("/JSON/script/action/disable/?scriptName=#{script_name}")
79
+ end
80
+
81
+ def enable(script_name)
82
+ @client.get("/JSON/script/action/enable/?scriptName=#{script_name}")
83
+ end
84
+
85
+ def load(script_name, script_type, script_engine, file_name, script_description, charset)
86
+ @client.get("/JSON/script/action/load/?scriptName=#{script_name}&scriptType=#{script_type}&scriptEngine=#{script_engine}&fileName=#{file_name}&scriptDescription=#{script_description}&charset=#{charset}")
87
+ end
88
+
89
+ def remove(script_name)
90
+ @client.get("/JSON/script/action/remove/?scriptName=#{script_name}")
91
+ end
92
+
93
+ def run_stand_alone_script(script_name)
94
+ @client.get("/JSON/script/action/runStandAloneScript/?scriptName=#{script_name}")
95
+ end
96
+
97
+ def set_global_var(var_key, var_value)
98
+ @client.get("/JSON/script/action/setGlobalVar/?varKey=#{var_key}&varValue=#{var_value}")
99
+ end
100
+
101
+ def set_script_var(script_name, var_key, var_value)
102
+ @client.get("/JSON/script/action/setScriptVar/?scriptName=#{script_name}&varKey=#{var_key}&varValue=#{var_value}")
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Search
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def messages_by_header_regex(regex, baseurl, start, count)
10
+ @client.get("/JSON/search/view/messagesByHeaderRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
11
+ end
12
+
13
+ def messages_by_request_regex(regex, baseurl, start, count)
14
+ @client.get("/JSON/search/view/messagesByRequestRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
15
+ end
16
+
17
+ def messages_by_response_regex(regex, baseurl, start, count)
18
+ @client.get("/JSON/search/view/messagesByResponseRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
19
+ end
20
+
21
+ def messages_by_url_regex(regex, baseurl, start, count)
22
+ @client.get("/JSON/search/view/messagesByUrlRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
23
+ end
24
+
25
+ def urls_by_header_regex(regex, baseurl, start, count)
26
+ @client.get("/JSON/search/view/urlsByHeaderRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
27
+ end
28
+
29
+ def urls_by_request_regex(regex, baseurl, start, count)
30
+ @client.get("/JSON/search/view/urlsByRequestRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
31
+ end
32
+
33
+ def urls_by_response_regex(regex, baseurl, start, count)
34
+ @client.get("/JSON/search/view/urlsByResponseRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
35
+ end
36
+
37
+ def urls_by_url_regex(regex, baseurl, start, count)
38
+ @client.get("/JSON/search/view/urlsByUrlRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
39
+ end
40
+
41
+ def har_by_header_regex(regex, baseurl, start, count)
42
+ @client.get("/OTHER/search/other/harByHeaderRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
43
+ end
44
+
45
+ def har_by_request_regex(regex, baseurl, start, count)
46
+ @client.get("/OTHER/search/other/harByRequestRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
47
+ end
48
+
49
+ def har_by_response_regex(regex, baseurl, start, count)
50
+ @client.get("/OTHER/search/other/harByResponseRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
51
+ end
52
+
53
+ def har_by_url_regex(regex, baseurl, start, count)
54
+ @client.get("/OTHER/search/other/harByUrlRegex/?regex=#{regex}&baseurl=#{baseurl}&start=#{start}&count=#{count}")
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Selenium
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_browser_arguments
10
+ @client.get('/JSON/selenium/view/getBrowserArguments/')
11
+ end
12
+
13
+ def option_browser_extensions
14
+ @client.get('/JSON/selenium/view/optionBrowserExtensions/')
15
+ end
16
+
17
+ def option_chrome_binary_path
18
+ @client.get('/JSON/selenium/view/optionChromeBinaryPath/')
19
+ end
20
+
21
+ def option_chrome_driver_path
22
+ @client.get('/JSON/selenium/view/optionChromeDriverPath/')
23
+ end
24
+
25
+ def option_firefox_binary_path
26
+ @client.get('/JSON/selenium/view/optionFirefoxBinaryPath/')
27
+ end
28
+
29
+ def option_firefox_default_profile
30
+ @client.get('/JSON/selenium/view/optionFirefoxDefaultProfile/')
31
+ end
32
+
33
+ def option_firefox_driver_path
34
+ @client.get('/JSON/selenium/view/optionFirefoxDriverPath/')
35
+ end
36
+
37
+ def option_ie_driver_path
38
+ @client.get('/JSON/selenium/view/optionIeDriverPath/')
39
+ end
40
+
41
+ def option_last_directory
42
+ @client.get('/JSON/selenium/view/optionLastDirectory/')
43
+ end
44
+
45
+ def option_phantom_js_binary_path
46
+ @client.get('/JSON/selenium/view/optionPhantomJsBinaryPath/')
47
+ end
48
+
49
+ def add_browser_argument(argument, enabled)
50
+ @client.get("/JSON/selenium/action/addBrowserArgument/?argument=#{argument}&enabled=#{enabled}")
51
+ end
52
+
53
+ def remove_browser_argument(argument)
54
+ @client.get("/JSON/selenium/action/removeBrowserArgument/?argument=#{argument}")
55
+ end
56
+
57
+ def set_browser_argument_enabled(argument, enabled)
58
+ @client.get("/JSON/selenium/action/setBrowserArgumentEnabled/?argument=#{argument}&enabled=#{enabled}")
59
+ end
60
+
61
+ def set_option_chrome_binary_path(string)
62
+ @client.get("/JSON/selenium/action/setOptionChromeBinaryPath/?String=#{string}")
63
+ end
64
+
65
+ def set_option_chrome_driver_path(string)
66
+ @client.get("/JSON/selenium/action/setOptionChromeDriverPath/?String=#{string}")
67
+ end
68
+
69
+ def set_option_firefox_binary_path(string)
70
+ @client.get("/JSON/selenium/action/setOptionFirefoxBinaryPath/?String=#{string}")
71
+ end
72
+
73
+ def set_option_firefox_default_profile(string)
74
+ @client.get("/JSON/selenium/action/setOptionFirefoxDefaultProfile/?String=#{string}")
75
+ end
76
+
77
+ def set_option_firefox_driver_path(string)
78
+ @client.get("/JSON/selenium/action/setOptionFirefoxDriverPath/?String=#{string}")
79
+ end
80
+
81
+ def set_option_ie_driver_path(string)
82
+ @client.get("/JSON/selenium/action/setOptionIeDriverPath/?String=#{string}")
83
+ end
84
+
85
+ def set_option_last_directory(string)
86
+ @client.get("/JSON/selenium/action/setOptionLastDirectory/?String=#{string}")
87
+ end
88
+
89
+ def set_option_phantom_js_binary_path(string)
90
+ @client.get("/JSON/selenium/action/setOptionPhantomJsBinaryPath/?String=#{string}")
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class SessionManagement
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def sample(_arg)
10
+ @client.get('/JSON/template/view/sample/')
11
+ end
12
+
13
+ def get_session_management_method(context_id)
14
+ @client.get("/JSON/sessionManagement/view/getSessionManagementMethod/?contextId=#{context_id}")
15
+ end
16
+
17
+ def get_session_management_method_config_params(method_name)
18
+ @client.get("/JSON/sessionManagement/view/getSessionManagementMethodConfigParams/?methodName=#{method_name}")
19
+ end
20
+
21
+ def get_supported_session_management_methods
22
+ @client.get('/JSON/sessionManagement/view/getSupportedSessionManagementMethods/')
23
+ end
24
+
25
+ def set_session_management_method(context_id, method_name, method_config_params)
26
+ @client.get("/JSON/sessionManagement/action/setSessionManagementMethod/?contextId=#{context_id}&methodName=#{method_name}&methodConfigParams=#{method_config_params}")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZAPv2 < ZAP
4
+ class Soap
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def import_file(file)
10
+ @client.get("/JSON/soap/action/importFile/?file=#{file}")
11
+ end
12
+
13
+ def import_url(url)
14
+ @client.get("/JSON/soap/action/importUrl/?url=#{url}")
15
+ end
16
+ end
17
+ end