appium / mitmproxy-java

A bridge between Python's mitmproxy and Java programs. Built on top of mitmproxy-node
Apache License 2.0
64 stars 20 forks source link

No module named 'websockets' #5

Closed adamMo closed 5 years ago

adamMo commented 5 years ago

[Win10] Hello, I tried to run the library, it keeps telling me that:

22:45:33.231 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - Loading script C:\Users\Adam\AppData\Local\Temp\mitmproxy-python-plugin5399613169945565656.py 22:45:33.231 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - in script C:\Users\Adam\AppData\Local\Temp\mitmproxy-python-plugin5399613169945565656.py: No module named 'websockets' 22:45:33.232 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - Proxy server listening at http://*:8080

I used pip3 to install websockets module but it looks like the script is somehow not using it, so at the end the handler function is not called. Do you have any idea what's going on?

Jonahss commented 5 years ago

I think I know what’s going on, how did you install mitmproxy itself? You have to install it via pip or from source, homebrew or the prebuilt binaries won’t work.

On Tuesday, June 25, 2019, adamMo notifications@github.com wrote:

[Win10] Hello, I tried to run the library, it keeps telling me that:

22:45:33.231 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - Loading script C:\Users\Adam\AppData\Local\Temp\mitmproxy-python- plugin5399613169945565656.py 22:45:33.231 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - in script C:\Users\Adam\AppData\Local\Temp\mitmproxy-python-plugin5399613169945565656.py: No module named 'websockets' 22:45:33.232 [Thread-6] INFO io.appium.mitmproxy.MitmproxyJava - Proxy server listening at http://*:8080

I used pip3 to install websockets module but it looks like the script is somehow not using it, so at the end the handler function is not called. Do you have any idea what's going on?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/appium/mitmproxy-java/issues/5?email_source=notifications&email_token=AALTRMP5JY4SR3Z2K67MQ3TP4E6CXA5CNFSM4H3CSY22YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G3MXO3Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AALTRML4SCO3ZN6LJBL65SDP4E6CXANCNFSM4H3CSY2Q .

adamMo commented 5 years ago

So I installed it by chocolatey package manager, it qualifies to be the prebuilt binaries? :)

Jonahss commented 5 years ago

Ah yeah, that’s the issue. The version of mitmproxy that comes from your package manager has it’s own version of Python which cannot interact with the modules you download.

Since you have chocolatey, you can install python and pip. Then use pip to install mitmproxy and you should be good to go. Don’t forget to uninstall mitmproxy using chocolatey first, so things don’t get confused.

On Tuesday, June 25, 2019, adamMo notifications@github.com wrote:

So I installed it by chocolatey package manager, it qualifies to be the prebuilt binaries? :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/appium/mitmproxy-java/issues/5?email_source=notifications&email_token=AALTRMNESPTE7CW3ZMFFBK3P4IEIDA5CNFSM4H3CSY22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQBI3I#issuecomment-505418861, or mute the thread https://github.com/notifications/unsubscribe-auth/AALTRMMPL6S3NIASIUGBWW3P4IEIDANCNFSM4H3CSY2Q .

adamMo commented 5 years ago

Ok, I did all of this and it works ok but I see the difference when comparing to standalone version... I ran selenium with proxy and I can intercept the requests which is cool but when trying to log in to youtube account, google says that my browser has no cookies enabled. When I tried to do this on 'pure' mitmproxy it was working good, do you have any idea what could go wrong?

Jonahss commented 5 years ago

Ok that’s interesting. When ypu say “pure mitmproxy” you mean using it alone from the commandline, not with java, right?

Something about the python plugin must be messing up cookies. I can take a look but am currently traveling to speak at Mobile Test Summit China 2019. I can look into this once I get back from China in a few days.

Unless you are able to take a look at the puthon code and try debugging?

On Thursday, June 27, 2019, adamMo notifications@github.com wrote:

Ok, I did all of this and it works ok but I see the difference when comparing to standalone version... I ran selenium with proxy and I can intercept the requests which is cool but when trying to log in to youtube account, google says that my browser has no cookies enabled. When I tried to do this on 'pure' mitmproxy it was working good, do you have any idea what could go wrong?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/appium/mitmproxy-java/issues/5?email_source=notifications&email_token=AALTRMNZCI7X74AXFCJEV23P4OPFTA5CNFSM4H3CSY22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYUGKRY#issuecomment-505963847, or mute the thread https://github.com/notifications/unsubscribe-auth/AALTRMLDHFPXSFFAJ7OGPL3P4OPFTANCNFSM4H3CSY2Q .

adamMo commented 5 years ago

Ok that’s interesting. When ypu say “pure mitmproxy” you mean using it alone from the commandline, not with java, right?

Right :)

I am not a python expert but I will try to debug what's going on.

Have a nice time!