Support HAR dumping example script in standalone binaries
See original GitHub issueSteps to reproduce the problem:
- Try to run har_dump.py example with standalone mitmdump binary:
mitmdump -s "examples/complex/har_dump.py /tmp/out.har"
Loading script: examples/complex/har_dump.py /tmp/out.har
Script error: Traceback (most recent call last):
File "examples/complex/har_dump.py", line 12, in <module>
import pytz
ImportError: No module named 'pytz'
Proxy server listening at http://0.0.0.0:8080
Any other comments? What have you tried so far?
I realize that har_dump.py is currently only an example script. However, it would be nice if it worked with the standalone binaries until/if you integrate it into the core of mitmproxy.
I have been able to resolve this by rebuilding locally with a couple of small edits:
> sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev
> git clone https://github.com/mitmproxy/mitmproxy.git
> cd mitmproxy
> git checkout tags/v1.0.2
(edit two files)
> git diff
diff --git a/release/specs/mitmdump b/release/specs/mitmdump
index 0aeac3c8..fd103525 100644
--- a/release/specs/mitmdump
+++ b/release/specs/mitmdump
@@ -1,3 +1,4 @@
#!/usr/bin/env python
from mitmproxy.tools.main import mitmdump
+import pytz
mitmdump()
diff --git a/setup.py b/setup.py
index fa20e7cf..caf703f9 100644
--- a/setup.py
+++ b/setup.py
@@ -52,7 +52,7 @@ setup(
entry_points={
'console_scripts': [
"mitmproxy = mitmproxy.tools.main:mitmproxy",
- "mitmdump = mitmproxy.tools.main:mitmdump",
+ "mitmdump = mitmproxy.tools.main:mitmdump [examples]",
"mitmweb = mitmproxy.tools.main:mitmweb",
"pathod = pathod.pathod_cmdline:go_pathod",
"pathoc = pathod.pathoc_cmdline:go_pathoc"
> ./dev.sh
> . venv3.5/bin/activate
> tox -e rtool -- bdist
> deactivate
> ls -lh release/build/binaries/linux/
I don’t think this is the correct fix. Ideally I would like to be able to tell pyinstaller about all of the “examples” dependencies for mitmdump specified in the root setup.py.
Do you have any suggestions about how this could be achieved? That would be one small step towards making HAR dumping better supported by the next release of mitmproxy (see: https://github.com/mitmproxy/mitmproxy/issues/1477 ).
System information
I’m on Ubuntu 16.04 using mitmdump 1.0.2:
> mitmdump --version
mitmdump 1.0.2
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
BusyBox
Static binaries are available for downloads, with each individual applet enabled separately, as well as the binary with almost all applets selected, and...
Read more >Integrity Measurement Architecture (IMA) Wiki - SourceForge
The IMA tests programs are part of the Linux Test Project. Download, compile, and install the standalone version of the IMA LTP test...
Read more >How to configure Browsertime - Sitespeed.io
You have the following options when running Browsertime within docker (run docker run sitespeedio/browsertime --help to get the list on your command line):....
Read more >TestSSLServer
Supported protocol versions (SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1 and TLS 1.2 are tested). For each protocol version, the supported cipher...
Read more >Bash Reference Manual - GNU.org
Like other GNU software, Bash is quite portable. It currently runs on nearly every ... bash --dump-po-strings scriptname > domain .pot.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m happy for you to push the fix if you have it ready 😊
@mchr3k Do you want to submit a PR? Otherwise I have the fix ready Also, we can get rid of the function completely by doing
datetime.fromtimestamp(timestamp, timezone.utc).isoformat()