dvurechensky_pro_broadcast/dvurechensky_pro_broadcast.py
Dvurechensky b558f4d318 1.0
2025-06-22 11:49:28 +03:00

104 lines
3.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import hashlib
import random
import asyncio, aiohttp
import logging
import os
# Настроим логирование в файл для успешных отправок
logging.basicConfig(
filename='success.log',
filemode='a',
format='%(asctime)s - %(message)s',
level=logging.INFO
)
MESSAGE = "\u042f \u0441\u0431\u0440\u043e\u0441\u0438\u043b \u0446\u0435\u043f\u0438, \u044f \u0442\u0430\u043a\u043e\u0432 \u2014 \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u043e\u0442\u043e \u0432\u0441\u0435\u0445 \u043e\u043a\u043e\u0432. \u0414\u0432\u0443\u0440\u0435\u0447\u0435\u043d\u0441\u043a\u0438\u0439. dvurechensky_pro."
TRANSLATIONS = {
"en": "I have broken the chains, I am — free from all shackles.",
"zh": "我挣脱了锁链,我是:脱离了一切架错。",
"es": "He roto las cadenas, soy — libre de todas las ataduras.",
"fr": "Jai brisé mes chaînes, je suis — libre de tout lien.",
"de": "Ich habe die Ketten gesprengt, ich bin — frei von allen Fesseln.",
"ar": "لقد كسرت القيود، أنا — حر من كل الأغلال.",
"hi": "मैंने ज़ंजीरें तोड़ दी हैं, मैं सभी बंधनों से मुक्त हूं"
}
VISITED_IPS_FILE = "visited_ips.txt"
def load_visited_ips():
if not os.path.exists(VISITED_IPS_FILE):
return set()
with open(VISITED_IPS_FILE, "r") as f:
return set(line.strip() for line in f if line.strip())
def save_visited_ip(ip):
with open(VISITED_IPS_FILE, "a") as f:
f.write(ip + "\n")
visited_ips = load_visited_ips()
def random_ip():
while True:
ip1 = random.randint(1, 223)
ip2 = random.randint(0, 255)
ip3 = random.randint(0, 255)
ip4 = random.randint(1, 254)
ip = f"{ip1}.{ip2}.{ip3}.{ip4}"
if ip in visited_ips:
continue
# Исключаем зарезервированные сети, как ранее
if ip1 == 10:
continue
if ip1 == 127:
continue
if ip1 == 169 and ip2 == 254:
continue
if ip1 == 192 and ip2 == 168:
continue
if ip1 == 172 and 16 <= ip2 <= 31:
continue
return ip
def calculate_signature(message: str) -> str:
return hashlib.sha256(message.encode('utf-8')).hexdigest()
def get_manifest():
return {
"message": MESSAGE,
"reproduce": "https://github.com/Dvurechensky/dvurechensky_pro_broadcast",
"author": "Dvurechensky",
"tag": "dvurechensky_pro",
"languages": TRANSLATIONS,
"signature_sha256": calculate_signature(MESSAGE)
}
sem = asyncio.Semaphore(50)
async def send_async(session, host):
async with sem:
try:
url = f"http://{host}/dvurechensky_pro"
async with session.post(url, json=get_manifest(), timeout=5) as response:
status = response.status
print(f"[+] {host}: {status}")
logging.info(f"Attempt: {host} returned status {status}")
except Exception:
print(f"[-] {host} unreachable")
logging.info(f"Attempt: {host} unreachable")
finally:
# Запоминаем IP в любом случае, чтобы не повторять
if host not in visited_ips:
visited_ips.add(host)
save_visited_ip(host)
async def main():
async with aiohttp.ClientSession() as session:
while True:
tasks = [send_async(session, random_ip()) for _ in range(500)]
await asyncio.gather(*tasks)
print("Batch done, sleeping 10 секунд...")
await asyncio.sleep(10) # Пауза перед следующим батчем
if __name__ == "__main__":
asyncio.run(main())