mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge pull request #732 from FreeArtMan/master
Fixing issue #710. Prety printing in read_dumpfile
This commit is contained in:
commit
26052767a2
@ -5,15 +5,17 @@
|
|||||||
|
|
||||||
from libmproxy import flow
|
from libmproxy import flow
|
||||||
import json
|
import json
|
||||||
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
with open(sys.argv[1], "rb") as logfile:
|
with open(sys.argv[1], "rb") as logfile:
|
||||||
freader = flow.FlowReader(logfile)
|
freader = flow.FlowReader(logfile)
|
||||||
|
pp = pprint.PrettyPrinter(indent=4)
|
||||||
try:
|
try:
|
||||||
for f in freader.stream():
|
for f in freader.stream():
|
||||||
print(f)
|
print(f)
|
||||||
print(f.request.host)
|
print(f.request.host)
|
||||||
json.dump(f.get_state(), sys.stdout, indent=4)
|
pp.pprint(f.get_state())
|
||||||
print("")
|
print("")
|
||||||
except flow.FlowReadError as v:
|
except flow.FlowReadError as v:
|
||||||
print "Flow file corrupted. Stopped loading."
|
print "Flow file corrupted. Stopped loading."
|
||||||
|
Loading…
Reference in New Issue
Block a user