DB related Commands
{: .no_toc }
Table of contents
{: .no_toc .text-delta }
TOC
{:toc}
Manually connect to MSSQL databases with credentials
Install freetds and sqsh - should be already in kali
apt-get install sqsh freetds-bin freetds-common freetds-dev
Edit /etc/freetds/freetds.conf, and append the following to it:
[TargetServer]
host = 192.168.1.10
port = 1433
tds version = 8.0 # to chose correct tds: http://www.freetds.org/userguide/choosingtdsprotocol.htm
Edit ~./sqshrc:
\set username=sa
\set password=password
\set style=vert
Connect:
sqsh -S TargetServer
Enumerate available databases:
SELECT name FROM master..sysdatabases
go
Enable xp_cmdshell and get command execution:
exec sp_configure 'show advanced options', 1
go
reconfigure
go
exec sp_configure 'xp_cmdshell', 1
go
reconfigure
go
xp..cmdshell 'dir c:\'
go
Manually connect to MSSQL databases with credentials - Alternative
Use mssqlclient.py from Impacket but gives an impacket command line and not the mssql db command line
mssqlclient.py username@10.10.10.123 -windows-auth
Manually connect to mysql:
mysql -u {username} -p'{password}' \
-h {remote server ip or name} -P {port} \
-D {DB name}
Manually connect to Oracle DB:
sqlplus scott/tiger@10.10.10.82:1521/XE as sysdba # XE is the SID and 'as sysdba' is kind of sudo for oracle
Manually connect to most databases
Use RAZORSQL (30 days trial)
Last updated
Was this helpful?