示例#1
0
文件: log.py 项目: GXSTIEAR/spammer
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")
示例#2
0
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")
示例#3
0
    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("")
示例#4
0
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"])}
示例#5
0
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
    )