SQL Cheatsheet for Open Source Intelligence (OSINT)
The following is a list of SQL queries that can be used for open source intelligence gathering.
General Queries
- SELECT * FROM information_schema.tables;: Retrieves a list of all tables in the database.
- SELECT * FROM users;: Retrieves a list of all user accounts in the database.
- SELECT * FROM comments;: Retrieves a list of all comments left on posts in the database.
Password Cracking
- USE master;: Switches to the master database.
- SELECT password FROM microsoft.sql_server.security.logins;: Retrieves a list of login credentials for all users in the database.
- SELECT password FROM asp_net_db0_users;: Retrieves a list of user credentials from ASP.NET database.
IP Address Lookups
- DISTINCT host FROM connections;: Retrieves a list of unique IP addresses associated with the database.
- SOURCE IP address;: Retrieves the source IP address of the user making the query.
Time Zone Lookups
- SYSDATETIMEoffset();: Retrieves the current system date and time, including offset.
- CURRENT_TIME zone;: Retrieves the current time in a specific time zone.
Network Lookups
- SUBNETID FROM network_adresses;: Retrieves a list of subnets associated with the database.
- PING {IP address};: Tests if the IP address is reachable.
Keyword Search
- SOMETHING LIKE '{keyword}';: Searches for keywords in the database, allowing for wildcards and quotes.
Note: The above queries are for educational purposes only and should not be used to gather intelligence without permission.