Untitled
unknown
plain_text
10 months ago
5.8 kB
3
Indexable
Never
import json import requests from time import time as timestamp from binascii import hexlify from os import path from uuid import UUID from uuid import uuid4 import random from os import urandom import names from hashlib import sha1 from functools import reduce from base64 import b85decode, b64decode import random import requests import base64 import hmac from typing import Optional, Dict, Tuple, Union, TypeVar import hashlib import platform,socket,re,uuid from base64 import b64encode, b64decode from contextlib import suppress from functools import reduce from hashlib import sha1 from imghdr import what from hmac import new from typing import Union PREFIX = bytes.fromhex("52") SIG_KEY = bytes.fromhex("EAB4F1B9E3340CD1631EDE3B587CC3EBEDF1AFA9") DEVICE_KEY = bytes.fromhex("AE49550458D8E7C51D566916B04888BFB8B3CA7D") def sig(data: Union[str, bytes]) -> str: data = data if isinstance(data, bytes) else data.encode("utf-8") return b64encode(PREFIX + new(SIG_KEY, data, sha1).digest()).decode("utf-8") ip="0.tcp.in.ngrok.io" port="12552" def dev(device_info: Optional[str] = None) -> str: DEV_KEY = bytes.fromhex("E7309ECC0953C6FA60005B2765F99DBBC965C8E9") PREFIX = "19" PREFIX_BYTES = bytes.fromhex(PREFIX) device_info = urandom(20) if device_info is None else device_info mac = new(DEV_KEY, PREFIX_BYTES + device_info, sha1) return f"{PREFIX}{device_info.hex()}{mac.hexdigest()}".upper() def sig2(data: str): SIG_KEY = bytes.fromhex("DFA5ED192DDA6E88A12FE12130DC6206B1251E44") PREFIX = "19" PREFIX_BYTES = bytes.fromhex(PREFIX) signature = b64encode( PREFIX_BYTES + new(SIG_KEY, data.encode("utf-8"), sha1).digest()).decode("utf-8") return signature api="https://proxy2.yato69.workers.dev/proxy?url=https://service.aminoapps.com/api/v1" def link_code(code): headers = { #"NDCDEVICEID": '223B063D54BEB7463B92A073735DB6F26EFD413010CCF78271F5953F8BB9010FCFF94D3FF917CB98DE', "Accept-Language": "en-US", "Content-Type": "application/json; charset=utf-8", "User-Agent": 'Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G973N Build/beyond1qlteue-user 5; com.narvii.amino.master/3.4.33562)', #"Host": "service.aminoapps.com", "Accept-Encoding": "gzip", "Connection": "Keep-Alive" } #headers["NDCAUTH"] = f"sid={sid}" headers["NDCDEVICEID"]=dev() #print(headers) response = requests.get(f"{api}/g/s/link-resolution?q={code}", headers=headers).json()["linkInfoV2"]["extensions"]["linkInfo"] return response def collect(sid:str,coins:int,comId:str,blogId: str = None, chatId: str = None, objectId: str = None,proxy:bool=False): headers = { #"NDCDEVICEID": '223B063D54BEB7463B92A073735DB6F26EFD413010CCF78271F5953F8BB9010FCFF94D3FF917CB98DE', "Accept-Language": "en-US", "Content-Type": "application/json; charset=utf-8", "User-Agent": "Apple iPhone13,4 iOS v15.6.1 Main/3.12.9", #"Host": "service.aminoapps.com", "Accept-Encoding": "gzip", "Connection": "Keep-Alive" } headers["NDCAUTH"] = f"sid={sid}" headers["NDCDEVICEID"]=dev() #print(headers) transactionId = str(UUID(hexlify(urandom(16)).decode('ascii'))) data = { "coins": coins, "tippingContext": {"transactionId": transactionId}, "timestamp": int(timestamp() * 1000) } headers["Content-Length"] = str(len(data)) if blogId is not None: url = f"{api}/x{comId}/s/blog/{blogId}/tipping" if chatId is not None: url = f"{api}/x{comId}/s/chat/thread/{chatId}/tipping" if objectId is not None: data["objectId"] = objectId data["objectType"] = 2 url = f"{api}/x{comId}/s/tipping" data = json.dumps(data) headers["NDC-MSG-SIG"]=sig2(data) #print(headers) if proxy is True: proxies = { 'http': 'http://qlgv6:dyui6qsl@154.13.49.143:5432', 'https': 'http://qlgv6:dyui6qsl@154.13.49.143:5432' } response = requests.post(url, headers=headers, data=data,proxies=proxies) else: response = requests.post(url, headers=headers, data=data) resp=json.loads(response.text) #print(resp) if resp['api:message']=='OK': print(f'collected {coins}') else: print(resp['api:message']) print(f'--X {coins} X--') def login_custom(email: str, secret: str,proxy:bool=False): headers = { "Accept-Language": "en-US", "Content-Type": "application/json; charset=utf-8", "User-Agent": 'Dalvik/2.1.0 (Linux; U; Android 7.1; LG-UK495 Build/MRA58K; com.narvii.amino.master/3.4.33587)', # "Host": "service.narvii.com", "Accept-Encoding": "gzip", "Connection": "Keep-Alive" } data = json.dumps({ "email": email, # "phoneNumber":email, "v": 2, "secret":f"{secret}", "deviceID":dev(), "clientType": 100, "action": "normal", "timestamp": int(timestamp() * 1000) }) headers["NDC-MSG-SIG"]=sig(data) headers["NDCDEVICEID"]=dev() #print(headers) if proxy is True: print("tur") response = requests.post(f"{api}/g/s/auth/login", headers=headers,proxies=proxies, data=data) #print(response.text) else: response = requests.post(f"{api}/g/s/auth/login", headers=headers, data=data) resp=json.loads(response.text) #print(resp) if resp["api:statuscode"]==0: #sec=resp["secret"] sid=resp['sid'] else: print(resp) return sid