From 8310fd19b686d868d628653bf2ecb179dfb87c62 Mon Sep 17 00:00:00 2001 From: n0mad1k Date: Thu, 30 Apr 2026 22:40:40 -0400 Subject: [PATCH] Gate WEBRUNNER menu on available provider credentials Show deployment option only when at least one provider has credentials configured. Checks LINODE_TOKEN/FLOKINET_API_KEY via Infisical and AWS creds via env. Displays setup instructions when nothing is found rather than letting the user launch a deployment that will immediately fail at provisioning. --- modules/webrunner/deploy_webrunner.py | 56 ++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/modules/webrunner/deploy_webrunner.py b/modules/webrunner/deploy_webrunner.py index 15dddaa..5cfd447 100644 --- a/modules/webrunner/deploy_webrunner.py +++ b/modules/webrunner/deploy_webrunner.py @@ -36,17 +36,71 @@ PROVIDER_LABELS = {'linode': 'Linode', 'aws': 'AWS', 'flokinet': 'FlokiNET'} # ── menu ────────────────────────────────────────────────────────────────────── +def _available_providers() -> list[str]: + """Return providers that have credentials available.""" + import subprocess + available = [] + creds_bin = os.path.expanduser('~/.local/bin/creds') + + # Linode — check env first, then Infisical + if os.environ.get('LINODE_TOKEN'): + available.append('linode') + else: + try: + token = subprocess.check_output( + [creds_bin, 'get', 'LINODE_TOKEN', 'homelab'], + text=True, stderr=subprocess.DEVNULL, + ).strip() + if token: + available.append('linode') + except Exception: + pass + + # AWS + if os.environ.get('AWS_ACCESS_KEY_ID') and os.environ.get('AWS_SECRET_ACCESS_KEY'): + available.append('aws') + + # FlokiNET + if os.environ.get('FLOKINET_API_KEY'): + available.append('flokinet') + else: + try: + key = subprocess.check_output( + [creds_bin, 'get', 'FLOKINET_API_KEY', 'homelab'], + text=True, stderr=subprocess.DEVNULL, + ).strip() + if key: + available.append('flokinet') + except Exception: + pass + + return available + + def webrunner_menu(): while True: clear_screen() print_banner() print(f"{COLORS['CYAN']}WEBRUNNER — Distributed Geo-Targeted Recon{COLORS['RESET']}") print(f"{COLORS['CYAN']}==========================================={COLORS['RESET']}") - print(f"1) New Scan Deployment") + + available = _available_providers() + if available: + providers_str = ', '.join(PROVIDER_LABELS[p] for p in available) + print(f"1) New Scan Deployment [{providers_str}]") + else: + print(f"{COLORS['YELLOW']} No provider credentials found.{COLORS['RESET']}") + print(f" Set a token in Infisical to enable deployments:") + print(f" creds set LINODE_TOKEN homelab") + print(f"\n99) Return to Main Menu") choice = input(f"\nSelect: ").strip() if choice == "1": + if not available: + print(f"{COLORS['RED']}No credentials configured. Add a provider token first.{COLORS['RESET']}") + wait_for_input() + continue config = gather_webrunner_parameters() if config: execute_webrunner_deployment(config)