mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 23:09:44 +00:00
Fixup HAR Extractor
This commit is contained in:
parent
3de89ab16c
commit
27faea2355
@ -1,5 +1,4 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
This inline script utilizes harparser.HAR from
|
This inline script utilizes harparser.HAR from
|
||||||
https://github.com/JustusW/harparser to generate a HAR log object.
|
https://github.com/JustusW/harparser to generate a HAR log object.
|
||||||
"""
|
"""
|
||||||
@ -122,26 +121,38 @@ def response(context, flow):
|
|||||||
if item > -1:
|
if item > -1:
|
||||||
full_time += item
|
full_time += item
|
||||||
|
|
||||||
started_date_time = datetime.fromtimestamp(
|
started_date_time = datetime.utcfromtimestamp(
|
||||||
flow.request.timestamp_start,
|
flow.request.timestamp_start).isoformat()
|
||||||
tz=utc).isoformat()
|
|
||||||
|
request_query_string = ""
|
||||||
|
if flow.request.query:
|
||||||
|
request_query_string = [{"name": k, "value": v}
|
||||||
|
for k, v in flow.request.query]
|
||||||
|
|
||||||
request_query_string = [{"name": k, "value": v}
|
|
||||||
for k, v in flow.request.query]
|
|
||||||
request_http_version = flow.request.http_version
|
request_http_version = flow.request.http_version
|
||||||
# Cookies are shaped as tuples by MITMProxy.
|
# Cookies are shaped as tuples by MITMProxy.
|
||||||
request_cookies = [{"name": k.strip(), "value": v[0]}
|
request_cookies = [{"name": k.strip(), "value": v[0]}
|
||||||
for k, v in flow.request.cookies.items()]
|
for k, v in flow.request.cookies.items()]
|
||||||
request_headers = [{"name": k, "value": v} for k, v in flow.request.headers]
|
|
||||||
|
request_headers = ""
|
||||||
|
if flow.request.headers:
|
||||||
|
request_headers = [{"name": k, "value": v}
|
||||||
|
for k, v in flow.request.headers.fields]
|
||||||
|
|
||||||
request_headers_size = len(str(flow.request.headers))
|
request_headers_size = len(str(flow.request.headers))
|
||||||
request_body_size = len(flow.request.content)
|
request_body_size = len(flow.request.content)
|
||||||
|
|
||||||
response_http_version = flow.response.http_version
|
response_http_version = flow.response.http_version
|
||||||
|
|
||||||
# Cookies are shaped as tuples by MITMProxy.
|
# Cookies are shaped as tuples by MITMProxy.
|
||||||
response_cookies = [{"name": k.strip(), "value": v[0]}
|
response_cookies = [{"name": k.strip(), "value": v[0]}
|
||||||
for k, v in flow.response.cookies.items()]
|
for k, v in flow.response.cookies.items()]
|
||||||
response_headers = [{"name": k, "value": v}
|
|
||||||
for k, v in flow.response.headers]
|
response_headers = ""
|
||||||
|
if flow.response.headers:
|
||||||
|
response_headers = [{"name": k, "value": v}
|
||||||
|
for k, v in flow.response.headers.fields]
|
||||||
|
|
||||||
response_headers_size = len(str(flow.response.headers))
|
response_headers_size = len(str(flow.response.headers))
|
||||||
response_body_size = len(flow.response.content)
|
response_body_size = len(flow.response.content)
|
||||||
response_body_decoded_size = len(flow.response.get_decoded_content())
|
response_body_decoded_size = len(flow.response.get_decoded_content())
|
||||||
|
Loading…
Reference in New Issue
Block a user