Spaces:
Sleeping
Sleeping
Piers Lyon
Claude Opus 4.6 (1M context)
Add auth, audit logging, backup/restore, and HF Spaces deployment
560b4ce Download scripts/generate_password_hashes.py from mipwr-admin/curium-intel: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/spaces/mipwr-admin/curium-intel/resolve/main/scripts/generate_password_hashes.py
- Command line
-
hf download hf://spaces/mipwr-admin/curium-intel/scripts/generate_password_hashes.py
-
curl -L -o generate_password_hashes.py https://huggingface.co/spaces/mipwr-admin/curium-intel/resolve/main/scripts/generate_password_hashes.py
1.94 kB
| """ | |
| Generate bcrypt password hashes for ADMIN and VIEWER accounts. | |
| Usage: | |
| python scripts/generate_password_hashes.py | |
| Run this LOCALLY only. Paste the resulting hashes into Azure Container App | |
| environment variables (or your local .env). Plain passwords are never stored | |
| or logged anywhere. | |
| """ | |
| import getpass | |
| import sys | |
| try: | |
| import bcrypt | |
| except ImportError: | |
| sys.exit("bcrypt not installed. Run: pip install bcrypt") | |
| def make_hash(label: str) -> tuple[str, str]: | |
| print(f"\n--- {label} account ---") | |
| username = input("Username: ").strip() | |
| while True: | |
| pw1 = getpass.getpass("Password: ") | |
| pw2 = getpass.getpass("Confirm: ") | |
| if pw1 != pw2: | |
| print("Passwords don't match. Try again.") | |
| continue | |
| if len(pw1) < 8: | |
| print("Use at least 8 characters.") | |
| continue | |
| break | |
| hashed = bcrypt.hashpw(pw1.encode("utf-8"), bcrypt.gensalt(rounds=12)).decode("utf-8") | |
| return username, hashed | |
| def main(): | |
| print("=" * 60) | |
| print(" Curium Lead Intelligence \u2014 password hash generator") | |
| print("=" * 60) | |
| print("This generates bcrypt hashes you can safely paste into Azure") | |
| print("environment variables. Plain passwords stay only in your head.\n") | |
| admin_user, admin_hash = make_hash("ADMIN (full access, can run hunts)") | |
| viewer_user, viewer_hash = make_hash("VIEWER (shared read-only login)") | |
| print("\n" + "=" * 60) | |
| print(" Paste these into Azure Container App > Settings > Secrets") | |
| print(" (or your local .env file) \u2014 then restart the app.") | |
| print("=" * 60) | |
| print(f"ADMIN_USERNAME={admin_user}") | |
| print(f"ADMIN_PASSWORD_HASH={admin_hash}") | |
| print(f"VIEWER_USERNAME={viewer_user}") | |
| print(f"VIEWER_PASSWORD_HASH={viewer_hash}") | |
| print("=" * 60) | |
| print("\nDone. Store the plain passwords in a password manager (e.g. 1Password).") | |
| if __name__ == "__main__": | |
| main() | |