2015-02-26 12:46:38 +01:00
|
|
|
# -*- 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-02-26 12:46:38 +01:00
|
|
|
|
2015-03-11 23:52:26 +01:00
|
|
|
Session = mtproto.Session(ip, port)
|
2015-03-12 01:17:43 +01:00
|
|
|
x = Session.method_call('req_pq', nonce=os.urandom(16))
|
2015-02-26 12:46:38 +01:00
|
|
|
|
|
|
|
PQ = int.from_bytes(x['pq'], 'big')
|
|
|
|
[p, q] = prime.primefactors(PQ)
|
|
|
|
|
|
|
|
print("PQ = %d\np = %d, q = %d" % (PQ, p, q))
|