From 998ae6c78f7fa66c58d448ad2ea6739609181296 Mon Sep 17 00:00:00 2001 From: Randy Dev Date: Fri, 4 Oct 2024 22:00:51 +0700 Subject: [PATCH] _ --- RyuzakiLib/hackertools/alldownloader.py | 34 ++----------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/RyuzakiLib/hackertools/alldownloader.py b/RyuzakiLib/hackertools/alldownloader.py index 3d67069..5829b5b 100644 --- a/RyuzakiLib/hackertools/alldownloader.py +++ b/RyuzakiLib/hackertools/alldownloader.py @@ -5,8 +5,6 @@ import httpx import requests import wget -from fastapi import HTTPException - class DictToObj: def __init__(self, dictionary): @@ -25,40 +23,12 @@ class AkenoPlus: def __init__( self, key: str = None, - api_endpoint: str = "https://private-akeno.randydev.my.id", - issue: bool = False, - ip_unban=None + api_endpoint: str = "https://private-akeno.randydev.my.id" ): - self.issue = issue + self.api_endpoint = api_endpoint self.headers = {"x-akeno-key": key} - if isinstance(ip_unban, str): - self.ip_unban = [ip_unban] - elif isinstance(ip_unban, list): - self.ip_unban = ip_unban - else: - self.ip_unban = [] - - async def all_blacklist(self): - async with httpx.AsyncClient() as client: - try: - response = await client.get(f"{self.api_endpoint}/blacklist/list-ip/", headers=self.headers) - response.raise_for_status() - return response.json()["blacklisted_ips"] - except httpx.HTTPStatusError: - return [] - except Exception: - return [] - - async def call_next(self, request, call_next): - banned_ips = await self.all_blacklist() - client_ip = request.headers.get("X-Real-IP") or request.client.host - if self.issue and client_ip in banned_ips and client_ip not in self.ip_unban: - raise HTTPException(status_code=403, detail="Your IP is banned.") - response = await call_next(request) - return response - async def download_now(self, data): return wget.download(data)