Files
pharmacy_dashboard/scratch/list_all_users.py
T
2026-11-24 12:07:35 +05:30

23 lines
698 B
Python

import sqlite3
from werkzeug.security import check_password_hash
conn = sqlite3.connect('users.db')
c = conn.cursor()
c.execute("SELECT id, username, password, is_admin FROM users ORDER BY id")
users = c.fetchall()
candidates = [
'dmh123', 'TestPass123!', 'password', 'password123', 'admin', 'admin123', '123456'
]
print(f"{'ID':<4} | {'Username':<18} | {'Role':<10} | {'Password'}")
print("-" * 55)
for uid, uname, phash, is_adm in users:
role = "ADMIN" if is_adm else "Staff/User"
matched = "Unknown"
for cand in candidates:
if check_password_hash(phash, cand):
matched = cand
break
print(f"{uid:<4} | {uname:<18} | {role:<10} | {matched}")