Solved

Simple need to detect external IP of RDP user

Posted on 2011-09-19
10
468 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
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 
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
 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VPN Server config in Modem 5 68
Bandwidth cap???? 8 61
AD account Auto logoff 1 39
VPN connect issues 2 27
In the world of WAN, QoS is a pretty important topic for most, if not all, networks. Some WAN technologies have QoS mechanisms built in, but others, such as some L2 WAN's, don't have QoS control in the provider cloud.
Let’s list some of the technologies that enable smooth teleworking. 
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…

749 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