dutzi / tamper

Devtools extension, lets you locally edit files served from the web (based on mitmproxy).
http://dutzi.github.io/tamper
MIT License
394 stars 36 forks source link

Could not connect to proxy (help) message? #18

Closed saalmaan closed 9 years ago

saalmaan commented 9 years ago

Hi @dutzi, I am using mitmproxy binary, despite mitm running in the background chrome plugin still say "could not connect to proxy". Also there it will be helpful if there is some clear easy to understand documentation regarding mitmproxy for people who are new to this kind of this. I will be more than happy to contribute and update the documentation and make videos if this helps. This is a really useful tool and can greatly reduce dependency on external middleware like "Fiddler" and "Charles Proxy". Thanks

screen shot 2014-11-28 at 14 29 10

saalmaan commented 9 years ago

Update (23 july 2016): for more detail see updated troubleshooting guide

OK, it turns out that Tamper doesn't work with mitmproxy binaries, so had to install mitmproxy from the source. When tried to install mitmproxy on Mac OS X Yosemite I ran into several problems of missing and outdated dependencies. So here is summary of my solution.

Type all these commands in console/terminal (only tested on mac osx Yosemite)

1) Install or update your xcode xcode-select --install this will take about 15 mins depending on your internet connection. 2) Tamper and mitmproxy are python based so we have to install Python Package Index (pip) with this command sudo easy_install pip 3) After xcode & pip installation, install mitmproxy with this command sudo pip install mitmproxy 4) Now is the time to install Tamper it self, use this command to install sudo pip install tamper, if tamper installation is successful you will see following message at the end

Successfully installed tamper mitmproxy pyOpenSSL Pillow netlib lxml Werkzeug Jinja2 itsdangerous certifi backports.ssl-match-hostname cryptography markupsafe cffi pycparser

5) You can also view all installed packages in pip with this command pip list 6) Now verify if mitmproxy is working by typing in command mitmproxy, if you see a an following error

You are using an outdated version of pyOpenSSL: mitmproxy requires pyOpenSSL 0.14 or greater. then rename this folder to something else

then you have to rename pyOpenSSL folder with this command mv /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_OpenSSL, try to run mitmproxy again and this time you should see famous mitmproxy interface 7) Now install Tamper chrome extension from here 8) Now change your network settings Open System PreferencesNetworkWIFI or EthernetAdvanceProxiesWeb Proxy (HTTP) → Web Proxy Server = 127.0.0.1:8080, save these details and apply them 9) Now open http://mitm.it and click on Apple icon and this will download the certificate, just open this certificate and install it in keychain 10) Now open chrome and target website and open devtools and open Tamper panel and click on little wheel icon on bottom left hand of tamper panel to open tamper settings, restart proxy. Now just enable Tamper and you are good to go (if everything is correct Tamper icon should turn blue)

I hope this helps other people and save them time.

Thanks Salman

dutzi commented 9 years ago

Hey @saalmaan, happy to hear it worked out for you and thanks for coming back and updating! I didn't understand why was step 8 necessary? Once you install the Tamper Chrome extension it should modify Chrome's settings to use it as a proxy.

Thanks again for the lengthy update, I'd like to add a link to this comment on the Readme if you don't mind?

saalmaan commented 9 years ago

Hey @dutzi , yeah you are right step 8 is not required, thats was just to check if mitmproxy is working by diverting traffic to mitmproxy's port. but for Temper step 8 is not required.

Actually I was updating the Readme as we speak to help out Temper users so give me another 30 mins and you will see updated installation instruction for Mac :) Also after the update do read through to make any necessary corrections. thank you again for great tool. I also tweeted it to javascript community and already for 4 retweets and 2 favs :)

dutzi commented 9 years ago

Cool! Thanks :+1:

saalmaan commented 9 years ago

@dutzi Oh I don't have the write access for readme file :)

dutzi commented 9 years ago

Weird. What happens when you click the pencil button here?

saalmaan commented 9 years ago

@dutzi I see this message

You are editing a file in a project you do not have write access to. We are forking this project for you (if one does not yet exist) to write your proposed changes to. Submitting a change to this file will write it to a new branch in your fork so you can send a pull request.

dutzi commented 9 years ago

Below that message should be the text editor, did you try clicking 'Propose file change'?

saalmaan commented 9 years ago

oh I see, so I just update the changes in there and they will show up in the main project ?

dutzi commented 9 years ago

I think once you click 'Propose file change' I should see the pull request

saalmaan commented 9 years ago

@dutzi I have updated the readme file, please verify and update thanks, I am also planning to include a section for Tamper shortcuts and usage examples.

dutzi commented 9 years ago

Hey @saalmaan, sorry for the late response. Looks good! I made slight modification and ended up adding the extended installation instructions to a wiki page for 2 reasons: 1. It was a bit too much for a readme; 2. pip install, in most tools I've seen, is considered to be in a developer's toolset. It felt a bit like adding troubleshooting tips for using npm for tools like Phantomjs...

Thanks again for the contrib, please let me know if you can edit it, I think it's possible, but I've never played with Github wikis... Adding the shortcuts and usage examples there would be great :smiley:

saalmaan commented 9 years ago

@dutzi Good job, I agree this is more of troubleshooting, but some people like myself growing to be power user are new to pip and mitmproxy, for them this guide will be huge time saver.

I am doing MVT testing for a large client and tamper helped me do some heavy lifting and debugging, ended up saving many useful hours. I think I will write more guides and examples on the weekend.

saalmaan commented 8 years ago

For future reference updated the troubleshooting wiki with el captian options and new python installation