thispc / psiphon

A multi-functional version of a popular network circumvention tool
GNU General Public License v3.0
229 stars 59 forks source link

No module named pexpect #3

Closed postadelmaga closed 7 years ago

postadelmaga commented 7 years ago

Hi, I am trying to run the client on Arch Linux but I got an error, I am not very familiar with python ... I have installed the package but python-pexpect but It doesn't make any difference.

$ python psi_client.py -u
Traceback (most recent call last):
  File "psi_client.py", line 22, in <module>
    from psi_ssh_connection import SSHConnection, OSSHConnection
  File "/home/fra/bin/src/psiphon-master/psi_ssh_connection.py", line 21, in <module>
    import pexpect
ImportError: No module named pexpect

Maybe is a good idea too add python-pexpect to add this dependency in the readme ?

tanmaytat11 commented 7 years ago

Try to install pexpect via pip or easy_install

sudo pip install pexpect OR sudo easy_install pexpect

tanmaytat11 commented 7 years ago

I will update the readme. Thanks for pointing it out.

postadelmaga commented 7 years ago

I tried both but the issue is still present, I think the problem is related to Arch and the way it manage python ( it looks on my system I have python2, python2.7 and python3 )

$ sudo pip install pexpect
Collecting pexpect
  ....
Requirement already satisfied: ptyprocess>=0.5 in /usr/lib/python3.6/site-packages (from pexpect)
Installing collected packages: pexpect
Successfully installed pexpect-4.2.1

Then I tried the following commands:

$ python3 psi_client.py -u
  File "psi_client.py", line 80
    print '\nNot a valid server number\n'
                                        ^
SyntaxError: Missing parentheses in call to 'print'

$ python2 psi_client.py -u
Traceback (most recent call last):
  File "psi_client.py", line 22, in <module>
    from psi_ssh_connection import SSHConnection, OSSHConnection
  File "/home/fra/bin/src/psiphon-master/psi_ssh_connection.py", line 21, in <module>
    import pexpect
ImportError: No module named pexpect

$ python2.7 psi_client.py -u
Traceback (most recent call last):
  File "psi_client.py", line 22, in <module>
    from psi_ssh_connection import SSHConnection, OSSHConnection
  File "/home/fra/bin/src/psiphon-master/psi_ssh_connection.py", line 21, in <module>
    import pexpect
ImportError: No module named pexpect
postadelmaga commented 7 years ago

ok I solved installing python2-pexpect

Now I got another error:

$ python2.7 psi_client.py -u

Traceback (most recent call last):
  File "psi_client.py", line 28, in <module>
    import wget
ImportError: No module named wget
tanmaytat11 commented 7 years ago

Install wget via pip or easy_install.

postadelmaga commented 7 years ago

Ok good, I miss this instrunction the readme ... Now It starts but I cannot connect to any server :( Maybe because I am in China ? anyway psiphon for android works ...

This is the command I am using $ python2.7 psi_client.py

postadelmaga commented 7 years ago

If I run python2.7 psi_client.py -t

I can see a line in the log saying: 'vailable (required by ./ssh)\r\nOpenSSL version mismatch. Built against 1000106f, you have 100020bf\r\r\n

Does it means I have to recompile openssh with the one provided in the repository ? If so there is not other way ? I feel like changing my openssh with the one provided is not a safe solution ( at least you should give more info about the reason in the readme )

tanmaytat11 commented 7 years ago

The psiphon client requires ossh functionality. If you have the binary of SSH with ossh then use that one(You might have to change the code a little bit (path of ossh binary) in order to the use the system SSH with ossh) or compile from source which is what I did for my system. I know the readme is a bit confusing. We will fix it.

postadelmaga commented 7 years ago

ok got it, I also realized the ssh provided is not going to be installed on my system but It will be only used by psiphon ... So I compiled it, removed ssh and copied the compiled new one ...

Now when I run psiphon It actually try to connect to the servers but I am getting a lot of timeouts and no successful connections. Any Idea ?

Here an example:

Trying to connect to GB : 178.79.187.223 DEBUG: OSSH connection: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x7f09ea652950> command: ./ssh args: [u'./ssh', u'-C', u'-D', u'127.0.0.1:1080', u'-N', u'-p', u'53', u'-z', u'-Z', u'22fb4e7dcacb22fd1e4e225617c7194a176e9ccbddbf0868530838e8721016d9', u'psiphon_ssh_e5d8ed8b2b4221c1@178.79.187.223'] buffer (last 100 chars): '' before (last 100 chars): '' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 19496 child_fd: 5 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile("f8:cf:df:ee:f3:0b:cd:a5:13:b5:46:36:8d:9b:3b:19") 1: re.compile("Password:") Trying next server... Trying to connect to GB : 213.171.207.92 DEBUG: OSSH connection: End Of File (EOF). Exception style platform. <pexpect.pty_spawn.spawn object at 0x7f09ea652590> command: ./ssh args: [u'./ssh', u'-C', u'-D', u'127.0.0.1:1080', u'-N', u'-p', u'53', u'-z', u'-Z', u'aade9724079f46e03ff52b226068ecd8b0dc6cde25b6f44b8334451b997ec0ce', u'psiphon_ssh_c0e00d00de168d91@213.171.207.92'] buffer (last 100 chars): '' before (last 100 chars): 'connect from 213.171.207.92: 2: Too many authentication failures for psiphon_ssh_c0e00d00de168d91\r\r\n' after: <class 'pexpect.exceptions.EOF'> match: None match_index: None exitstatus: None flag_eof: True pid: 19543 child_fd: 6 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile("Password:") Trying next server...

tanmaytat11 commented 7 years ago

Today even I am experiencing some difficulties in connecting to the servers. Keep trying it will connect. First make sure you update the servers python psi_client.py -u Then use any server like python psi_client.py -r GB

postadelmaga commented 7 years ago

I have tried your suggestion but nothing has changed :(

I noted that 2 different errors are triggered ( depending on the server I am connecting to ):

  1. DEBUG: OSSH connection: End Of File (EOF). Exception style platform. before (last 100 chars): 'ssh_exchange_identification: read: Connection reset by peer\r\r\n'
  2. DEBUG: OSSH connection: Timeout exceeded.

    • Do you know if this psiphon is using the same server of the android version ?
    • It maybe related to the fact I am in China ?
tanmaytat11 commented 7 years ago

I do not know if the android version uses these servers or not. The client by deafult uses servers with ossh and port 53. You can use the -a flag to include all the servers. eg: python psi_client.py -a -r GB or simply -a You can also run the psiphon client via Docker on your machine. Instructions to run the client via docker are available in the readme at the end. If the client does not run via docker then it may be a problem of your region or ISP.

thispc commented 7 years ago

Any progress on connecting to one of the servers??? GB servers are running fine for me.

postadelmaga commented 7 years ago

no progess :( I think it is related to the servers. I will try to see if the docker image works, I think we can close this task as we sorted out all the issue. Thanks

puneetmic commented 7 years ago

psiphon issue im not able to connect any of the server, i tried a lot of time. Is it due to "./ssh is not a valid executable. Using standard ssh"?? Plz help me

tanmaytat11 commented 7 years ago

You must compile your own ssh binary using the instructions. If you are using the system's ssh binary make sure it supports obfuscation and also change the source code wherever it runs ssh it is actually running ./ssh which means the local ssh file. You must change it to the only ssh ie path to the ssh binary

isakDavids commented 5 years ago

Hi tanmaytat11,

now I seem to hijack an old post.

Reading through the above it looks like I also have an issue of forever connecting to the next server --- perhaps my network is super slow, in that case, where can I change the timeout value?

Thanks for the tool!

aviwad commented 5 years ago

same doesn't work :(