forked from ICTU/zap2docker-auth-weekly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_auth.py
More file actions
38 lines (32 loc) · 981 Bytes
/
test_auth.py
File metadata and controls
38 lines (32 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
import logging
import zap_config
import zap_auth
target = "http://example.org/"
config = zap_config.ZapConfig()
config.auth_display = True
config.auth_login_url = 'http://example.org/login'
config.auth_username = 'admin'
config.auth_password = 'Password123'
config.auth_otp_secret = ''
config.auth_submitaction = 'click'
config.auth_token_endpoint = ''
config.auth_username_field_name = 'username'
config.auth_password_field_name = 'password'
config.auth_otp_field_name = ''
config.auth_submit_field_name = 'login'
config.auth_first_submit_field_name = 'next'
config.auth_exclude_urls = list()
config.auth_include_urls = list()
config.check_delay = 5
config.check_element = ''
config.xss_collector = ''
logging.basicConfig(level=logging.INFO)
zap_common = None
auth = zap_auth.ZapAuth(config)
if config.auth_token_endpoint:
auth.login_from_token_endpoint(None)
else:
auth.setup_webdriver()
auth.login()
auth.set_authentication(None, target)