def main(ip: str, port: int, only_api: bool = False, disable_updates: bool = False): if sys.platform == "win32": loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) app.state.only_api = only_api if not disable_updates: try: logger.info("Checking for updates") version = pkg_resources.get_distribution("db0mb3r").version updates = get("http://dmitry.darkhost.pro/db0mb3r.version", timeout=7) if updates.status_code == 200: values = updates.text.split("\n", maxsplit=1) if version == values[0]: logger.success("No update required") else: logger.info("Downloading an update using pip") pip._internal.main(["install", "--upgrade", "db0mb3r==" + values[0]]) logger.success("db0mb3r updated, changes will take effect after restart") print("\nChanges {}:\n{}\n".format(*values)) os.chdir(os.path.join(pkg_resources.get_distribution("db0mb3r").location, "db0mb3r")) else: logger.error("db0mb3r service could not provide the latest version") except: logger.error("Failed to check the latest updates") prepare_services() if not only_api: open_url(f"http://{ip}:{port}/") uvicorn.run(app, host=ip, port=port, log_level="error")
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() if not only_api: open_url(f"http://{ip}:{port}/") uvicorn.run(app, host=ip, port=port, log_level="error")
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(f"Starting attack {self.attack_id} on +{self.phone}...") for cycle in range(self.number_of_cycles): logger.info( f"Started cycle {cycle + 1} of attack {self.attack_id}") 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(f"Attack {self.attack_id} on +{self.phone} ended")
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 )