This commit is contained in:
danogentili 2016-07-15 15:42:49 +02:00
parent 74ffc15157
commit 0be0bf090f
6 changed files with 63 additions and 1376 deletions

4
TL.php
View File

@ -171,7 +171,9 @@ class TL
if (isset($this->constructor_type[$type_])) { if (isset($this->constructor_type[$type_])) {
$tl_elem = $this->constructor_type[$type_]; $tl_elem = $this->constructor_type[$type_];
} else { } else {
$i = $this->struct->unpack('<i', fread($bytes_io, 4)) [0]; $Idata = fread($bytes_io, 4);
$i = $this->struct->unpack('<i', $Idata) [0];
var_dump(ftell($bytes_io));
if (isset($this->constructor_id[$i])) { if (isset($this->constructor_id[$i])) {
$tl_elem = $this->constructor_id[$i]; $tl_elem = $this->constructor_id[$i];
} else { } else {

6
TL.py
View File

@ -4,6 +4,7 @@ import struct
import json import json
import io import io
from numbers import Number from numbers import Number
from binascii import hexlify
class TlConstructor: class TlConstructor:
def __init__(self, json_dict): def __init__(self, json_dict):
@ -149,8 +150,9 @@ def deserialize(bytes_io, type_=None, subtype=None):
tl_elem = tl.constructor_type[type_] tl_elem = tl.constructor_type[type_]
except KeyError: except KeyError:
# Boxed types # Boxed types
i = struct.unpack('<i', bytes_io.read(4))[0] # read type ID Idata = bytes_io.read(4)
print type_ i = struct.unpack('<i', Idata)[0] # read type ID
print(hexlify(bytes_io.getvalue()))
try: try:
tl_elem = tl.constructor_id[i] tl_elem = tl.constructor_id[i]
except KeyError: except KeyError:

10
composer.lock generated
View File

@ -9,16 +9,16 @@
"packages": [ "packages": [
{ {
"name": "danog/phpstruct", "name": "danog/phpstruct",
"version": "0.4.1", "version": "0.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/danog/PHPStruct.git", "url": "https://github.com/danog/PHPStruct.git",
"reference": "c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca" "reference": "da3d4f5a111823bc5518af054c41f32cce0f221e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/danog/PHPStruct/zipball/c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca", "url": "https://api.github.com/repos/danog/PHPStruct/zipball/da3d4f5a111823bc5518af054c41f32cce0f221e",
"reference": "c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca", "reference": "da3d4f5a111823bc5518af054c41f32cce0f221e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -53,7 +53,7 @@
"struct", "struct",
"unpack" "unpack"
], ],
"time": "2016-07-15 10:56:16" "time": "2016-07-15 13:07:47"
}, },
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",

View File

@ -143,7 +143,7 @@ class Session:
ResPQ = self.method_call('req_pq', nonce=nonce) ResPQ = self.method_call('req_pq', nonce=nonce)
server_nonce = ResPQ['server_nonce'] server_nonce = ResPQ['server_nonce']
exit() exit()
# TODO: selecting RSA public key based on this fingerprint # TODO: selecting RSA public key based on this fingerprint
public_key_fingerprint = ResPQ['server_public_key_fingerprints'][0] public_key_fingerprint = ResPQ['server_public_key_fingerprints'][0]

View File

@ -1,54 +1,4 @@
[ [
{
"name": "danog/phpstruct",
"version": "0.4.1",
"version_normalized": "0.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/danog/PHPStruct.git",
"reference": "c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/danog/PHPStruct/zipball/c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca",
"reference": "c45742bcbc6e1bbf6bdca7b92b65a6b9624853ca",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "5.4.*"
},
"time": "2016-07-15 10:56:16",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"danog\\PHP\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "danog",
"email": "daniil@daniil.it"
}
],
"description": "PHP implementation of python's struct module.",
"homepage": "https://daniil.it/phpstruct",
"keywords": [
"byte",
"bytes",
"pack",
"python",
"struct",
"unpack"
]
},
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
"version": "2.0.2", "version": "2.0.2",
@ -142,5 +92,55 @@
"x.509", "x.509",
"x509" "x509"
] ]
},
{
"name": "danog/phpstruct",
"version": "0.4.2",
"version_normalized": "0.4.2.0",
"source": {
"type": "git",
"url": "https://github.com/danog/PHPStruct.git",
"reference": "da3d4f5a111823bc5518af054c41f32cce0f221e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/danog/PHPStruct/zipball/da3d4f5a111823bc5518af054c41f32cce0f221e",
"reference": "da3d4f5a111823bc5518af054c41f32cce0f221e",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "5.4.*"
},
"time": "2016-07-15 13:07:47",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"danog\\PHP\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "danog",
"email": "daniil@daniil.it"
}
],
"description": "PHP implementation of python's struct module.",
"homepage": "https://daniil.it/phpstruct",
"keywords": [
"byte",
"bytes",
"pack",
"python",
"struct",
"unpack"
]
} }
] ]

1317
vendor/danog/phpstruct/composer.lock generated vendored

File diff suppressed because it is too large Load Diff