snippetbashTip
nxc mssql — Pentest and exploit Microsoft SQL servers. More information: <https://www.netexec.wiki/mssql-protoco
Viewed 0 times
commandandexploitmicrosoftclisqlpentestnxc mssql
Problem
How to use the
nxc mssql command: Pentest and exploit Microsoft SQL servers. More information: <https://www.netexec.wiki/mssql-protocol/mssql-passwordspray>.Solution
nxc mssql — Pentest and exploit Microsoft SQL servers. More information: <https://www.netexec.wiki/mssql-protocol/mssql-passwordspray>.Search for valid credentials by trying out every combination in the specified lists of usernames and passwords:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{path/to/usernames.txt}} {{[-p|--password]}} {{path/to/passwords.txt}}Execute the specified SQL query on the target server:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} {{[-q|--query]}} '{{SELECT * FROM sys.databases;}}'Execute the specified shell command on the target server through MSSQL:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -x {{whoami}}Execute the specified PowerShell command on the target server through MSSQL without retrieving output:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -X {{whoami}} --no-outputDownload a remote file from the target server and store it in the specified location:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} --get-file {{C:\path\to\remote_file}} {{path/to/local_file}}Upload a local file to the specified location on the target server:
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} --put-file {{path/to/local_file}} {{C:\path\to\remote_file}}Code Snippets
Search for valid credentials by trying out every combination in the specified lists of usernames and passwords
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{path/to/usernames.txt}} {{[-p|--password]}} {{path/to/passwords.txt}}Execute the specified SQL query on the target server
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} {{[-q|--query]}} '{{SELECT * FROM sys.databases;}}'Execute the specified shell command on the target server through MSSQL
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -x {{whoami}}Execute the specified PowerShell command on the target server through MSSQL without retrieving output
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -X {{whoami}} --no-outputDownload a remote file from the target server and store it in the specified location
nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} --get-file {{C:\path\to\remote_file}} {{path/to/local_file}}Context
tldr-pages: common/nxc mssql
Revisions (0)
No revisions yet.