Databases
Database
Ms-sql
Command
Description
SELECT @@version
Database version
EXEC xp_msver
version details
EXEC master..xp_cmdshell 'net user'
Run operating system command
SELECT HOST_NAME()
Get Hostname and IP
SELECT DB_NAME()
Current database
SELECT name FROM master..sysdatabases;
List of databases
SELECT user name()
Current user
SELECT name FROM master .. sjslogins
List of users
SELECT name FROM master..sysobjects WHERE xtype= 'U';
list of tables
SELECT name FROM syscolumns WHERE id=(SELECT id FR0M sysobjects WHERE name- 'mjtable' ) ;
List of columns
Information about all database tables in the system table
List of tables and columns
Password hash
Bypass user access level
Postgres
Command
Explanation
SELECT version();
Database version
SELECT inet server_addr()
Get Hostname and IP
SELECT current database();
Current database
SELECT datname FROM pg database;
List of databases
SELECT user;
Current user
SELECT username FROM pg_user;
List of users
SELECT username,passwd FROM pg shadow
List of password hashes
column list
List of tables
Mysql
Command
Explanation
SELECT @@version;
Database version
SELECT @@hostname;
Get Hostname and IP
SELECT database();
Current database
SELECT distinct (db) FROM mysql.db;
List of databases
SELECT user();
Current user
SELECT user FROM mysql.user;
List of users
SELECT host,user,password FROM mJsql.user;
Password hash list
List of all tables and columns
Execution of operating system command in mysql
Reading readable files in mysql
Writing to the file system in mysql
Oracle
Command
Explanation
SELECT * FROM v$version;
Database version
SELECT version FROM v$instance;
Database version
SELECT instance name FROM v$instance;
Current database
SELECT name FROM v$database;
Current database
SELECT DISTINCT owner FROM all_tables;
List of databases
SELECT user FROM dual;
Current user
SELECT username FROM all_users ORDER BY username;
List of users
SELECT column name FROM all_tab_columns;
List of columns
SELECT table name FROM all_tables;
list of tables
SELECT name, password, astatus FROM sys.user$;
List of password hashes
List of databases
Last updated