-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlog.py
More file actions
34 lines (26 loc) · 753 Bytes
/
log.py
File metadata and controls
34 lines (26 loc) · 753 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
"""
`log` global prints messages to the Output and Errors tab in Extensions -> Burp Scripting
print() sends messages there too.
[logging.py][INFO] - GET - https://www.ivision.com/
[logging.py][INFO] - Logs INFO
[logging.py][DEBUG] - Got a response
[logging.py][INFO] - {'key': 'value'}
[logging.py][ERROR] - oh no
ZeroDivisionError: division by zero
"""
# Enable log.debug()
log.enableDebug(True)
def on_request(req):
log.info(f"{req.method()} - {req.url()}")
print("Logs INFO")
return req
def on_response(res):
log.debug("Got a response")
obj = res.bodyToJson()
print(obj)
try:
x = 1 / 0
except Exception as ex:
# Logs to Errors tab of the extension
log.error("oh no", ex)
return res