2
votes

Im trying to install mitmproxy on a Ubuntu 14.04 computer, but I'm getting error. I found on the web how I should install it by using this code:

sudo install pip mitmproxy

So I installed python, now when I run the command it works until I get this problem:

Command python.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography

I tried to update python but still the same Exactly I installed python in this way:

sudo apt-get install python-pyasn1 python-flask python-urwid 

What's wrong???

UPDATE

Here is the pip.log

4
Take a look at this question and the answer it got: stackoverflow.com/questions/22363752/… - Louis
I tried it with the answer you suggest me, but I'm still having the same issue... - lucgian841
Ok, then you'll have to put more information in your question. The log produced by pip can be quite long but you should at least copy and paste into your question the part of it that pertains to the cryptography package. - Louis
I reinstalled os now I'm following this "guide": groups.google.com/forum/#!msg/mitmproxy/4kKDFbqsi-8/… when I get all the packages I need I will install mitmproxy and I will post on my question the content of pip.log file - lucgian841
The only thing that comes to my mind is apt-get install libffi-dev and then retry. - Louis

4 Answers

4
votes

You can also pip install from github:

In this order:

  1. Install netlib: (sudo) pip install git+https://github.com/mitmproxy/netlib.git
  2. Install mitmproxy: (sudo) pip install git+https://github.com/mitmproxy/mitmproxy.git

This will install all requisite libraries and provide you with the most up-to-date version of mitmproxy.

3
votes

Judging by the log you got from pip the problem here is that the development libraries for libffi are not installed. You can rectify it with:

$ sudo apt-get install libffi-dev

and retry installing.

The clue in your error log is this line:

Package libffi was not found in the pkg-config search path.

If pkg-config is unable to find a library it means that the files needed to develop with this library are missing. On an Ubuntu or Debian system this usually means installing the package that has the name of the library plus -dev.

3
votes

Running these 2 commands worked for me (Ubuntu 14.04)

sudo apt-get install python-pip python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev

sudo pip install mitmproxy

EDIT: You need to run this command before you will be able to use "mitmproxy -p port_number". since it gives error "Error: mitmproxy requires a UTF console environment."

export LC_ALL=en_US.UTF-8

EDIT 2: After installation, you need to generate certificate first and have to transfer it into your device then setup manual proxy by entering your computer's IP address and port on which you will run mitmproxy server. Use below commands to generate certificate:

sudo apt-get install libnss3-tools
certutil -d sql:$HOME/.pki/nssdb -A -t C -n mitmproxy -i ~/.mitmproxy/mitmproxy-ca-cert.pem
1
votes
$ pip uninstall mitmproxy netlib

$ sudo apt-get install -y build-essential libssl-dev libffi-dev python-dev python-pip libxml2-dev libxslt-dev git

$ sudo pip install git+https://github.com/mitmproxy/netlib.git@master

 sudo pip install git+https://github.com/mitmproxy/mitmproxy.git@master

$ sudo python  # 
>>> from netlib import certffi
>>> exit()