fbehrens
fbehrens

Reputation: 6533

How to find SQL Server running port when you don't own the server?

In our enterprise I don't have access to MSSQL Server, so I can'r access the system tables.

Upvotes: 1

Views: 317

Answers (2)

bitch_cakes
bitch_cakes

Reputation: 126

If you have elevated rights to SQL but not the OS, you can query the log.

If you don't have access to the OS but can run queries, perhaps try:

USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on' 
GO

If you don't have elevated rights to SQL, from the client-side windows machine with an active connection, you could run a netstat command and see on which ports you are connected to the target. Filter on IP address of the host.

netstat -an | find "10.1.10.xxx" 

netstat demo

You'll see that I have connections to the host on 3389 and 1433. Maybe this helps narrow it down.

Upvotes: 0

fbehrens
fbehrens

Reputation: 6533

What works for me is:

  1. capture the network traffic Wireshark (run as Administrator, select Network Interface),while opening connection to server.
  2. Find the ip address with ping
  3. filter with ip.dst == x.x.x.x

The port is shown in the column info in the format src.port -> dst.port

Upvotes: 2

Related Questions