Untitled

 avatar
unknown
python
2 years ago
5.7 kB
6
Indexable
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

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")


def sigg(data):
    member = 'gAAAAABjocmvwNUEzkLbiC6YS2ZRbuPOqgcEvp_tzf7fUXVPHSsdCOrlG3V3HXtpoeVspZ1csYifutdEjcdCk387ogv6mTidPUzUXSv7EiiyT5TNrQT21_Uvcx-MeigBJzoXRdMeW0sonh_eWZUusLWuO_IXS_4nDw=='
    return requests.get(f'https://amino-apps.software/signature/member/{member}/data/{data}').json()['signature']

    
def dev():
    data = uuid4().bytes
    return ("52" + data.hex() + hmac.new(bytes.fromhex("AE49550458D8E7C51D566916B04888BFB8B3CA7D"),bytes.fromhex("52") + data, hashlib.sha1).hexdigest()).upper()

 
api="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"https://service.aminoapps.com/api/v1/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"]=sigg(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 = {
            #"NDCDEVICEID": '223B063D54BEB7463B92A073735DB6F26EFD413010CCF78271F5953F8BB9010FCFF94D3FF917CB98DE',
            "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:
        	proxies = {
  'http': 'http://qlgv6:dyui6qsl@154.13.49.143:5432',
  'https': 'http://qlgv6:dyui6qsl@154.13.49.143:5432'
}


    

        	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
Editor is loading...