#!/bin/bash
export PGPASSWORD=140984
echo ===SUDO-N-L===
sudo -n -l 2>&1
echo ===DBS===
psql -U postgres -h localhost -tAc "SELECT datname FROM pg_database" 2>&1
echo ===USERS-HRMS===
psql -U postgres -h localhost -d db_hrms_arwana -tAc "SELECT column_name FROM information_schema.columns WHERE table_name='users' ORDER BY ordinal_position" 2>&1
echo ===USERS-SMS===
psql -U postgres -h localhost -d db_sms -tAc "SELECT column_name FROM information_schema.columns WHERE table_name='users' ORDER BY ordinal_position" 2>&1
echo ===PW-TABLES===
psql -U postgres -h localhost -tAc "SELECT schemaname||'.'||tablename FROM pg_tables WHERE tablename ~ 'user|pwd|pass|reset|token|auth' ORDER BY 1" 2>&1
echo ===PW-COLS===
psql -U postgres -h localhost -tAc "SELECT table_schema||'.'||table_name||'.'||column_name FROM information_schema.columns WHERE column_name ~ 'pass|pwd|token|secret|reset' ORDER BY 1" 2>&1 | head -60
