Files
rengine/shared/services/proxy_resolve.py
T
Yogesh Ojha 1945242c1b feat: implement scan scheduling functionality
- Added new types and interfaces for scan scheduling in the frontend.
- Created a new Svelte page for managing scheduled scans, including listing, creating, editing, and deleting schedules.
- Implemented backend models and services for scan schedules, including handling different schedule types (one-off, interval, daily, cron).
- Introduced a Celery task to manage the execution of scheduled scans based on their defined timing.
- Enhanced notification system to include alerts for newly discovered subdomains during scans.
- Added utility functions for handling time zones and scheduling logic.
2026-06-24 08:10:21 +05:30

28 lines
827 B
Python

import json
from shared.models.proxy import Proxy, ProxyEndpoint
from shared.utils.crypto import try_decrypt
def load_proxy_endpoints(proxy: Proxy) -> list[ProxyEndpoint]:
raw = try_decrypt(proxy.endpoints_encrypted)
if not raw:
return []
return [ProxyEndpoint(**e) for e in json.loads(raw)]
def build_proxy_url(ep: ProxyEndpoint) -> str:
if ep.username:
cred = f"{ep.username}:{ep.password}@" if ep.password else f"{ep.username}@"
return f"{ep.scheme}://{cred}{ep.host}:{ep.port}"
return f"{ep.scheme}://{ep.host}:{ep.port}"
def resolve_proxy_url(proxy: Proxy | None) -> str | None:
if proxy is None or not proxy.is_active:
return None
endpoints = load_proxy_endpoints(proxy)
if not endpoints:
return None
return build_proxy_url(endpoints[0])