question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support HAR dumping example script in standalone binaries

See original GitHub issue
Steps to reproduce the problem:
  1. 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:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mchr3kcommented, Feb 23, 2017

I’m happy for you to push the fix if you have it ready 😊

On 23 Feb 2017, at 13:44, Ujjwal Verma notifications@github.com wrote:

@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()

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

0reactions
ujjwal96commented, Feb 23, 2017

@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()

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found