Steps to reproduce the problem:
- Download https://snapshots.mitmproxy.org/4.0.4/mitmproxy-4.0.4-linux.tar.gz
- Extract archive
- Run chmod +x mitmproxy
- Run chmod +x mitmweb
- Run chmod +m mitmdump
- Run ./mitmweb
Any other comments? What have you tried so far?
System information
Cinnaman Linux Mint 19.1 Tessa
~ $ python3 —version
Python 3.6.7
python —version
Python 2.7.15rc1
mitmproxy —version
Traceback (most recent call last):
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 574, in _build_master
ws.require(requires)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 892, in require
needed = self.resolve(parse_requirements(requirements))
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 783, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (urwid 2.0.1 (/usr/lib/python3/dist-packages), Requirement.parse(‘urwid<1.4,>=1.3.1’), {‘mitmproxy’})During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File «/usr/bin/mitmproxy», line 6, in
from pkg_resources import load_entry_point
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3088, in
@_call_aside
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3072, in _call_aside
f(*args, **kwargs)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 576, in _build_master
return cls._build_from_requirements(requires)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 589, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘urwid<1.4,>=1.3.1’ distribution was not found and is required by mitmproxy
Error in sys.excepthook:
Traceback (most recent call last):
File «/usr/lib/python3/dist-packages/apport_python_hook.py», line 145, in apport_excepthook
os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), ‘wb’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/var/crash/_usr_bin_mitmproxy.1000.crash’Original exception was:
Traceback (most recent call last):
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 574, in _build_master
ws.require(requires)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 892, in require
needed = self.resolve(parse_requirements(requirements))
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 783, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (urwid 2.0.1 (/usr/lib/python3/dist-packages), Requirement.parse(‘urwid<1.4,>=1.3.1’), {‘mitmproxy’})During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File «/usr/bin/mitmproxy», line 6, in
from pkg_resources import load_entry_point
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3088, in
@_call_aside
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3072, in _call_aside
f(*args, **kwargs)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 576, in _build_master
return cls._build_from_requirements(requires)
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 589, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File «/usr/lib/python3/dist-packages/pkg_resources/init.py», line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘urwid<1.4,>=1.3.1’ distribution was not found and is required by mitmproxy
-
Home -
Security, Penetration Testing -
mitmproxy: Error starting proxy server: OSError(98, ‘Address already in use’)
This topic has been deleted. Only users with topic management privileges can see it.
-
I just installed mitmproxy tool. I want to run it. Once I type:
sudo mitmproxy
I get this error:Error starting proxy server: OSError(98, ‘Address already in use’)
I searched and found some suggestion for changing the port by typing: sudo
mitmproxy -p 99999
However, I think this may cause me problems as I wan to do HTTPS traffic manipulation.Can you please help me solve the error?
-
So i had time to look into this.Here is how you do it.
In Firefox:-
- GO to options
- Then preferences
- In the search type network.
- click on settings in network proxy
- select manual proxy configuration
- Http proxy 127.0.0.1 port 8080
- select use this proxy for all protocols and then click ok
- Now listen on port 8080 using mitm proxy and you will intercept all
traffic on loopback.
Obviously install root CA if you want to listen for HTTPS traffic.
This is for listening on loopback like you mention.Use arp poisoning or similar for other devices on the network
Suggested Topics
-
2
0
Votes2
Posts1
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts1
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts1
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts1
Views -
2
0
Votes2
Posts0
Views -
2
0
Votes2
Posts0
Views
Description
fatfantasma
2014-03-26 17:35:49 UTC
Description of problem: I am trying to start a new python 3.3 app on Openshift. Due to the changes they made a couple of weeks ago I am having trouble getting the new app started. I copied a known working app into a new Python 3.3 Openshift app. I am now getting this error: Target WSGI script '/var/lib/openshift//app-root/runtime/repo/wsgi.py' does not contain WSGI application 'application'. My wsgi.py code is the same in both working and non working apps It seems there is an existing httpd server running already when the wsgi.py entry point is executed. I also noticed the entry point is an 'application' function inside wsgi.py and not wsgi.py itself like it used to be. When using the exact same code as an other working Openshift app I get this error: 'wsgi.py' does not contain WSGI application 'application' The code that I use to start my app that I have always used cans be seen below. The app that does work with the same code was created before the March 14 changes. Is this a bug or a fundamental change in how Openshift now does things? How do I start my server (waitress, cherrpy, simple, etc) now? import os from myapp import main_production_no_pserve if __name__ == '__main__': ip = os.environ['OPENSHIFT_PYTHON_IP'] port = int(os.environ['OPENSHIFT_PYTHON_PORT']) app = main_production_no_pserve(global_config=None) from waitress import serve print("Starting Waitress Server on http://{0}:{1}".format(ip, port)) serve(app, host=ip, port=port, threads=50) Version-Release number of selected component (if applicable): How reproducible: Create a Openshift python 3.3 app. How do I start my server (waitress, cherrpy, simple, etc) now? Steps to Reproduce: 1. 2. 3. Actual results: 'wsgi.py' does not contain WSGI application 'application' Expected results: My server starts from the above code. Additional info: Since the March 14 changes I was able to change my existing openshift apps (app.py to wsgi.py) to the new method and they work. Create new Openshift apps have the problem.
Comment 3
fatfantasma
2014-03-27 20:51:00 UTC
I have looked at your example code and have changed mine to the below code. However, if __name__ == '__main__': code never gets run like in the old Openshift method. The new method seems to target the function 'application' in wsgi.py as an entry point instead of wsgi.py itself. I tried the following but I am now getting PermissionError: [Errno 13] Permission denied Can you give an example on how to start a 'waitress' server using the new methodology? I am obviously missing something :) def application(environ, start_response): from waitress import serve from myapp import main_production ip = 'localhost' port = 8051 app = main_production(global_config=None) serve(app, host=ip, port=port, threads=50) return if __name__ == '__main__': from waitress import serve from myapp import main_production ip = 'localhost' port = 8051 app = main_production(global_config=None) serve(app, host=ip, port=port, threads=50)
Comment 4
Vojtech Vitek
2014-03-28 17:01:00 UTC
@fatfantasma I think stackoverflow.com would be better place to ask questions like in comment 3, as bugzilla is not a support tool. I'll get back to you once I have some spare time to investigate this.
Comment 5
fatfantasma
2014-03-28 18:58:54 UTC
I agree with you that stackoverflow.com is a better place. However, nobody answers there. In fact, I have been redirected here a couple of times which I find ridiculous but I have been force to on this occasion. I would appreciate it greatly if you can give me an example how to start a server using the new methodology. :) I will even post the answer in stackoverflow for the next poor bastard as not to bother you again:)
Comment 6
Vojtech Vitek
2014-04-04 14:01:15 UTC
Created attachment 882723 [details]
Python 3.3 - app.py
How to test:
Put this file into the git repository, while still having wsgi.py from the default template repository.
Expected results:
'app.py' server is running instead of Apache/mod_WSGI.
Comment 7
Vojtech Vitek
2014-04-04 14:03:42 UTC
@fatfantasma, read through the example 'app.py' file provided in Comment 6. The example file can run gevent/cherrypy/flask servers. It's just up to what you put into the dependencies/requirements of your app.
Comment 8
Vojtech Vitek
2014-04-04 14:06:25 UTC
For QE: See Comment 6 to see how to test this.
Comment 9
Vojtech Vitek
2014-04-04 14:14:44 UTC
Further steps (as seen from Bug 1082363 Comment 14): 1. Create Python 3.3 app $ rhc app-create py33 python-3.3 > .. > Creating application 'py33' ... done > Your application 'py33' is now available. > .. # git push something to see the remote messages $ cd py33 && touch README && git add README && git commit -amREADME && git push > remote: Running setup.py script.. > ... > remote: Starting Python 3.3 cartridge (Apache+mod_wsgi) > remote: Application directory "/" selected as DocumentRoot > remote: Application "wsgi.py" selected as default WSGI entry point 2. Check the app from the Web Working template "Welcome to Openshift" appeared, meaning that Apache/mod_WSGI successfully loaded the default 'wsgi.py' file. $ rhc ssh py33 $ ps aux > Listed processes (snip): > /usr/sbin/httpd > /usr/sbin/rotatelogs 3. Add 'app.py' file to the application: - The 'app.py' file to be attached below. - Note that 'app.py' is still undocumented feature that came from Python 3.3 community cartridge. We'll eventually support it officially, see https://trello.com/c/5qhdqEuk. $ git add app.py && git commit -am"Adding app.py" && git push > remote: Stopping Python 3.3 cartridge > remote: Running setup.py script.. > remote: Starting Python 3.3 cartridge (app.py server) 4. Check the app from the Web Working template "Welcome to Openshift" appeared, meaning that app.py server was successfully started and loaded the 'wsgi.py' file. $ rhc ssh py33 $ ps aux > Listed processes (snip): > python -u app.py
Comment 11
Vojtech Vitek
2014-04-04 18:25:48 UTC
fatfantasma 2014-04-04 20:05:02 CEST @Vojtech Here are the steps to reproduce OSError: [Errno 98] Address already in use. 1. Create python 3.3 app 2. Clone app to PC 3. Delete wsgi.py 4. Add in my app.py 5. commit and push At this point you will get the error or not depending if the server is running before. If not error. Just make another commit and push. The error is Traceback (most recent call last): File "app.py", line 299, in <module> server = make_server(ip, port, application) #Serve from our local server File "/opt/rh/python33/root/usr/lib64/python3.3/wsgiref/simple_server.py", line 146, in make_server server = server_class((host, port), handler_class) File "/opt/rh/python33/root/usr/lib64/python3.3/socketserver.py", line 430, in __init__ self.server_bind() File "/opt/rh/python33/root/usr/lib64/python3.3/wsgiref/simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "/opt/rh/python33/root/usr/lib64/python3.3/http/server.py", line 135, in server_bind socketserver.TCPServer.server_bind(self) File "/opt/rh/python33/root/usr/lib64/python3.3/socketserver.py", line 441, in server_bind self.socket.bind(self.server_address) OSError: [Errno 98] Address already in use At this point if you do a "rhc app-force-stop <app>" and do another commit and push the app will run correctly. This must be done for every new commit and push or you will get the error.
Comment 12
Vojtech Vitek
2014-04-04 18:27:41 UTC
@fatfantasma, can you ssh into your gear and run `ps aux'? What's the output? What ip/port are you trying to bind to?
Comment 13
fatfantasma
2014-04-04 21:35:03 UTC
Did you run through my steps to replicate the error? If you look at my app.py you clearly see what ports I am binding to: if __name__ == '__main__': ip = os.environ['OPENSHIFT_PYTHON_IP'] port = int(os.environ['OPENSHIFT_PYTHON_PORT']) server = make_server(ip, port, application) server.serve_forever() REMEMBER!!! the above code works as long as you do a 'rhc app-force-stop' before you push. This problem occurred after the March 14 update. After I get the OSError: [Errno 98] Address already in use I ssh into my app and did the 'ps aux' command. The output is as follows: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 6631 249351 0.0 0.1 94472 12648 ? S 13:57 0:02 python -u app. 6631 270783 0.0 0.0 104920 2676 ? S 17:23 0:00 sshd: 533ee784 6631 270786 0.0 0.0 4108 576 pts/1 Ss+ 17:23 0:00 /usr/bin/tail 6631 277490 0.0 0.0 104920 2664 ? S 17:25 0:00 sshd: 533ee784 6631 277491 1.7 0.0 108740 2164 pts/2 Ss 17:25 0:00 /bin/bash --in 6631 278274 0.0 0.0 110240 1160 pts/2 R+ 17:26 0:00 ps aux
Comment 14
fatfantasma
2014-04-05 23:08:34 UTC
Also make sure you edit/push a couple of times. Check for the error after the push. You make think it works but it's really the old version running because the push never stop the old server.
Comment 15
Wenjing Zheng
2014-04-08 08:45:30 UTC
Verified on STG(devenv-stage_783), cannot meet the same error by following steps in comment 6 and comment 11, the app main page displays well by using app.py no matter wsgi.py exists or not: 1. Create a python-3.3 app; 2. Delete wsgi.py; 3. Copy app.py(the one from @fatfantasma) to $app; 4. Push the changes; remote: Activating deployment remote: Starting Python 3.3 cartridge (app.py server) remote: ------------------------- remote: Git Post-Receive Result: success 5. SSH to the app [py33-domain2014.stg.rhcloud.com 53439d5cdbd93cb7b30008a6]> ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1884 476964 0.3 0.1 94468 12700 ? S 04:22 0:00 python -u app.py 1884 476965 0.0 0.0 11476 760 ? S 04:22 0:00 /bin/bash /var/lib/openshift/53439d5 1884 476966 0.0 0.0 197960 2532 ? Sl 04:22 0:00 /usr/bin/logshifter -tag python 1884 477285 0.0 0.0 104920 2684 ? S 04:23 0:00 sshd: 53439d5cdbd93cb7b30008a6@pts/0 1884 477298 0.8 0.0 108740 2280 pts/0 Ss 04:23 0:00 /bin/bash --init-file /usr/bin/rhcsh 1884 477582 0.0 0.0 110244 1144 pts/0 R+ 04:23 0:00 ps aux 6. Access the app URL, it displays "Welcome to your Python application on OpenShift"
Comment 17
fatfantasma
2014-04-08 16:40:23 UTC
There is still a problem. I have a feeling you guys are not doing multiple pushes and verifying if the server actually gets stopped. That app WILL always appear to work since it's the original server that is still running when the app get originally created. I will try to be more specific on the step. 1. Create python 3.3 app online 2. Delete wsgi.py 3. Copy my app.py (provided above). 4. RHC tail <app name> 5. push changes (push will be SUCCESSFUL) 6. You should now see the Error 98 after push has finished and it tries to restart. 7. The app with the new changes fails to start BUT the old app is still running which gives the illusion that it work. I can do this every time. Other have the same error.
Comment 18
fatfantasma
2014-04-14 23:52:48 UTC
It looks like you guys fix it. Since there were no updates here for 6 days I tried to push again. It worked :) I do see a bunch of new messages (using tail) before the server starts so you guys must have been working on it.
Comment 19
Vojtech Vitek
2014-04-15 13:54:32 UTC
@fatfantasma glad to hear this feedback from you. Thank you for your help!