Solved

Simple need to detect external IP of RDP user

Posted on 2011-09-19
10
465 Views
Last Modified: 2012-05-12
I have someone who is logging into a terminal server via RDP and I need to find out the IP address of the external computer that is making the connection.  The terminal server properties shows the internal IP, so how can I easily find out the external IP?  I am running a Sonicwall TZ170, so maybe someone knows where to find that info in the router, if not on the terminal server itself.
0
Comment
Question by:murryc
10 Comments
 
LVL 6

Expert Comment

by:JRaster
ID: 36563881
Thats interesting that is hows the internal ip.
Are the users creating a VPN connection first?  If so, then it makes sense that is logged.

My Termininal server shows the external IP under Source Network Address in the security log.  
0
 
LVL 7

Expert Comment

by:lewisg
ID: 36563972
0
 

Author Comment

by:murryc
ID: 36564359
I am needing the clients external ip not the ip that my router has that is accepting the rdp connection. I need the ip of the computer the user is connecting from.
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36564412
I can provide this for you. Currently scripting it as a batch file.
0
 
LVL 10

Accepted Solution

by:
ReneGe earned 500 total points
ID: 36564639
The following batch file (.bat) will output:
date, time,remote FQDN,remote IP address

Hope this helps,
Rene


@ECHO OFF

SETLOCAL enabledelayedexpansion

SET TerminalServicesPortNumber=3389
SET LogFile=LogFile.csv

::LISTING TERMINAL SERVICES CONNECTIONS
FOR /F "tokens=3" %%A IN ('NETSTAT ^| FINDSTR %TerminalServicesPortNumber%') DO (
	::ISOLATING FULLY QUALIFIED DOMAIN NAME [FQDN]
	FOR /F "tokens=1 delims=:" %%B IN ("%%A") DO (
		::GETTING IP ADDRESSES
		FOR /F "tokens=2 delims=: " %%C IN ('NSLOOKUP %%B') DO SET IP=%%C
			::SOME TIMES, THERE MAY BE MORE THAN ONE IPs FOR ONE FQDN. WILL OUTPUT THE FIRST IP
			FOR /F "tokens=1 delims=, " %%D IN ("!IP!") DO (
				CLS
				ECHO %date%,%time%,%%B,%%D
				ECHO %date%,%time%,%%B,%%D>>"%LogFile%"
			)
	)
)

PAUSE

Open in new window

0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:murryc
ID: 36564764
Nice Batch!  This seems to report the IP when run on the actual session.  Is this possible to detect the IP of someone else's active session?  Here is my scenario.  I have an unauthorized person that is logging into the terminal server.  I am able to shadow that person's session without them seeing that I am doing that.  I now just need to detect his originating IP so that I can tell whether it is a previous employee, partner, vendor, or just a normal foreign hacker.
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36564852
Nice Batch = Thanks :)

"...detect the IP of someone else's active session..." = Yes
It will actually log all currently T.S. loged in users

"...so that I can tell whether it is a...", because of most home users have a dynamic IP address, it is difficult to tell who has what Internet IP address. You may try to find at least IP address city by using the following link, where the "x" has to be replaced by the IP address: http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress=xxx.xxx.xxx.xxx

If it's a company, they most likely, own that IP addredd and doing a reverse lookup "nslookup xxx.xxx.xxx.xxx" will help.

You will need to use some strategy.  For example, that remote TS user is logged on using what credentials? Then talk to the person owing these credentials. If it is not him/her, find the ISP owing that IP address then find a convincing way to trace it to the user (the ISP client), by using the IP address, date and time.

0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36564856
"nslookup xxx.xxx.xxx.xxx"

Actually, in the CSV log file, you should get the company name owing that IP address.

Cheers,
Rene
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 36919903
netstat -ant | find /i "3389"

would have been enough
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36920453
Glad I could help
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Cisco RV042 router is a popular small network interfacing device that is often used as an internet gateway. Network administrators need to get at the management interface to make settings, change passwords, etc. This access is generally done usi…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now