Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Odd-length string #27

Open
KokoseiJ opened this issue Sep 2, 2019 · 14 comments
Open

TypeError: Odd-length string #27

KokoseiJ opened this issue Sep 2, 2019 · 14 comments

Comments

@KokoseiJ
Copy link
Contributor

KokoseiJ commented Sep 2, 2019

I am running Fedora 30.
I tried to update the list, but it just gives me "TypeError: Odd-length string".
Full traceback is here:
Traceback (most recent call last):
File "psi_client.py", line 440, in
update()
File "psi_client.py", line 311, in update
js = i[loc:].decode('hex')
File "/usr/lib64/python2.7/encodings/hex_codec.py", line 42, in hex_decode
output = binascii.a2b_hex(input)
TypeError: Odd-length string

Any fix, or having a same issue?

@dhruvsatyapanthi007
Copy link

Same Issue

@Erixcode
Copy link

Erixcode commented Oct 6, 2019

same here, i'm fedora 30 and run the docker:latest. during update got same error:
root@fefbd46bc6a8:~/psiphon# psiphon -u 100% [......................................................] 1409925 / 1409925Traceback (most recent call last): File "psi_client.py", line 440, in <module> update() File "psi_client.py", line 311, in update js = i[loc:].decode('hex') File "/usr/lib/python2.7/encodings/hex_codec.py", line 42, in hex_decode output = binascii.a2b_hex(input) TypeError: Odd-length string root@fefbd46bc6a8:~/psiphon#

it seems "servers.dat" file did not generate in the normal way so serverlist did not get updated and timeout issue occurs, i used windows based server_list.dat and had no luck (format is different) i'm going to use android version and check whether that file is ok with linux or not!

Edit:
it seems this part of code has issue :

f = open('server_list','r')
    lol=f.read()
    lol = json.loads(lol)
    lol = lol["data"]
    serv = lol.split('\n')
    regions = dict()
    regions["propagation_channel_id"] = "FFFFFFFFFFFFFFFF"
    regions["sponsor_id"] = "FFFFFFFFFFFFFFFF"
    regions["servers"] = list()
    for i in serv:
        loc = i.find('{"webServerCertificate":'.encode('hex'))
        js = i[loc:].decode('hex')
        js = json.loads(js)
        
        regions["servers"].append(i)
    json.dump(regions, open('servers.dat', 'w'))

so i've edited this part with this code and the output file is structural the same with the original file but cannot be read (i'm so noob in python)

f = open('server_list','r')
lol=f.read()
lol = json.loads(lol)
lol = lol["data"]
serv = lol.split('\n')
regions = dict()
regions["propagation_channel_id"] = "FFFFFFFFFFFFFFFF"
regions["sponsor_id"] = "FFFFFFFFFFFFFFFF"
regions["servers"] = list()
for i in serv:
	loc = i.find('"webServerCertificate":'.encode('hex'))
	js = "{" + i[loc:].decode('hex')
	js = json.loads(js)
	regions["servers"].append(i)
json.dump(regions, open('servers.dat', 'w'))

@Erixcode
Copy link

Erixcode commented Oct 6, 2019

OK issue fixed and output file is working, it seems the main file needs some maintenance since the project is written in 2017 and today's server_list file does not matches. so I've updated the file and output is OK now please test if this is working.
thanks

psi_client.py.tar.gz

@Erixcode
Copy link

Erixcode commented Oct 6, 2019

File is ok, the issue is main script should be written from scratch!! i get
delimiter: <class 'pexpect.exceptions.EOF'>
DEBUG: OSSH connection: Timeout exceeded.
for all updated servers!! and i have no knowledge of fixing this issue!! this project is dead!!

@KokoseiJ
Copy link
Contributor Author

KokoseiJ commented Oct 7, 2019

I think it is splitting the file in the wrong point. Some of the string that are used to split the file actually didn't exist in the actual file, and that cause the error, I guess.

@KokoseiJ
Copy link
Contributor Author

KokoseiJ commented Oct 8, 2019

also, For the future users - This project won't work anymore due to different file format. Main core of Psiphon has been wrote in Go, Which is compilable in Linux. So If you need to use Psiphon in Linux, Complie it by yourself.

@KokoseiJ KokoseiJ closed this as completed Oct 8, 2019
@KokoseiJ KokoseiJ reopened this Oct 8, 2019
@KokoseiJ
Copy link
Contributor Author

KokoseiJ commented Oct 9, 2019

If someone is interested at writing the new Psiphon client from scratch, let me know. as I get some free time, I will open a new repository and start developing one.
@Erixcode you might want to check this

@tanmaytat11
Copy link
Collaborator

If someone is interested at writing the new Psiphon client from scratch, let me know. as I get some free time, I will open a new repository and start developing one.
@Erixcode you might want to check this

@KokoseiJ I am interested to help out in writing a new psiphon client. I know we have stopped activity and development around the python client but this used to work atleast when @thispc and me modified it 2 years back. Lemme know where you are getting started.

@KokoseiJ
Copy link
Contributor Author

KokoseiJ commented Oct 13, 2019

@KokoseiJ I am interested to help out in writing a new psiphon client. I know we have stopped activity and development around the python client but this used to work atleast when @thispc and me modified it 2 years back. Lemme know where you are getting started.

Oh, My god.

OK. but since I am doing another project and I don't have much time to spend at programming(I can write codes in weekend only), It's quite hard to start a new project right now. I will contact you when I've got some free time. My project will probably be done at november.

and, sorry for my bad english If it's hard to read. English is not my main language.

@Erixcode
Copy link

I would be happy to help if my low knowledge helps xD

@KokoseiJ
Copy link
Contributor Author

KokoseiJ commented Dec 25, 2019

@tanmaytat11 @thispc @Erixcode I made a PR.
check: #30
It works on my side, but I can't build a ssh binary. dunno if it's because I am using Fedora.
Anyway, I hope you guys to check my fix. and, Merry Christmas everyone!

Edit: plus, I am planning to completely remake the pyclient from scratch with Python3 as this code is running on Python 2 and containing some unnecessary parts because it's from 2012.

@Erixcode
Copy link

@KokoseiJ I think Binary Build issue is because mismatch in openssl version with current one already installed on the system. I tried docker to avoid this issue but still got error as i mentioned before! which i think the code needs to be rewritten from scratch.

@KokoseiJ
Copy link
Contributor Author

@Erixcode Well That's above my ability. using it with SSH relay is the current solution I guess.
plus, You can disable OSSH by removing preserved ssh executable, which will make that error disappear.

@KokoseiJ
Copy link
Contributor Author

Oh god Oh fuck It won't work without handshaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants