Implemented phpstruct and started turning everything into classes.

This commit is contained in:
danogentili 2016-07-14 14:22:46 +02:00
parent a6bd5655c0
commit 24396b23f0
4 changed files with 1 additions and 2 deletions

BIN
TL.php

Binary file not shown.

2
TL.py
View File

@ -101,7 +101,7 @@ def serialize_param(bytes_io, type_, value):
elif type_ in ["int128", "int256"]:
assert isinstance(value, bytes)
bytes_io.write(value)
elif type_ == 'string' or 'bytes':
elif type_ == 'string' or type_ == 'bytes':
l = len(value)
if l < 254: # short string format
bytes_io.write(struct.pack('<b', l)) # 1 byte of string

Binary file not shown.

View File

@ -40,7 +40,6 @@ def vis(bs):
if not len(bs) % symbols_in_one_line == 0:
print(str((i+1)*symbols_in_one_line)+" | "+" ".join(["%02X" % b for b in bs[(i+1)*symbols_in_one_line:]])+"\n") # for last line
vis(b'ddd')
class Session:
""" Manages TCP Transport. encryption and message frames """
def __init__(self, ip, port, auth_key=None, server_salt=None):