coin gen

mail@pastecode.io avatar
unknown
python
2 years ago
9.8 kB
4
Indexable
Never
parameters = {
    "community-link": "http://aminoapps.com/c/anime-es"
}

import os
import time
import json
import hmac
import base64
import random
from hashlib import sha1
import names
import heroku3
import platform,socket,re,uuid
import threading
try:
    import requests
    from flask import Flask
    from json_minify import json_minify
except:
    os.system("pip3 install requests flask json_minify")
finally:
    import requests
    from flask import Flask
    from json_minify import json_minify

from threading import Thread
from uuid import uuid4
appi="https://coinsig121.herokuapp.com"

key="967e107a-b0cf-45fe-8dbe-886a0fb0d6a2"
name="coinsig121"
def res():
    heroku_conn = heroku3.from_key(key)
    botapp= heroku_conn.apps()[name]
    botapp.restart()

class Client:
    def __init__(self):
        self.api = "https://service.narvii.com/api/v1"
        #self.comId=None
        self.device_Id = self.generate_device_Id()
        self.headers = {"NDCDEVICEID": self.device_Id, "SMDEVICEID": "b89d9a00-f78e-46a3-bd54-6507d68b343c", "Accept-Language": "en-EN", "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.narvii.com", "Accept-Encoding": "gzip", "Connection": "Keep-Alive"}
        self.sid, self.auid = None, None

    def generate_signature_message(self,data):
        key=' f8e7a61ac3f725941e3ac7cae2d688be97f30b93'
        mac = hmac.new(bytes.fromhex(key), data.encode("utf-8"), sha1)
        digest = bytes.fromhex("42") + mac.digest()
        p= base64.b64encode(digest).decode("utf-8")
        self.headers["NDC-MSG-SIG"] = p
        return p

    def get_c(self,comId: str):
        response = requests.get(f"https://service.narvii.com/api/v1/g/s-x{comId}/community/info?withInfluencerList=1&withTopicList=true&influencerListOrderStrategy=fansCount", headers=self.headers)
        return json.loads(response.text)["community"]["joinType"]
    def random_community(self,search:str,size: int = 25):
        response=requests.get(f"{self.api}/g/s/community/search?q={search}&language=en&completeKeyword=1&start=0&size={size}",headers=self.headers)
        if response.status_code == 200:
            com=[]
            r=response.json()["communityList"]
            for listt in r:
                #print(listt["ndcId"])
                try:
                  type=self.get_c(listt["ndcId"])
                  #print(type)
                  if type ==0:
                    com.append(listt["ndcId"])
                except:
                  pass
            
            return com
        else:
            return "ff"

    def generate_device_Id(self):
        hw=(names.get_full_name()+str(random.randint(0,10000000))+platform.version()+platform.machine()+names.get_first_name()+socket.gethostbyname(socket.gethostname())+':'.join(re.findall('..', '%012x' % uuid.getnode()))+platform.processor())
        identifier=sha1(hw.encode('utf-8')).digest()
        key='02b258c63559d8804321c5d5065af320358d366f'
        mac = hmac.new(bytes.fromhex(key), b"\x42" + identifier, sha1)
        return (f"42{identifier.hex()}{mac.hexdigest()}").upper()

    def login(self, email: str, password: str):
        data={
       "email":email,
       "password":password}
        data=json.dumps(data)
        response=requests.post(f"https://coinhkjhkj77.herokuapp.com/secret",data=data)
        resp=response.json()
        if resp["api:statuscode"]==69 or resp["api:statuscode"]==110:
          print(resp["api:message"])
          time.sleep(7)
          res=requests.post(f"https://coinhkjhkj77.herokuapp.com/secret",data=data).json()
          try: self.sid, self.auid = res["sid"], res["auid"]
          except: pass
          return res
        else:
          
          #print(resp)
          try: self.sid, self.auid = resp["sid"], resp["auid"]
          except: pass
          return resp
        
        

    def send_active_object(self, comId: int,timers: list = None, tz: int = -time.timezone // 1000):
        data = {"timestamp": int(time.time() * 1000), "optInAdsFlags": 2147483647, "timezone": tz}
        #data={}
        if timers: data["userActiveTimeChunkList"] = timers
        data = json.dumps(data)
        #print(data)
        self.generate_signature_message(data = data)
        #print(data)
        #print(self.headers)
        response = requests.post(f"https://coinsig121.herokuapp.com/{comId}/send-active-obj/{self.sid}", data = data)
        try:
            if response.json()["api:statuscode"]==69 or response.json()["api:statuscode"]==110:
                print(response.json()["api:message"])
                time.sleep(7)
                res=requests.post(f"https://coinsig121.herokuapp.com/{comId}/send-active-obj/{self.sid}", data = data)
                print(res.text)
                return res
            else:
                print(response.text)
                return response.json()
        except:
            pass
        #return request.json()

    def watch_ad(self): return requests.post(f"{self.api}/g/s/wallet/ads/video/start?sid={self.sid}", headers = self.headers).json()

    def get_from_link(self, link: str): return requests.get(f"{self.api}/g/s/link-resolution?q={link}", headers = self.headers).json()

    def lottery(self, comId, time_zone: str = -int(time.timezone) // 1000):
        data = json.dumps({"timezone": time_zone, "timestamp": int(time.time() * 1000)})
        self.generate_signature_message(data = data)
        request = requests.post(f"{self.api}/x{comId}/s/check-in/lottery?sid={self.sid}", data = data, headers = self.headers)
        return request.json()
    def leave_community(self, comId: int):
        data = {"timestamp": int(time.time() * 1000)}
        data = json.dumps(data)
        self.generate_signature_message(data=data)
        request = requests.post(f"{self.api}/x{comId}/s/community/leave?sid={self.sid}", data = data, headers = self.headers)
        return request.json()

    def join_community(self, comId: int, inviteId: str = None):
        data = {"timestamp": int(time.time() * 1000)}
        if inviteId: data["invitationId"] = inviteId
        data = json.dumps(data)
        self.generate_signature_message(data=data)
        request = requests.post(f"{self.api}/x{comId}/s/community/join?sid={self.sid}", data = data, headers = self.headers)
        return request.json()

class App:
    def __init__(self):
        self.client = Client()
        #xtensions =self.client.random_community(search="sports",size=20)
        #self.comId = extensions
        try: self.invitationId = None
        except: pass

    def tzc(self): return int("+300")

    def generation(self, email: str, password: str,comId):
        try:
            pp=self.client.login(email = email, password = password)
            if pp['api:statuscode'] == 0:
              print(f"\n[\033[1;31mcoins-generator\033[0m][\033[1;34mlogin\033[0m][{email}")
              
              #@extensions =threading.Thread(target=self.client.random_community,args=["anime",30]).start()
              #self.comId = "225882757"
              #print(self.comId)
              ip=self.client.join_community(comId = comId, inviteId = self.invitationId)['api:statuscode']
              if ip==814:
                  return "ban"
              if ip!=814:
                print("joined")
              #print(f"[\033[1;31mcoins-generator\033[0m][\033[1;32mlottery\033[0m]: {self.client.lottery(comId = self.comId, time_zone = self.tzc())['api:message']}")
                for i2 in range(24):
                    #time.sleep(3)
                    timers=[{'start': int(time.time()), 'end': int(time.time()) + 300} for _ in range(50)]
                    #self.client.send_active_object(self.comId, timers,self.tzc())
                    try: self.client.send_active_object(comId, timers,self.tzc())
                    except: pass
                    #print(f"[\033[1;31mcoins-generator\033[0m][\033[1;25;32mend\033[0m][{email}]: Finished.")
                res()
                self.client.leave_community(comId = comId)
                time.sleep(1)
                return "ok"
            else:
              print(pp['api:message'])
              return "ok"
              #res()
              #self.client.leave_community(comId = self.comId)
              #time.sleep(4)
        except Exception as error: print(f"[\033[1;31mC01?-G3?3R4?0R\033[0m]][\033[1;31merror\033[0m]]: {error}")
        time.sleep(4)
        return "ok"

    def run(self):
        print("COIN GENERATOR ")
        #emails=[]
        with open("ccc.json", "r") as emails:
            emails = json.load(emails)
            print(f"{len(emails)} Accounts loaded")
            list=self.client.random_community("bts",30)
            print(list)
            for account in emails:
                try:
                    no=int(len(list))
                    nn=no-2
                    p=random.randint(0,nn)
                    com=list[p]
                    
                except:
                    com="25347737"
                    pass
                print(com)
                self.client.device_Id = account["device"]
                self.client.headers["NDCDEVICEID"] = self.client.device_Id
                
                
                re=self.generation(email = account["email"], password = account["secret"],comId=com)
                if re=="ban":
                    list.remove(com)
                    

if __name__ == "__main__":
    #Thread(target=run).start()
    App().run()