aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-06-11 16:40:21 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-06-11 16:40:21 +1200
commite367b8819569a7811d2625a2b59610b508e8175c (patch)
tree84de6eb8e4756eb2dd9acea741e89d6b5585179f /netlib
parent4831e3e0bcd6dc94c84df3dd224c354732bd3655 (diff)
downloadmitmproxy-e367b8819569a7811d2625a2b59610b508e8175c.tar.gz
mitmproxy-e367b8819569a7811d2625a2b59610b508e8175c.tar.bz2
mitmproxy-e367b8819569a7811d2625a2b59610b508e8175c.zip
Add a --sysinfo flag to all daemons
This dumps all the platform information and mitmproxy version data we'd normally need to troubleshoot an issue.
Diffstat (limited to 'netlib')
-rw-r--r--netlib/debug.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/netlib/debug.py b/netlib/debug.py
new file mode 100644
index 00000000..ca25b828
--- /dev/null
+++ b/netlib/debug.py
@@ -0,0 +1,26 @@
+import platform
+from netlib import version
+
+"""
+ Some utilities to help with debugging.
+"""
+
+def sysinfo():
+ data = [
+ "Mitmproxy verison: %s"%version.VERSION,
+ "Python version: %s"%platform.python_version(),
+ "Platform: %s"%platform.platform(),
+ ]
+ d = platform.linux_distribution()
+ if d[0]:
+ data.append("Linux distro: %s %s %s"%d)
+
+ d = platform.mac_ver()
+ if d[0]:
+ data.append("Mac version: %s %s %s"%d)
+
+ d = platform.win32_ver()
+ if d[0]:
+ data.append("Windows version: %s %s %s %s"%d)
+
+ return "\n".join(data)