print("counter user name in messenger:" + userInfo["data"]["full_name"]) print("\ncurl command to veify it: ------") print(result[1]) print("\n end ----") if (cmd == '1'): key = RSA.generate(1024) pubkey = key.publickey() print(key.exportKey()) print(pubkey.exportKey()) private_key = key.exportKey() session_key = pubkeyContent(pubkey.exportKey()) # print(session_key) print(session_key.decode()) userInfo = mixinApiBotInstance.createUser(session_key.decode(), "Tom Bot") print(userInfo.get("data").get("user_id")) with open('new_users.csv', 'a', newline='') as csvfile: csvwriter = csv.writer(csvfile) csvwriter.writerow([ private_key.decode(), userInfo.get("data").get("pin_token"), userInfo.get("data").get("session_id"), userInfo.get("data").get("user_id"), PIN ]) mixinApiNewUserInstance = generateMixinAPI( private_key.decode(), userInfo.get("data").get("pin_token"), userInfo.get("data").get("session_id"), userInfo.get("data").get("user_id"), PIN, "") pinInfo = mixinApiNewUserInstance.updatePin(PIN, "")
from Crypto.PublicKey import RSA from mixin_api import MIXIN_API # from random_word import RandomWords import mixin_config import json def pubkeyContent(inputContent): contentWithoutHeader = inputContent[len("-----BEGIN PUBLIC KEY-----") + 1:] contentWithoutTail = contentWithoutHeader[:-1 * ( len("-----END PUBLIC KEY-----") + 1)] contentWithoutReturn = contentWithoutTail[:64] + contentWithoutTail[ 65:129] + contentWithoutTail[130:194] + contentWithoutTail[195:] return contentWithoutReturn mixin_api = MIXIN_API(mixin_config) key = RSA.generate(1024) pubkey = key.publickey() print(key.exportKey()) print(pubkey.exportKey()) private_key = key.exportKey() session_key = pubkeyContent(pubkey.exportKey()) # print(session_key) print(session_key.decode()) userInfo = mixin_api.createUser(session_key.decode(), "Tom Bot") print(userInfo) # r = RandomWords() # r.get_random_word()
snapShotID) if (cmd == 'create'): key = RSA.generate(1024) pubkey = key.publickey() print(key.exportKey()) print(pubkey.exportKey()) private_key = key.exportKey() session_key = pubkeyContent(pubkey.exportKey()) # print(session_key) input_session = session_key.decode() account_name = "Tom Bot" print(session_key.decode()) body = {"session_secret": input_session, "full_name": account_name} token_from_freeweb = mixinApiBotInstance.fetchTokenForCreateUser( body, "http://freemixinapptoken.myrual.me/token") userInfo = mixinApiBotInstance.createUser(input_session, account_name, token_from_freeweb) print(userInfo.get("data").get("user_id")) with open('new_users.csv', 'a', newline='') as csvfile: csvwriter = csv.writer(csvfile) csvwriter.writerow([ private_key.decode(), userInfo.get("data").get("pin_token"), userInfo.get("data").get("session_id"), userInfo.get("data").get("user_id"), "" ]) mixinApiNewUserInstance = generateMixinAPI( private_key.decode(), userInfo.get("data").get("pin_token"), userInfo.get("data").get("session_id"), userInfo.get("data").get("user_id"), "", "") defauled_pin = input("input pin:")