java - Developing a tool to know who connected to remote machine? -
scenario: team of 22 members daily log on local machines unique ids , connect remote machines set of logins.
here logins used connect remote machines not unique..i mean more 1 machine can connected same user name..
in 1 line 22 remote machines have 5- 6 logins used 22 members..
problem: remote machines not dedicated each employee..everyday need send mail group asking connected specific remote machine..and if 1 replies yes..we ask them disconnect..
i want develop small tool using java, runs on every machine , displays machine used one..
the code mentioned in site useful not specify used login? link : http://lazynetworkadmin.com/content/view/34/6/
i hope made point clear :)
please guide me how can proceed?..do think possible?
note: forgot mentioning operating system, is: windows xp
on remote machine can run netstat
program, outputs 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 output can see network connections established. in third column see ip address , port of other host. find
keeps lines contain ":80" (which in case remote http hosts i'm connected to). since know port remote hosts connect to, can filter port number. third column contain ip addresses , ports of computers connected host.
from ip address should easy find out computer is.
update:
as want use java, should straight-forward do:
- run
netstat -n
command. - capture output in
list<string>
. - split each line words.
- keep lines
word[0]
tcp
,word[1]
ends:3389
,words[3]
established
. - split
word[2]
of these lines @ colon. first element ip address. - report list of these ip addresses central server.
on central server, have little program accessible via web server:
- the server keeps list of active connections. each consists of remote host, client host , timestamp has been updated last time.
- accept incoming connections remote machines.
- receive list of client ip addresses 1 connection.
- remove "active list" client ip addresses have been reported ip.
- display resulting list.
for example:
- initially, list of active connections empty.
remote0
sends192.168.0.33,192.168.0.35
active clients.- the list of active connections contains
remote0:192.168.0.33
,remote0:192.168.0.35
. - some time later,
remote0
sends `` (an empty response) active clients. - now list of active connections empty, too.
the web server therefore needs process 2 urls:
/connections/list
listing active connections/connections/update
updating connections single remote host
sounds bit of work, doable. , when it's finished feels quite usable me.
Comments
Post a Comment