Reputation: 6410
Scenario: We are a team of 22 members who daily log on to their local machines with their unique IDs and then connect to remote machines with a set of Logins.
Here the logins used to connect to remote machines are not unique..I mean more than one machine can be connected with same user name..
In one line 22 remote machines will have only 5- 6 logins which are used by 22 members..
Problem: As the remote machines are not dedicated to each employee..Everyday we need to send a mail to all the group asking who is connected to specific remote machine..And if any one replies yes..we will ask them to disconnect..
I want to develop a small tool using java, which runs on every machine and displays which machine is used by which one..
The code which is mentioned in this site is useful but it does not specify as the who used that login? Link : http://lazynetworkadmin.com/content/view/34/6/
I hope i made my point clear :)
Please guide me as how i can proceed?..Do you think it is possible?
NOTE: Forgot about mentioning the operating system, it is: Windows XP
Upvotes: 0
Views: 582
Reputation: 41625
On the remote machine you can run the netstat
program, which outputs something like this:
C:\> netstat -n | find ":80"
TCP 192.168.1.33:1930 209.85.129.190:80 ESTABLISHED
TCP 192.168.1.33:2749 74.125.39.139:80 ESTABLISHED
TCP 192.168.1.33:2861 74.125.171.167:80 TIME_WAIT
From this output you can see all network connections that are established. In the third column you see the IP address and port of the other host. The find
only keeps the lines that contain ":80" (which in my case is all the remote HTTP hosts I'm connected to). Since you know the port that the remote hosts will connect to, you can filter by that port number. The third column will then contain the IP addresses and ports of all the computers that are connected to this host.
From the IP address it should be easy to find out whose computer it is.
Update:
As you want to use Java, it should be straight-forward what to do:
netstat -n
command.List<String>
.word[0]
is TCP
, word[1]
ends with :3389
and words[3]
is ESTABLISHED
.word[2]
of these lines at the colon. The first element is then the IP address.On the central server, have a little program accessible via a web server:
For example:
remote0
sends 192.168.0.33,192.168.0.35
as its active clients.remote0:192.168.0.33
, remote0:192.168.0.35
.remote0
sends `` (an empty response) as its active clients.The web server therefore needs to process two URLs:
/connections/list
for listing all the active connections/connections/update
for updating the connections for a single remote hostSounds like a bit of work, but this is certainly doable. And when it's finished it feels quite usable to me.
Upvotes: 1
Reputation: 75376
Go through a local proxy. Then the proxy knows which connections are active.
Upvotes: 0