-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathdojo_zap.py
57 lines (42 loc) · 1.55 KB
/
dojo_zap.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Example written by Aaron Weaver <aaron.weaver@owasp.org>
as part of the OWASP DefectDojo and OWASP AppSec Pipeline Security projects
Description: Creates a product in DefectDojo and returns information about the newly created product
"""
from defectdojo_api import defectdojo
import os
# Setup DefectDojo connection information
host = 'http://localhost:8000'
api_key = os.environ['DOJO_API_KEY']
user = 'admin1'
#Optionally, specify a proxy
proxies = {
'http': 'http://localhost:8080',
'https': 'http://localhost:8080',
}
#proxies=proxies
# Instantiate the DefectDojo api wrapper
dd = defectdojo.DefectDojoAPI(host, api_key, user, debug=False)
# List Tool Types
tool_types = dd.list_tool_types()
#print "Configured Tool Types"
#print tool_types.data_json(pretty=True)
list_credential_mappings = dd.list_credential_mappings()
print "CredMappings"
print list_credential_mappings.data_json(pretty=True)
list_credentials = dd.list_credentials()
print "Creds"
print list_credentials.data_json(pretty=True)
# Search Tool Types by Name
tool_types = dd.list_tool_types(name="Source Code Repository")
print "Source Code Repository Tool Types"
print tool_types.data["objects"][0]['id']
print tool_types.data_json(pretty=True)
print "Configured Source Code Repository Tools"
tool = dd.list_tools(tool_type_id=tool_types.data["objects"][0]['id'])
print tool.data_json(pretty=True)
print "Products Configured to use source code repos"
tool = dd.list_tool_products(tool_configuration_id=tool.data["objects"][0]['id'])
print tool.data_json(pretty=True)
"""
Scan by product id