def main(ip: str, port: int, only_api: bool = False): if sys.platform == "win32": loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) app.state.only_api = only_api prepare_services() uvicorn.run(app, host=ip, port=port, log_level="error")
async def perform_attack( attack_id: str, number_of_cycles: int, country_code: int, phone: str ): services = prepare_services() usable_services = services.get(country_code, services["other"]) status[attack_id]["started_at"] = datetime.now().isoformat() status[attack_id]["end_at"] = len(usable_services) * number_of_cycles logger.info(f"Starting attack {attack_id} on +{phone}...") for cycle in range(number_of_cycles): logger.info(f"Started cycle {cycle + 1} of attack {attack_id}") tasks = [ await_with_callback( service(phone, country_code).run(), update_count, attack_id=attack_id, ) for service in usable_services ] for task in asyncio.as_completed(tasks): await task logger.success(f"Attack {attack_id} on +{phone} ended")
async def _perform_attack(self): services = prepare_services() usable_services = services.get(self.country_code, services["other"]) status[self.attack_id]["started_at"] = datetime.now().isoformat() status[self.attack_id]["end_at"] = len( usable_services) * self.number_of_cycles logger.info("") for cycle in range(self.number_of_cycles): logger.info("") tasks = [ await_with_callback( service(self.phone, self.country_code).run(), update_count, attack_id=self.attack_id, ) for service in usable_services ] for task in asyncio.as_completed(tasks): await task logger.success("")
def get_services_count(country_code: Union[ int, str] # It will be str if user have selected "Not listed" country ): services = prepare_services() if country_code in services: return {"count": len(services[country_code])} return {"count": len(services["other"])}
def index(request: Request): if request.app.state.only_api: raise HTTPException(status_code=404) services = prepare_services() return templates.TemplateResponse( "index.html", { "request": request, "service_count": len(services[7]), }, # 7 corresponds to Russia which is a default choice )