MadelineProto/testing.py

19 lines
435 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
import mtproto
import os
import prime
2015-03-11 23:52:26 +01:00
import configparser
config = configparser.ConfigParser()
config.read('credentials')
ip = config['App data']['ip_address']
port = config['App data'].getint('port')
2015-03-11 23:52:26 +01:00
Session = mtproto.Session(ip, port)
x = Session.method_call('req_pq', nonce=os.urandom(16))
PQ = int.from_bytes(x['pq'], 'big')
[p, q] = prime.primefactors(PQ)
print("PQ = %d\np = %d, q = %d" % (PQ, p, q))