Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions bot/core/tapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import asyncio, random
from time import time
from random import randint
from datetime import datetime
Expand Down Expand Up @@ -472,7 +472,13 @@ async def run(self, proxy: str | None):
continue

http_client.headers["Authorization"] = f"Bearer {access_token}"

ip="%s.%s.%s.%s"%(random.randint(1,225),random.randint(1,225),random.randint(1,225),random.randint(1,225))
http_client.headers['X-Forwarded-For'] = ip
http_client.headers['X-Forwarded-Host']= ip
http_client.headers['X-Client-IP'] = ip
http_client.headers['X-Remote-IP'] = ip
http_client.headers['X-Remote-Addr'] = ip
http_client.headers['X-Host'] = ip
access_token_created_time = time()

await self.get_telegram_me(http_client=http_client)
Expand Down Expand Up @@ -705,6 +711,13 @@ async def run(self, proxy: str | None):
raise error
else:
logger.error(f"{self.session_name} | ⚠ Warning! Invalid protocol detected in {error}")
ip="%s.%s.%s.%s"%(random.randint(1,225),random.randint(1,225),random.randint(1,225),random.randint(1,225))
http_client.headers['X-Forwarded-For'] = ip
http_client.headers['X-Forwarded-Host']= ip
http_client.headers['X-Client-IP'] = ip
http_client.headers['X-Remote-IP'] = ip
http_client.headers['X-Remote-Addr'] = ip
http_client.headers['X-Host'] = ip
await asyncio.sleep(delay=randint(a=3, b=7))

except InvalidSession as error:
Expand Down