0

i´m in the process to install mitmproxy on a Amazon AWS EC2 Server, but i´ve i write mitmproxy into the terminal i get the following exception. By Google i haven´t found anythin :( i hope someone here can help me. (Maybe i´ve posted a little bit to lot of information if so i´m sorry :'[ )

  Traceback (most recent call last) :
  File "/usr/bin/mitmproxy", line 19, in <module>
    from libmproxy import proxy, console, cmdline, version
  File "/usr/lib/python2.6/site-packages/libmproxy/proxy.py", line 20, in <module>
    import utils, flow, version, platform, controller, app
  File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789
    cookie_parameters = {key.strip().lower() :value.strip() for key,sep,value in pairs[1:]}

  SyntaxError: invalid syntax

cat /proc/version gives me the following information

Linux version 3.4.48-45.46.amzn1.i686 (mockbuild@gobi-build-31004) (gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Wed Jun 12 02:04:37 UTC 2013

by writing python -V into the terminal i get Python 2.7.3

by pip list

 argparse (1.2.1)
 BeautifulSoup (3.2.1)
 Flask (0.10.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lxml (3.2.3)
 MarkupSafe (0.18)
 mechanize (0.2.5)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 PIL (1.1.7)
 pip (1.4.1)
 protobuf (2.5.0)
 PyAMF (0.6.1)
 pyasn1 (0.1.7)
 pyOpenSSL (0.13)
 Scrapy (0.18.0)
 setuptools (0.6c11)
 urwid (1.1.1)
 virtualenv (1.10.1)
 Werkzeug (0.9.3)
 wsgiref (0.1.2)

by pip-2.6 list

 argparse (1.2.1)
 aws-cfn-bootstrap (1.3)
 backports.ssl-match-hostname (3.2a3)
 certifi (0.0.8)
 chardet (2.0.1)
 Cheetah (2.4.1)
 cloud-init (0.5.15)
 configobj (4.6.0)
 distribute (0.6.10)
 Flask (0.10.1)
 iniparse (0.3.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lockfile (0.8)
 lxml (3.2.3)
 M2Crypto (0.20.2)
 Markdown (2.0.1)
 MarkupSafe (0.18)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 ordereddict (1.1)
 PIL (1.1.6)
 pip (1.4.1)
 protobuf (2.5.0)
 pyasn1 (0.1.7)
 pycurl (7.19.0)
 Pygments (1.4)
 pygpgme (0.1)
 pyOpenSSL (0.13)
 pystache (0.5.2)
 python-daemon (1.5.2)
 PyYAML (3.10)
 requests (1.1.0)
 Exception:
 Traceback (most recent call last):
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/basecommand.py",      line 134, in main
     status = self.run(options, args)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 80, in run
     self.run_listing(options)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 127, in run_listing
     self.output_package_listing(installed_packages)
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py",      line 136, in output_package_listing
     if dist_is_editable(dist):
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/util.py", line 347,      in dist_is_editable
     req = FrozenRequirement.from_dist(dist, [])
   File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/__init__.py", line      194, in from_dist
     assert len(specs) == 1 and specs[0][0] == '=='
 AssertionError

 Storing complete log in /home/ec2-user/.pip/pip.log

by pip-2.7 list

 argparse (1.2.1)
 BeautifulSoup (3.2.1)
 Flask (0.10.1)
 itsdangerous (0.23)
 Jinja2 (2.7.1)
 lxml (3.2.3)
 MarkupSafe (0.18)
 mechanize (0.2.5)
 mitmproxy (0.9.1)
 netlib (0.9.1)
 PIL (1.1.7)
 pip (1.4.1)
 protobuf (2.5.0)
 PyAMF (0.6.1)
 pyasn1 (0.1.7)
 pyOpenSSL (0.13)
 Scrapy (0.18.0)
 setuptools (0.6c11)
 urwid (1.1.1)
 virtualenv (1.10.1)
 Werkzeug (0.9.3)
 wsgiref (0.1.2)

best, SnowN

SnowN
  • 53
  • 2
  • 9

1 Answers1

1
File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789

Python 2.6 doesn't have dict comprehensions; you will need to rewrite it to call the dict constructor with an iterable of (key, value) pairs instead.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • Did you mean this? http://stackoverflow.com/a/1747827/2563468 would it not be right too, if he was instead sent to the mature path? `/usr/lib/python2.7/site-packages/libmproxy/flow.oy` but how i make that it calls this path? – SnowN Aug 13 '13 at 12:21
  • Ok it works thanks a lot, but maybe you can tell me too, how i can make it that it use the paths `/usr/lib/python2.7/...` – SnowN Aug 13 '13 at 12:34
  • Install it under and run the script with Python 2.7. – Ignacio Vazquez-Abrams Aug 13 '13 at 12:36
  • ok it work with `python2.7 /usr/bin/mitmproxy` Can i set it as default or wouldn´t be desirable? But if i can, how i do it? – SnowN Aug 13 '13 at 12:50