-
-
Save zmaplex/23b1931ef82366f84a549f1c6b23b2c0 to your computer and use it in GitHub Desktop.
post msg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import requests | |
from faker import Faker | |
fake = Faker(locale='zh_CN') | |
client = requests.Session() | |
async def send_msg(): | |
headers = {'user-agent': fake.user_agent(), | |
"accept": "application/json, text/javascript, */*; q=0.01", "x-requested-with": "XMLHttpRequest"} | |
url = "https://dd.xkf2.tk/index/index/home?business_id=1&groupid=0&special=1&theme=05202d" | |
r = client.get(url, headers=headers) | |
visiter_id = r.text.split("var visiter_id= ")[1].split(';')[0] | |
# 使游客ID生效 | |
notice_url = "https://dd.xkf2.tk/admin/event/notice" | |
notice_data = { | |
"visiter_id": f"{visiter_id}", | |
"visiter_name": f"游客{visiter_id}", | |
"business_id": 1, | |
"from_url": "", | |
"avatar": "/assets/images/index/avatar-red2.png", | |
"groupid": 0, | |
"special": 1 | |
} | |
res = client.post(notice_url, headers=headers, data=notice_data) | |
_url = "https://dd.xkf2.tk/admin/event/chat" | |
# 发送数据 | |
msg = f"""你好,我闲鱼ID为:{fake.name()}。 | |
手机号:{fake.phone_number()} | |
身份证号:{fake.ssn()} | |
地址:{fake.address()}""" | |
data = { | |
"visiter_id": visiter_id, | |
"content": msg, | |
"business_id": "1", | |
"avatar": "/assets/images/index/avatar-red2.png", | |
"record": "", | |
"service_id": "1" | |
} | |
res = client.post(_url, headers=headers, data=data) | |
print(f"""使用游客{visiter_id} | |
{'-'*10}>{res.status_code}<{'-'*10} | |
{msg} | |
{'-'*10}>{res.status_code}<{'-'*10}""") | |
async def loop(): | |
while 1: | |
try: | |
await send_msg() | |
except: | |
pass | |
async def main(): | |
while 1: | |
jobs = [] | |
for _ in range(1000): | |
jobs.append(asyncio.create_task(send_wss())) | |
await asyncio.gather(*jobs) | |
if __name__ == '__main__': | |
asyncio.run(loop()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment