It give givess me plea pleasu sure re to pres presen entt my proj projec ectt repo report rt on “Network “Network Monitoring Monitoring System” as per requirem requirement ent of the curricul curriculum um of the course course Deplom Deplomaa of comput computer er
engineering from the msbte Mumbai at the government polytechnic jintur. First , I am hearty thankful to project guide Prof. A.K. Rathod sir for selecting for selecting this project. I would would also also like like to thank thank Prof. B.M. Tachtode, .!.". of #.!. "e$t. and Princi$a% S.R. Th&te sir of our college.
nce nce more more we will will e!pr e!pres esss deep deepes estt than thanks ks to our our proj projec ectt guide guide Prof. A.K. Rathod sir for these guidance and "ncouragement at every step in our way completing
this project. #astly we are heartly thankful to our parents and friends for their valuable support for our project.
1 . Prasad wadwalkar 2. Sumit deshmane 3. Amol rankhambe
ABSTRA#T
$etwork monitoring system supervises all computers in network. It consists of two programs client % server each run on different terminals which having different operating operating system that is platform independence independence like windows windows or #inu!. &erver program program hav have task manager which shows process running on all clients. 'y using this task manager server can stop any process running on client terminal forcefully. It also ca$t&re remote deskto$ screen of client for observing whatever activity perform at that instant. It also provides chatting facility between client and server. If client having any difficulty he can chat with server. (lient can ask question to server and server can reply.
Table of Contents Contents
SR. N!. *
-
T!P'# 'ntrod&ction
PA() N!. +*-
).) *roject *roject *review *review
*
).+ &cope of *rojec *rojectt
*
S&r/ey of 0iterat&re
+1*-
+.) &pecialty about emote -ask Manager
2
+.).) ses of emote e mote -ask -ask Manager
3
+.).+ /orking /orking of emote -ask -ask Manager
4
+.+ &pecialty about &creen (apturing +.+.) /orking /orking of &creen (apturing (apturin g
4 5
+.0 &pecialty about (hatting
6
+.1 equirement 2nalysis
*7
+.3 &oftware equirement &pecification
**
1
"esign
+*1-1
2
'm$%ementation
+-217
1.) #ogin /indow on &erver
-2
1.+ &erver side Interface
-3
1.+.) emote -ask Manager
-4
1.+.+ &end Message
-5
1.+.0 "!ecute (ommand
-5
1.+.1 &creen (apturing Module
-8
1.+.3 (hatting Module
-6
1.+.4 #ock5nlock Module
17
Testing
+1*12
3.) -est )
1*
3.+ -est +
1*
3.0 -est 0
1-
3.1 -est 1
11
3.3 -est 3
11
3.4 -est 4
12
4
Res&%t 9 Ana%ysis
13
5
A$$%ication
14
8
:&t&re enhancement
15
6
#onc%&sion
18
*7
Bi;%iogra$hy
16
3
**
27
Pro
#ha$ter *
'NTR!"=#T'!N 6ere in this section we will familiari7e you with the project with its overview, introduction and our objective behind choosing this project.
*.* Pro
-he network monitoring system refers to supervising all the computers in a network, be that #2$, /2$, M2$ or 82$. &ecurity was not a priority for the original designers of the local area network protocols. $etworks were assumed to be private, isolated and physically secure, or else completely public. -his assumption is no longer true because of the growing commercial use of the internet and computers connected in small network for the purpose of sharing9 a considerable amount of private information is now being sent over public networks.
“N)T?!RK M!N'T!R'N( S@ST)M : is the client;server based project. In
this project administrator can keep the track of user
2s the numbers of workstations are more in the network, it is the difficult task for the network administrator to off each and every workstation computer individually. -o simplify this in our project there is a provision for remote shutdown, reboot and logoff the workstation from the server. In addition to all this finally the report of login and logoff from particular workstation can be generated on server computer. -his project also provides file transfer.
*.- Sco$e of Pro -here was no any computeri7ed based system e!isting to provide all function which we will provide in our proposed project. -he scope of project e!tends to the network related organi7ation that is connected by #2$. -hus this project can be used in wide application like &chools, ffices, (olleges, Institutions and (yber caf=
#ha$ter -
S=R)@ !: 0'T)RAT=R)
emote -ask Manager from &mart#ine, Inc is a systems control interface that can be run from any remote /indows $-5+>>>5?* computer. It is the leading enterprise remote control solution for corporate networks.@)A
emote -ask Manager significantly reduces the total cost of network management in enterprise environments by enabling I- personnel to control tasks, processes, services, devices, shared resources, events and computer performance over #2$, /2$ and the Internet.@)A
-he periodic distribution of new programs, patches and updates represent a large portion of an administrator
emote -ask Manager B-MC is a systems control interface that can be run from any remote /indows $-5+>>>5?* and /indows &erver +>>0 computer. -his enables a &ystems 2dministrator to control most aspects of a remote environment. -M adds the ability to lock5shutdown5reboot and to create processes on remote computers. @0A
'' Flash'ack is a leading screen recording program for /indows, published by 'lueberry &oftware. /hen the record function is activated, screen activity is stored in a real time video file. -his recording can then be replayed, edited and enhanced with graphics, te!t or sound effects. @1A
&creen capturing is designed to meet the comple! requirements of technical and other workstation applications. It is designed for easy integration into applications. -he original colors of individual windows are preserved with any combination of windows. "ven when a window appears in false colors on the screen due to color table overrun, it is captured in its original colors and is saved correctly.@3A
(hatting on #2$ approach enables cooperative work by using the #2$ as an entry point for starting applications that can offer more specific functionality for cooperative work.@4A
-.* S$ecia%ty a;o&t Remote Task Manager
2 clean and simple;to;use user interface offers easy setup wi7ards and multiple graphical views of the information. emote -ask Manager is designed to run under /indows $-5+>>>5?*. It provides automated support for Install and ninstall.
emote -ask Manager even supports remote installs, enabling a &ystems 2dministrator to set up a service on remote machines without ever having to physically go to them.
emote -ask Manager supports systems with up to 41 active (*s. n an &M* BmultiprocessorC system, you can control which (*s a process will be allowed to e!ecute on.
-he *rocess Function and the -ask Manager allows remote termination and adjusting of priority.
2n "vent Eiewer lets the 2dministrator view all events as though they were being run on the host computer. -he *erformance Monitor displays a dynamic overview of the computers performance B(* and memory u sageC.
emote -ask Manager adds the ability to create processes on remote computers.
-.*.* =ses of Remote Task Manager -he following are a few e!amples of emote -ask Manager usesG
&tarting applications on remote computers H ou can run any applications on remote ever having to physically go to them.
-erminating selected processes. emote -ask Manager has a special function to close a process correctly Bcloses all handles opened by that process, unloads all D##s loaded by the process, etc.C.
Monitoring all running tasks, processes, services, devices and events on remote computers.
ou can stop, start, restart, pause and continue any selected service or device on the remote computer. In addition, it is possible to adjust services and devices security Bpermissions, auditing and ownerC and change services repair p arameters.
Monitoring a dynamic overview of the computers performance B(* and memory usageC.
emote -ask Manager can also be used to manage shared resources on remote computers.
ou can create new sharings and delete e!isting resources.
ou can shutdown and reboot remote computers. emote -ask Manager also allows you to lock a remote computer.
-.*.- ?orking of Remote Task Manager
emote -ask Manager consists of three partsG -M &ervice, -M Manager and -M (onsole.
-M &ervice is the core of emote -ask Manager. It is installed on each client system that you want to manage remotely. -M &ervice runs automatically and provides network access to the client machine while remaining invisible to that computer
-M Manager is the control interface &ystems 2dministrators use to remotely manage each network computer that has -M &ervice.
-M (onsole is similar to -M Manager e!cept it uses a command line interface rather than a 8I. -M (onsole>>5?* systems from a /indows J! computer.
-.- S$ecia%ty a;o&t Screen ca$t&ring
Recording methodo%ogy
/hereas other screen recorders are limited to a single capture technique, '' Flash'ack offers a choice of three different recording methods. -his includes the 'lueberry capture driver, signed by Microsoft for /indows +>>> and ?* systems, representing the most advanced and high performance recording available to date. -he choice of recording methodologies means that, unlike our competitors, '' Flash'ack can give you the best recording whatever your material, computer and operating system. -he capture driver is signed by Microsoft for use on /indows ?* and +>>> operating systems. -his driver is not supported on /indows JK, Me and $ platforms ; but users of these operating systems will instead have a choice of the two alternative technologies below.
"irect recording mode
Direct? recording is an innovative recording technique that monitors different sections of the screen for changes. /hen a change in the screen is found, only the required section of the screen is analysed and stored to disk H meaning faster recording for the user without quality loss. -his recording method is preferable when recording on a when capturing special content such as Flash, e!tremely graphical material, or when using a lower speciation computer.
("' recording mode
In 8DI mode the whole screen is captured in a series of frames then compared for
differences. (hanges are stored to disk and compressed in a movie file. 8DI recording is preferable on higher specification machines with older operating systems, and offers reliable and quality recording.
-.-.* ?orking of Screen ca$t&ring
#a$t&re Modes>
L ? "nhanced mode which e!ploits the full "asy(apture functionality. -his is the default mode. L ?/D mode which is based on the standard !wd program. For simple requirements this mode offers a faster alternative. L 8# mode BI'M &54>>> and &ilicon 8raphicsC may be required to capture windows created by 8#based or other non;? applications.
#a$t&re Ty$es
L 2 single window, with or without its frame, L -he full screen, L 2ny rectangular area of the screen
#a$t&red 'mage :i%e
"asy(apture saves the captured screen image in a file in ?/D format. -his file can be imported into other applications, or converted into other formats.
#a$t&re !$tions
;beep true N false O Issue a beep before and after screen capture. -he default value is set in the initiali7ation fileC. ;display hostnameGserver.screen
&pecifies the display on which the screen capture is to be performed. If the display is not specified, the DI&*#2 variable is used. If the DI&*#2 variable is not set, the local screen BhostnameG>.>C is the default display. ;application window;id &pecifies the window id of the main window of the calling application. -he window id is used if the application is to be hidden during screen capture. /hen this option is specified an output file name must also b e specified. ;delay seconds -his enforces a time delay Bin secondsC when capturing. -he delay applies if the graphical user interface of the application overlaps the screen area to be captured, and it has been specified that this window is hidden during capture. ccasionally, the system
-.1 S$ecia%ty a;o&t #hatting
(hatting is one of the attractive facilities available in the Internet. It provides live Bon lineC communication between people at different places by typing in the computer. $ow chatting can even be performed by talking and seeing each other. For this, web cameras and microphones should be connected in both the computers. 2lso the software that facilitates chatting should be e!ecuted. ou know that an e;mail id and password are required to use email. &imilarly, you need a chat id and password for chatting. 2s your e;mail id has two parts in the form of user name Pdomain, chat id has also the same.
#reating #hat'd
-he domain name should be known to create chat id. ou can get it from your teacher. therwise, you can use the I* address of the computer in the place of domain name. *assword can be decided by you. ou can use your name itself at the user name. $ote that no two persons can have the same user name. For e!ample, If the domain name is myschool.edu, then your chat id will be in the form of Qmyname Pmyschool.edu<. nce the chat id and password are decided, we can create the chat id.
-.2 ReC&irement Ana%ysis &ince after the analysis of e!isting system, it is found that all three features are not combinly available in e!isting system, there is a need to combine screen capturing, chatting and remote task manager. 2lso, features present in e!isting system are platform dependent. Due to the above shortcomings, there is a need to develop platform independent features.
)Disting System>
Features are not available combinly.
Features are platform dependent.
Pro$osed System>
-M, &creen (apturing and chatting features will be combined into one.
*latform independency will be achieved.
-.3 Software ReC&irement S$ecification
2dministrator should be able to keep the track of all processes running on client.
(lients may have different platform such as /indows, #I$? etc.
(lient % &erver should be able to chat with each other in #2$.
2dministrator should be able to kill the illegal processes of client.
2dministrator should be able to keep an updated log file regarding recent activities of clients.
?ith RTM yo& can>
Monitor all running tasks, processes, services and events on remote computers.
/atch features of running tasks Bthe handle of the main window, process ID, etc.C.
/atch features of running processes Bprocess ID, (* time, privileges used, memory and priorityC.
&ee which process is associated with a selected task.
&ee which process is associated with a selected service.
"nd a selected task correctly.
-erminate a selected process at any time.
(hange priority of a selected process.
(ontrol which (*s the process will be allowed to e!ecute on.
&top, start, restart, pause and continue any selected service or device.
(hange startup parameters of a service or a device Bname, account, startup type, dependencies, etc.C.
(hange services repair parameters on /indows +>>>5?*.
/atch dependent services.
2djust services and devices security Bpermissions, auditing and ownerC.
Manage shared resources on remote computers.
(lear event logs.
2rchive event logs.
Monitor a dynamic overview of the computers performance B(* and memory usageC.
&hut down and reboot remote computers.
(reate processes on remote computers.
#ock computers remotely.
#ha$ter 1
")S'(N
:ig1.*>=se #ase "iagram
=S) #AS) "'A(RAM SP)#':'#AT'!N ). ($$"(-R-R&"E" G; It is used to connect client to the server after proper authentication of the client. 2uthentication is done by validating the user name and I* address of the client.
+. M2$28"R"M-"R-2&SG emote task manager manages processes running on all clients. 'y using this task manager server can stop any process running on client terminal forcefully. 0. (2*-"R&(""$&6-G It capture remote desktop screen of client for observing whatever activity perform at that instant. 1. DoRchattingG It is used for administrator and clients for chatting with each other. It also used for chatting between client and client. 3. 8"$"2-"R"*-G It is used for generate report which specifies time of the remote login, logoff, restart and shutdown.
:ig1.->#%ass "iagram
:ig1.1>Acti/ity "iagram
:ig1.2>State #hart "iagram
:ig 1.3>SeC&ence "iagram :or Remote Task Manager
:ig 1.4>SeC&ence "iagram :or #hatting
:ig 1.5>SeC&ence "iagram :or Screen #a$t&ring
:ig 1.8>#o%%a;oration diagram for remote task manager
:ig 1.6>#o%%a;oration "iagram :or #hatting
:ig 1.*7>#o%%a;oration "iagram :or Screen #a$t&ring
#ha$ter 2
'MP0)M)NTAT'!N
2.* 0ogin ?indow !n ser/er
-he above window is the first to appear at the server side. -he window is named AdminE0ogin since it is used by administrator for login purpose.
2fter the administrator enters the valid username and password, he is granted access to the ne!t form. 'y clicking on the "!it button 2dministrator can close the application. -he above given window is basically used for authentication of administrator. Database of username and password is stored in oracle on &erver side.
2.- Ser/er Side 'nterface
-he server side interface act as a combined interface for all three modules i.e Remote Task Manager , Screen #a$t&ring and #hatting. -he right hand side of the window displays the operating system running at each and every client. -he number of clients connected is displayed with the corresponding name and ip address of the client. -he administrator can see the details of the client by clicking on the respective client
2.-.* Remote Task Manager Mod&%e>
-he Remote Task Manager is used to access the task manager of the client. -he name of the task running on the client
to close the respective process. If the client fails to do so, the server can kill the process by clicking on the Sill *rocess button. 6ence, the client process is closed forcefully.
2.-.- Send Message>
'y clicking on send message button, the server can send any message to client. 'y default e%%o Message is sent. &erver can also send any message to client.
2.-.1 )Dec&te #ommand>
-he e!ecute command button is used to e!ecute different commands at the client side by the server. For e!ample server can open note$ad.eDe , ms$aint.eDe or can even shutdown the client terminal by sending the command Sh&tdowns.
1.+.1 Screen #a$t&ring Mod&%e>
&creen capturing module has two subparts. -hey are (et Screen and "ynamic #a$t&re. 'y clicking on 8et &creen button, only static image of the client
2.-.3 #hatting Mod&%e>
In (hatting module, a login window is provided at both the client as well as the server side for authentication purpose. 2fter clicking on the login button the client gets connected to the server and vice versa. 2fter successful entry the chatting interface is displayed. -he left hand side of the window displays the name of the logged user. -his list gets updated as the number of user logged on increases. 'y default ?e%come message is sent. -he window has three buttons namely Send, Send-a%% and 0ogo&t. 'y clicking on send button, message is sent only to selected client. 'y clicking on send-a%% , messages can be sent simultaneously to all users who are currently logged on. 'y clicking on %ogo&t button, the respective user disconnects himself 5 herself from chatting application.
sing (hatting application, both client and server can chat between each other whenever required.
2.-.4 0ockF=n%ock ?indow>
-he %ockF&n%ock window is basically used by administrator while he5she leaves the terminal. -his window provides security by forcing the administrator to enter the username and password again. 6ence, impersonisation can be avoided.
#ha$ter 3
T)ST'N(
•
Test cases -est cases are designed such that all modules get tested at least by one of test cases. For successful testing all test cases should pass i.e. outcome should be as e!pected.
3.) Test *
Test -o test administrator login with correct ID % *assword.
Test "escri$tion G -his testing is performed for the authentication of user.
Phase G 2dministrator #ogin.
Set&$ G 2 unique ID and password are setup in the database itself .
Testing G 6ere the administrator ID and *assword are checked. -he ID is also tested for different passwords and vice versa. 2n error message is displayed unless entered with correct specified ID and password.
Res&%t G Eerified ID and *assword.
Test G -o test connection establishment.
Test "escri$tion G -his test checks whether client is connected to server or not. 6ere the server should always be in listening mode.
3.+ Test -
Phase G (lient;&erver connection establishment.
Set&$ G 2fter configuring $etwork adapter B"thernetC card with proper I* address settings, the connectivity in computers in the #2$ are tested using *I$8 command.
Testing G "!ecute the server first and then specify the I* address5D$& name in the client side.
-he states through which the module flowsG
&"E"R#I&-"$I$8
;;2fter checking the server is listening, sending request for connection from client side.
(#I"$-R($$"(-I$"T"&-
;;If the server is not listening, there will be no connection. ;;also if no I* address name is specified, there will be error message from client.
(#I"$-R"M"&&28"
;;If everything is S, then connection will be successful
(#I"$-R($$"(-"D
Mod&%e Tested "stablishing connection between client and server.
Res&%t G (onnection is established between client % server.
3.1 Test 1
Test -o test 8eneral tility tools.
Test "escri$tion G -his test is performed to check the general utility tools like send message and e!ecute command.
Phase G 8eneral tilities testing.
Testing G #ets consider the e!ecute command tool. 2fter testing it for shutdown for windowsJK we came to a conclusion that the code needs some modifications for successful e!ecution on windows ?* and higher versions.
Res&%t G Modified as per requirements.
Test G -est for (hat application.
Test "escri$tion G -his test is performed to check the chat application between the client and server.
Testing G 2fter initiating the chat application at client and server side, it is checked that whether messages are passed correctly.
Res&%t G (hat application was tested successfully.
3.2 Test 2
3.3 Test 3
Test G -est for &creen (apturing.
Test "escri$tion G -his test is performed to see if the server can capture the remote desktop screen without delay.
Phase G -esting screen capturing.
Testing G -he capturing and actually viewing the remote screen depends on the performance of the network B#2$C.
Res&%t G &creen can be captured without any delay as well as it can be viewed in real;time.
Test G -o test access of client
3.4 Test 4
Test "escri$tion G -his testing is performed so that any illegal processes can be stopped from being e!ecuted by client.
Phase G -esting emote -ask Manager B-MC.
Testing G 6ere new process is made to e!ecute at client
Res&%t G /arning messages are sent as well as process was killed successfully.
#ha$ter 4
R)S=0T AN" ANA0@S'S
-esting has been performed for verification of user name and password, connection establishment, chatting application, remote task manager, screen capturing and general utility. In login form testing the administrator ID and *assword are checked. -he ID is also tested for different passwords and vice versa. 2n error message is displayed unless entered with correct specified ID and password. 2fter Eerifying ID and *assword he can get access to system. 2fter configuring $etwork adapter B"thernetC card with proper I* address settings, the connectivity in computers in the #2$ are tested using *I$8 command . "!ecute the server first and then specify the I* address5D$& name in the client side. 2fter checking the server is listening, sending request for connection from client side and connection is established between server and client. 2fter initiating the chat application at client and server side, it is checked that whether messages are passed correctly. If yes then (hat application was tested successfully.
In emote task manager testing new process is made to e!ecute at client
#ha$ter 5
APP0'#AT'!N •
Is very effective as a monitoring tool in offices5commercial places. For instance, if an employee is watching a movie on media player during office hours, it can be brought to light immediately and can be forced to close it.
•
(an be used in cyber cafes, hence can help to reduce (yber (rimes.
•
(an be used in practical laboratories of schools and colleges so that a single person can keep a track of all the students of what he or she is doing without having to visit each and every terminal.
#ha$ter 8
:=T=R) )NAN#)M)NTS
*H Keystroke monitoring > In this the code can be further modified to capture the keystrokes of remote console. -his will help you in monitoring and preventing illegal user operations. -H ?e;cam monitoring > /ebcam monitoring is useful tool in case of monitoring the users on the remote terminals or even for surveillance. It can also be successfully implemented for video conferencing. 1H #ontro%%ing the Remote termina%s &sing Short Messaging Ser/ice ISMSH > sing mobile phone interaction with the computer, the application can be further enhanced. ne can emotely control some of the function such as S=T"!?N, R)START'N( the computer, killing the unnecessary tasks and even getting remote desktop screen on 8*& enabled phones. -he only necessity is that the remote computer should always be connected to the internet for &M& reception. 2H Session #ontin&ation> -o make provision such that user session can be continued when the power failure problem occurs.
#ha$ter 6
#!N#0=S'!N &ecurity is an important aspect in the world of network. Earious business organi7ations are providing special attention for confidentiality in E*$
#ha$ter *7
B'B0'!(RAP@ )C U)JJK;+>>+ &mart#ine, Inc. +C "asy emote *rogram Installations sing the -ask &cheduler &ervice, ev 1 ; 2pril +V, +>>4, #ieberman &oftware (orporation httpG55www.liebsoft.com5 0C (opyright U Device#ock, Inc. )JJV;+>>K. 1C '' Flash'ack /hite *aper , )st "dition H '' Flash'ack ).1.) H February +>>3 3C Implementation of &creen (apture in a Design "nvironment using "asy(apture, /hite *aper by Snud -homsen, Marketing Director. 4C (hatting on the #2$ by Martijn van /elie and 2nton "liWns Erije niversiteit, Department of Mathematics and (omputer &cience De 'oelelaan )>K), )>K) 6E 2msterdam, -he $etherlands emailG martijn, eliensOPcs.vu.nl, fa!G X0).+>.111V430
55PR!(RAMS AT S)R)R S'")JJ FF$rogram for %ogin for administrator for access who%e system FF0oginAdmin.
import java.rmi.Y9 55declare required packages. import java.awt.Y9 import java.awt.event.Y9 import java.sql.Y9 import java!.swing.Zption*ane9 public class #ogin2dmin e!tends java!.swing.ZFrame implements java.awt.event.2ction#istener 55declare different required variables (onnection cn9 55variable fr connection with oracle private java!.swing.Z'utton j'utton)9 55define different buttons private java!.swing.Z'utton j'utton+9 private java!.swing.Z#abel j#abel)9 private java!.swing.Z#abel j#abel+9 private java!.swing.Z*asswordField j*asswordField)955define te!tfield and passfield private java!.swing.Z-e!tField j-e!tField)9 Font f9 55define font variable 2dmin8I) a)9 55declare an object of 2dmin8I) public #ogin2dminBC 55constructor set-itleB[2dminR#ogin[C9 55set different variables of frame f\new FontB[2rial[,),)4C9 55declare font init(omponentsBC9 55call initcomponetsBC function for design 8I
try 55connectivity with oracle database for accessing the data. (lass.for$ameB[sun.jdbc.odbc.ZdbcdbcDriver[C9 cn\DriverManager.get(onnectionB[jdbcGodbcGlogdsn[,[system[,[niraj[C9 O catchB"!ception eC &ystem.out.printlnB[[XeC9 55 catch % print e!ception O
O public int adminloginB&tring user, &tring passwordCthrows emote"!ception 55check for 2uthentication int k\>9 55declare for checking availability try &tatement st\cn.create&tatementBC9 esult&et rs\st.e!ecuteTueryB[&elect Y from adminlog where uname\[XuserX[ and pwd\[XpasswordX[[C9 55fire aquery for checking authentication ifBrs.ne!tBCC 55e!ecute query k\)9 O rs.closeBC9 55close st.closeBC9 O catchB&T#"!ception eC &ystem.out.printlnBeC9 O return k9 55return value of S for athentication O public void action*erformedBjava.awt.event.2ction"vent aeC 55action performed after click on buttons try ifBae.get&ourceBC\\j'utton+C 55after clicking on e!it button. Zption*ane.showMessageDialogBthis,["!iting[C9 disposeBC9 55close window return9 O ifBj-e!tField).get-e!tBC.trimBC.lengthBC]>C 55check length of te!tfield ifBj*asswordField).get-e!tBC.trimBC.lengthBC]>C
int res\adminloginBj-e!tField).get-e!tBC,j*asswordField).get-e!tBCC9 ifBres\\)C 55 if username % password is valid a)\new 2dmin8I)BC9 55 display server interface disposeBC9 O else java!.swing.Zption*ane.showMessageDialogBthis,[Invalid ser$ame5*assword[C9 j-e!tField).set-e!tB[[C9 55clear both te!tfields and setfocus at particular te!tfield j*asswordField).set-e!tB[[C9 j-e!tField).requestFocusBC9 O O else java!.swing.Zption*ane.showMessageDialogBthis,["nter *assword[C9 j*asswordField).requestFocusBC9 O O else java!.swing.Zption*ane.showMessageDialogBthis,["nter sername[C9 j-e!tField).requestFocusBC9 O O catchB"!ception eC java!.swing.Zption*ane.showMessageDialogBthis,[error is [XeC9 O O55end of actionperformed private void init(omponentsBC 55 design or declaration of variable for 8I j#abel) \ new java!.swing.Z#abelBC9 j-e!tField) \ new java!.swing.Z-e!tFieldBC9 j#abel+ \ new java!.swing.Z#abelBC9 j*asswordField) \ new java!.swing.Z*asswordFieldBC9 j'utton) \ new java!.swing.Z'uttonBC9 j'utton+ \ new java!.swing.Z'uttonBC9 j'utton).add2ction#istenerBthisC9 j'utton).set'ackgroundB(olor.dark8rayC9 55set dolor of button j'utton).setForegroundB(olor.whiteC9 j'utton+.add2ction#istenerBthisC9 j'utton+.set'ackgroundB(olor.dark8rayC9
j'utton+.setForegroundB(olor.whiteC9 add/indow#istenerB 55close all programs after disposing this window new /indow2dapterBC public void window(losingB/indow"vent weC disposeBC9 O O C9 get(ontent*aneBC.set#ayoutBnullC9 55define layout of content pane get(ontent*aneBC.set'ackgroundB(olor.orangeC9 55set color to content pane j#abel).set-e!tB[*assword[C9 55defines diff. labels j#abel).setFontBfC9 get(ontent*aneBC.addBj#abel)C9 j#abel).set'oundsB3>, V>, )>>, )1C9 get(ontent*aneBC.addBj-e!tField)C9 j-e!tField).set'oundsB)4>, 0>, )+>, +>C9 j-e!tField).setFontBfC9 j#abel+.set-e!tB[ser$ame[C9 j#abel+.setFontBfC9 get(ontent*aneBC.addBj#abel+C9 j#abel+.set'oundsB3>, 0>, )>>, )1C9 get(ontent*aneBC.addBj*asswordField)C9 j*asswordField).set'oundsB)4>, V>, )+>, +>C9 55set bound to pwd field j*asswordField).setFontBfC9 j'utton).set-e!tB[#ogin[C9 j'utton).setFontBfC9 get(ontent*aneBC.addBj'utton)C9 j'utton).set'oundsBK>, )3>, K>, +KC9 55set bound to login field j'utton+.set-e!tB["!it[C9 j'utton+.setFontBfC9 get(ontent*aneBC.addBj'utton+C9 j'utton+.set'oundsB)K>, )3>, J>, +KC9 55set bound to button set&i7eB03>,+3>C9 O public static void mainB&tring args@AC 55 beginning of program #ogin2dmin l)\new #ogin2dminBC9 55call constructor l).setEisibleBtrueC9 O
O FF $&;%ic interface for Adminser/er. Admin'nt*.
import java.rmi.Y9 55import required packages. import java.net.Inet2ddress9 import java.util.Y9 public interface 2dminInt) e!tends emote 55"!tends remote class. public void accept(lientBjava.net.Inet2ddress iaCthrows emote"!ception9 public void accepts$ameB&tring osnameCthrows emote"!ception9 public int loginB&tring user, &tring passwordCthrows emote"!ception9 public void logoutB&tring userCthrows emote"!ception9 public Eector get2llserBCthrows emote"!ception9 public void sendMessageB&tring to,&tring msg Cthrows emote"!ception9
public &tring readMsgB&tring userCthrows emote"!ception9 public void send-o2llB&tring msg,&tring senderCthrows emote"!ception9 O FF Main Adminser/er $rogram which r&n on ser/er machine. •
55AdminSer/er*.
import java.net.Y9 55import required packages. import java.sql.Y9 import java.rmi.Y9 import java.util.Y9 import java.rmi.server.Y9 import java.io.Y9 import java.net.Inet2ddress9 public class 2dmin&erver) e!tends nicastemotebject implements 2dminInt),unnable 55e!tends remote object.. Eector clientEec\new EectorBC9 55used for storing name and ip address. Eector clients\new EectorBC9 55 used to store & name. Eector v)\new EectorBC9 55used to store (onnected (lient name for chating (onnection cn9 55define connection variable. 6ashtable ht\new 6ashtableBC9 55hashtable used for storing client msg and name. &tring name \ null9 -hread th9 55define threads. int MI$R*II-9 55define priority. public 2dmin&erver)BCthrows emote"!ception th \ new -hreadBthis,[one[C9 th.set*riorityB-hread.MI$R*II-C9 55set priority to thread. th.startBC9 55start thread. try 55connection with oracle. (lass.for$ameB[sun.jdbc.odbc.ZdbcdbcDriver[C9 55Declaring D'( Driver cn\DriverManager.get(onnectionB[jdbcGodbcGoradsn[,[system[,[niraj[C955 *rovide (onnection
O catchB"!ception eC 55catch e!ception. &ystem.out.printlnB[[XeC9 O O public void accept(lientBjava.net.Inet2ddress iaCthrows emote"!ception clientEec.addBiaC9 552dd I* address of client in Eector O
public Eector getser#istBC 55 eturn client list return clientEec9 55return vector containing list of clients. O public &tring getI*Bint inde!C 55 take I* address from clientEec vector Inet2ddress ia\BInet2ddressCclientEec.getBinde!C9 return ia.get6ost2ddressBC9 O public void accepts$ameB&tring osnameCthrows emote"!ception 55accept & name clients.addBosnameC9 55add & name in client& vector O public Eector gets$ameBC 55take os name of client return clients9 55 return client os vector O public int loginB&tring user, &tring passwordCthrows emote"!ception 55login function for chatting.It accept parameter username and pwd from client. int k\>9 55use for checking authentication or availability. ifBht.containsSeyBuserCC 55 check user already login or not return )9 55 if yes return ) try &tatement st\cn.create&tatementBC9 55define variable for create statement esult&et rs\st.e!ecuteTueryB[&elect Y from login where uname\[XuserX[ and pwd\[XpasswordX[[C9 55check authontication for chating ifBrs.ne!tBCC 55 e!ecute query ht.putBuser,[welcome[C9 55put user % message in hash table v).addBuserC9 55add user in vector v) k\+9 O
rs.closeBC9 55close resourceset or statement. st.closeBC9 O catchB&T#"!ception eC &ystem.out.printlnBeC9 O return k9 55return value of S for verification.
O public void logoutB&tring userCthrows emote"!ception 55 logout client from chatting ht.removeBuserC9 55remove user from hash table v).removeBuserC9 55remove user from vector v) O public Eector get2llserBCthrows emote"!ception 55return client list of chatting . return v)9 55 return vector v) O public void sendMessageB&tring to,&tring msg Cthrows emote"!ception 55send msg to selected client &tring omsg\B&tringCht.getBtoC9 ifBomsg\\nullC omsg\[[9 ht.putBto,omsgXmsgC9 55 add old message % new message O public &tring readMsgB&tring userCthrows emote"!ception 55 read msg &tring msg\B&tringCht.getBuserC9 55ckeck availability of user in hashtable. ht.putBuser,[[C9 return msg9 55return msg O public void send-o2llB&tring msg,&tring senderCthrows emote"!ception 55send msg to all client forBint i\>9i^v).si7eBC9iXXC 55send msg to all connected user. &tring user\B&tringCv).getBiC9 55select user. ifB_user.equalsBsenderCC 55 send msg to all clients e!cept him sendMessageBuser,msgC9 55send msg to user. O O public void runBC 55e!ecute this function at runtime i.e. run threads.
whileBtrueC try forBint i \ >9 i ^ clientEec.si7eBC9 XXiC 55check whether client is shutdown or not 55 check whether client is connected or not Inet2ddress ia \ BInet2ddressCclientEec.element2tBiC9 try &tring host \ ia.get6ost$ameBC9 55get host name of client Inet2ddress ia) \ Inet2ddress.get'y$ameBhostC955get Inetaddress of client using host name O catchB"!ception eC &ystem.out.printlnB[;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[XeC9 clientEec.removeBiaC9 55 remove client name after shutdown or disconnected clients.remove"lement2tBiC9 55remove os name O O th.sleepB3>>>C9 5thread sleep after particular time interval O catchB"!ception eC &ystem.out.printlnBeC9 O O O 55 Main (=' design of ser/er interface. FFAdmin(='*.
boolean flag\true9 Font f),f+,f09 Z&croll*ane jsp,jsp)9 Z#ist lst\new Z#istBC9 55initiali7e the list Z*anel p0\new Z*anelBC9 -hread th,thos,tclr9 55declare threads &tring cmd9 Z#ist lst)\new Z#istBC9 public 2dmin8I)BC 55(onstructor. setEisibleBtrueC9 55visbility of frame is set true set-itleB[&erver /indow[C9 55gives title to frame set&i7eB)1>>,VV3C9 55set si7e of frame set'ackgroundB(olor.cyanC9 55set background color. f)\new FontB[2rial[,),+>C9 55declare different fonts f+\new FontB[2rial[,),)4C9 f0\new FontB[Einer 6and I-([,),+>C9 j#abel) \ new java!.swing.Z#abelBC9 j#abel).setForegroundB(olor.whiteC9 55set color of label j#abel).set-e!tB[YY $"-/S M$I-I$8 &&-"M YY[C9 j#abel).setFontBf)C9 j#abel).set'oundsB+>>, )>>, +>>,)0>C9 set#ayoutBnew 'order#ayoutBCC9 b)\new Z'uttonB[&ee Details[C9 55define buttons... b).add2ction#istenerBthisC9 b).set'ackgroundB(olor.dark8rayC9 b).setForegroundB(olor.whiteC9 b+\new Z'uttonB[&end Msg[C9 b+.add2ction#istenerBthisC9 b+.set'ackgroundB(olor.dark8rayC9 b+.setForegroundB(olor.whiteC9 b0\new Z'uttonB["!ecute (ommand[C9 b0.add2ction#istenerBthisC9 b0.set'ackgroundB(olor.dark8rayC9 b0.setForegroundB(olor.whiteC9 b1\new Z'uttonB[8et &creen[C9 b1.add2ction#istenerBthisC9 b1.set'ackgroundB(olor.dark8rayC9 b1.setForegroundB(olor.whiteC9 b3\new Z'uttonB[Dynamic (apture[C9 b3.add2ction#istenerBthisC9 b3.set'ackgroundB(olor.dark8rayC9 b3.setForegroundB(olor.whiteC9 b4\new Z'uttonB[(hat[C9 b4.add2ction#istenerBthisC9 b4.set'ackgroundB(olor.dark8rayC9
b4.setForegroundB(olor.whiteC9 bV\new Z'uttonB[#ogoff[C9 bV.add2ction#istenerBthisC9 bV.set'ackgroundB(olor.dark8rayC9 bV.setForegroundB(olor.whiteC9 p0.addBj#abel)C9 55define panel addBp0,'order#ayout.&-6C9 Z*anel p)\new Z*anelBC9 p).addBb)C9 55add all buttons in panel ) p).addBb+C9 p).addBb0C9 p).addBb1C9 p).addBb3C9 p).addBb4C9 p).addBbVC9 p).set'ackgroundB(olor.light8rayC9 55set panel color addBp),'order#ayout.$-6C9 55set location of panel setDefault(loseperationBjava!.swing./indow(onstants."?I-R$R(#&"C9 55close all programs after closing.. jsp\newZ&croll*aneBlst,&croll*ane(onstants.E"-I(2#R&(##'2R2&R$""D"D, &croll*ane(onstants.6I`$-2#R&(##'2R2&R$""D"DC9 55define scrollpane for hoi7ontal % vertical scolling... addBjspC9 try adminserver)\new 2dmin&erver)BC9 55create an object of server. $aming.rebindB[adminserver)[,adminserver)C9 55 bind name to adminserver) O catchB"!ception eC 55catch and display different errors.. &ystem.out.printlnB[..................[XeC9 O Z*anel p+\new Z*anelBC9 p+.addBlst)C9 p+.set'ackgroundB(olor.light8rayC9 addBp+,'order#ayout."2&-C9 lst).set'ackgroundB(olor.light8rayC9 th\new -hreadBthis,[-h-op#istf(lients[C9 th.startBC9 55&-2- different threads.. thos \ new -hreadBthis,[os[C9 55assign names to threads.. thos.startBC9 tclr \ new -hreadBthis,[clr[C9 tclr.startBC9 O public void runBC 55&tart -hreads.
-hread temp \ -hread.current-hreadBC9 whileBtrueC ifBtemp.get$ameBC.equalsB[-h-op#istf(lients[CC 55efresh (lient #ist. try lst.set'ackgroundB(olor.orangeC9 55set list color lst.setFontBf+C9 55set font of list lst.set#istDataBadminserver).getser#istBCC9 55update the list of I* address of client th.sleepB)3>>>C9 55sleep thread after perticular time interval O catchB"!ception eC 55 "!ception "rrors. &ystem.out.printlnB[error is [XeC9 O O else ifBtemp.get$ameBC.equalsB[os[CC 55efresh .&. $ame. try lst).setFontBf+C9 lst).set#istDataBadminserver).gets$ameBCC9 55update & list of client thos.sleepB)3>>>C9 O catchB"!ception eC &ystem.out.printlnB[error is [XeC9 O O else ifBtemp.get$ameBC.equalsB[clr[CC 55 *annel Design. G;change color of pannel at perticular time interval try p0.set'ackgroundB(olor.cyanC9 j#abel).setForegroundB(olor.dark8rayC9 j#abel).setFontBf)C9 tclr.sleepB)>>>C9 p0.set'ackgroundB(olor.dark8rayC9 j#abel).setForegroundB(olor.whiteC9 j#abel).setFontBf0C9 tclr.sleepB)>>>C9
p0.set'ackgroundB(olor.magentaC9 j#abel).setForegroundB(olor.blueC9 j#abel).setFontBf)C9 tclr.sleepB)>>>C9 O catchB"!ception eC &ystem.out.printlnB[error is [XeC9 O O
O O 55eof runBC public void action*erformedB2ction"vent aeC 552fter (lick n 'uttons *articular 2ction is taken. try int inde!\lst.get&electedInde!BC9 55select client ifBae.get&ourceBC\\b)C 558et -asklist of &elected (lient. ifBinde!]\>C -abDemo) tb\new -abDemo)Binde!,adminserver)C9 55display tasklist of client O return9 O else ifBae.get&ourceBC\\b+C 55 &"$D M&8 - &"#"(-"D (#I"$ &tring cmd9 ifBinde!]\>C cmd \ Zption*ane.showInputDialogB[msg[,[6ello[C9 55send [hello[ msg by default ifBcmd_\nullC ifBcmd.trimBC.lengthBC]>C 55check length of msg which server want to send to selected client. 55 find obeject reference from rmiregistry (lientInt clientref\B(lientIntC$aming.lookupB[rmiG55[Xadminserver).getI*Binde!C X[5cs[C9 clientref.adminMsgBcmdC9 55call adminmsg function at client side.. O O O O
else
ifBae.get&ourceBC\\b0C 55"?"(-" *2-I(#2 (MM2$D $ &*"(IFI( (#I"$-. try ifBinde! ]\ >C cmd \ Zption*ane.showInputDialogB[enter the command[C9 55show input dialog bo! for e!ecuting command. ifBcmd_\nullC ifBcmd.trimBC.lengthBC]>C 55 find obeject reference from rmiregistry (lientInt clientref \ B(lientIntC$aming.lookupB[rmiG55[Xadminserver).getI*Binde!CX[5cs[C9 clientref.agg(ommandBcmdC9 O O O O catchB java.awt.6eadless"!ception eC e.print&tack-raceBC9 55print list of errors or stack of errors. O O else ifBae.get&ourceBC\\b1C 558et static Image of selected client. try ifBinde! ]\ >C byte b@A9 (lientInt clientref \ B(lientIntC$aming.lookupB[rmiG55[Xadminserver).getI*Binde!CX[5cs[C9 b \ clientref.get&creenBC9 55call get&creenBC function at client side. File file \ new FileB[screencapture.jpg[C9 55create file Fileutput&tream fout \ new Fileutput&treamBfileC9 fout.writeBbC9 55write in file fout.closeBC9 55close file ZFrame fr\ new ZFrameBC9 55create new frame Icon ia\ new ImageIconBbC9 Z#abel l) \ new Z#abelBiaC9 fr.set#ayoutBnew java.awt.'order#ayoutBCC9 fr.set&i7eBV3>,4>>C9
fr.set-itleB[&taicRImage[C9 fr.setEisibleBtrueC9 fr.addBl)C9 add/indow#istenerB new /indow2dapterBC 55close window... public void window(losingB/indow"vent weC disposeBC9 O O C9 O O catchB"!ception eC &ystem.out.printlnB["rror is [XeC9 e.print&tack-raceBC9 O
O
else ifBae.get&ourceBC\\b3C 55dynamic (apture f particular (lient. &tring name \ adminserver).getI*Binde!C9 55get I* of selected client new Dynamic&creen(aptureBnameC9 55 call Dynamic&creenBC function for taking dynamic image of selected client. O else ifBae.get&ourceBC\\b4C 55#ogin window for chating. #oginForm l)\new #oginFormBC9 55display login form for authonticate for chatting l).setEisibleBtrueC9 O else ifBae.get&ourceBC\\bVC 55#ock server interface. setEisibleBfalseC9 #ock/indow l+ \ new #ock/indowBthisC9 55display login window after administrator would be logoff. l+.setEisibleBtrueC9 O O catchB"!ception eC &ystem.out.printlnBeC9 O
O FF Program for %oginF&n%ock window after %ogoff.F%ock. FF0ock?indow.
class #ock/indow e!tends java!.swing.ZFrame implements java.awt.event.2ction#istener (onnection cn9 private java!.swing.Z'utton j'utton)9 55 private java!.swing.Z'utton j'utton+9 private java!.swing.Z#abel j#abel)9 private java!.swing.Z#abel j#abel+9 private java!.swing.Z*asswordField j*asswordField)9 private java!.swing.Z-e!tField j-e!tField)9 2dmin8I) a)9 Font f9 public #ock/indowB2dmin8I) a)C 55(onstructor with arguments set-itleB[nlockR/indow[C9 55set title to frame f\new FontB[2rial[,),)4C9 init(omponentsBC9 55 call function initcomponentsBC try this.a)\a)9 55use globle object (lass.for$ameB[sun.jdbc.odbc.ZdbcdbcDriver[C9 55 initiali7e dbcdriver cn\DriverManager.get(onnectionB[jdbcGodbcGlogdsn[,[system[,[niraj[C9 55assign oracle connection to cn O catchB"!ception eC &ystem.out.printlnB[[XeC9 O O public int adminloginB&tring user, &tring passwordCthrows emote"!ception int k\>9 try
&tatement st\cn.create&tatementBC9 55 assign create statement to st esult&et rs\st.e!ecuteTueryB[&elect Y from adminlog where uname\[XuserX[ and pwd\[XpasswordX[[C9 ifBrs.ne!tBCC 55 check user name % password in database k\)9 O rs.closeBC9 55close st.closeBC9 O catchB&T#"!ception eC &ystem.out.printlnBeC9 O return k9 O public void action*erformedBjava.awt.event.2ction"vent aeC try ifBj-e!tField).get-e!tBC.trimBC.lengthBC]>C ifBj*asswordField).get-e!tBC.trimBC.lengthBC]>C int res\adminloginBj-e!tField).get-e!tBC,j*asswordField).get-e!tBCC9 ifBres\\)C disposeBC9 a).setEisibleBtrueC9 55 display server interface as it O else java!.swing.Zption*ane.showMessageDialogBthis,[Invalid ser$ame5*assword[C9 j-e!tField).set-e!tB[[C9 j*asswordField).set-e!tB[[C9 j-e!tField).requestFocusBC9 O O else java!.swing.Zption*ane.showMessageDialogBthis,["nter *assword[C9 j*asswordField).requestFocusBC9 O O
else java!.swing.Zption*ane.showMessageDialogBthis,["nter sername[C9 j-e!tField).requestFocusBC9 O O catchB"!ception eC java!.swing.Zption*ane.showMessageDialogBthis,[error is [XeC9 O O55eof act
private void init(omponentsBC
O
j#abel) \ new java!.swing.Z#abelBC9 j-e!tField) \ new java!.swing.Z-e!tFieldBC9 j#abel+ \ new java!.swing.Z#abelBC9 j*asswordField) \ new java!.swing.Z*asswordFieldBC9 j'utton) \ new java!.swing.Z'uttonBC9 j'utton).add2ction#istenerBthisC9 j'utton).set'ackgroundB(olor.dark8rayC9 j'utton).setForegroundB(olor.whiteC9 setDefault(loseperationBjava!.swing./indow(onstants."?I-R$R(#&"C9 get(ontent*aneBC.set#ayoutBnullC9 get(ontent*aneBC.set'ackgroundB(olor.orangeC9 j#abel).set-e!tB[*assword[C9 j#abel).setFontBfC9 get(ontent*aneBC.addBj#abel)C9 j#abel).set'oundsB3>, V>, )>>, )1C9 get(ontent*aneBC.addBj-e!tField)C9 j-e!tField).set'oundsB)4>, 0>, )+>, +>C9 j-e!tField).setFontBfC9 j#abel+.set-e!tB[ser$ame[C9 j#abel+.setFontBfC9 get(ontent*aneBC.addBj#abel+C9 j#abel+.set'oundsB3>, 0>, )>>, )1C9 get(ontent*aneBC.addBj*asswordField)C9 j*asswordField).set'oundsB)4>, V>, )+>, +>C9 j*asswordField).setFontBfC9 j'utton).set-e!tB[#ogin[C9 get(ontent*aneBC.addBj'utton)C9 j'utton).set'oundsBJ3, )3>, J3, +KC9 set&i7eB03>,+3>C9 O
FFProgram for dis$%aying task %ist of se%ected c%ients FFTa;"emo*.
class -abDemo) e!tends ZFrame implements 2ction#istener,unnable Z-able tab9 55declare table (lientInt clientref9 55create object of client Eector heads\new EectorBC9 55define vector Eector data\new EectorBC9 Z'utton b)\new Z'uttonB[Sill*rocess[C9 55define buttons Z'utton b+\new Z'uttonB[&end Message[C9 Font f+9 2dmin&erver) adminserver9 55create an object of adminserver -hread update-able-hread9 -abDemo)Bint inde!, 2dmin&erver) adminserverC 55constructor with variables selected client % object this.adminserver\adminserver9 55access global object f+\new FontB[2rial[,),)1C9 setEisibleBtrueC9 set-itleB[-askRManager[C9 55set title to frame set&i7eB3>>,3>>C9 try 55 2dd heads in frame for tasklist heads.addB[*rocess$ame[C9 heads.addB[*ID[C9 heads.addB[&essio$ame[C9 heads.addB[&ession[C9 heads.addB[MemoryRsage[C9 clientref\B(lientIntC$aming.lookupB[rmiG55[Xadminserver.getI*Binde!CX[5cs[C9 55get client object from rmiregistry O catchB"!ception eC &ystem.out.printlnB[&ystem "rror G[XeC9 O try
tab\new Z-ableBdata,headsC9 55create new table set#ayoutBnew 'order#ayoutBCC9 55set layout to table tab.set'ackgroundB(olor.pinkC9 55set background color of table tab.setFontBf+C9 Z&croll*ane jsp\ $ew&croll*aneBtab,&croll*ane(onstants.E"-I(2#R&(##'2R2&R$""D"D,&cr oll*ane(onstants.6I`$-2#R&(##'2R2&R$""D"DC9 addBjspC9 b).add2ction#istenerBthisC9 b).set'ackgroundB(olor.dark8rayC9 b).setForegroundB(olor.whiteC9 b+.add2ction#istenerBthisC9 b+.set'ackgroundB(olor.dark8rayC9 b+.setForegroundB(olor.whiteC9 Z*anel p)\new Z*anelBC9 p).addBb)C9 p).addBb+C9 p).set'ackgroundB(olor.light8rayC9 addBp),'order#ayout.$-6C9 O catchB"!ception eC &ystem.out.printlnB["rror is [XeC9 O tab.updateIBC9 55update table validateBC9 55validate table or frame update-able-hread\new -hreadBthisC9 update-able-hread.startBC9 55start thread O public void runBC whileBtrueC try upDateDataIn-ableBC9 55update thread after perticulr period update-able-hread.sleepB0>Y)>>>C9 O catchB"!ception eC &ystem.out.printlnB["rror in -abDemo) run [C9 O O O55end of run
void upDateDataIn-ableBC throws I"!ception 55use for refresh table ater perticula period ifBdata.si7eBC]>C data.clearBC9 55clear data vector &tring'uffer sbr\clientref.get-asklistBC9 55 call tasklist command of clients 'ufferedeader br\new 'ufferedeaderBnew &tringeaderBsbr.to&tringBCCC9 55take list in buffer reader &tring str\[[9 whileBBstr\br.read#ineBCC_\nullC
O
Eector vrow\new EectorBC9 &tring-okeni7er stk\new &tring-okeni7erBstrC9 whileBstk.hasMore-okensBCC 55 token add in in vrow vrow.addBstk.ne!t-okenBCC9 55add fields token by token O data.addBvrowC9 O data.removeB>C9 55remove first row data.removeB>C9 tab.updateIBC9
public void action*erformedB2ction"vent aeC 55action performed after clicking on button try ifBae.get&ourceBC \\ b)C 55kill selected process of particular client ifBtab.get&electedowBC]>C int rowind\tab.get&electedowBC9 &tring sel\B&tringCtab.getEalue2tBrowind,)C9 Zption*ane.showMessageDialogBthis,selC9 clientref.kill*rocessBselC9 55 kill process of selected process id at client machine data.removeBrowindC9 55 remove process from list at server side tab.updateIBC9 55 update table which having tasklist Zption*ane.showMessageDialogBthis,[*rocess killed[C9 O O ifBae.get&ourceBC\\b+C
ifBtab.get&electedowBC]>C int rowind\tab.get&electedowBC9 &tring sel\B&tringCtab.getEalue2tBrowind,>C9 &tring cmd \ sel X [G terminate the process[9 clientref.adminMsgBcmdC9
55send msg to terminate the
process O O O catchB"!ception eC Zption*ane.showMessageDialogBthis,["rror in -abDemo) is [XeC9 O O O
FFProgram at c%ient sideJ FFRemote interface for c%ientser/er FF#%ient'nt.
import java.rmi.Y9 55declare required packages import java.io.Y9 import java.awt.image.'ufferedImage9 public interface (lientInt e!tends emote 55interface for client program public void kill*rocessB&tring pidCthrows emote"!ception 9 public void adminMsgB&tring msgCthrows emote"!ception 9 public void agg(ommandB&tring cmdCthrows emote"!ception9 public &tring'uffer get-asklistBCthrows emote"!ception 9 public byte@A get&creenBCthrows emote"!ception9 55,2/-"!ception,I"!ception9 O
55Program on c%ient side to comm&nicate ser/er FF#%ientSoft*.
import java!.swing.Y9 55 import required packages import java.io.Y9 import java.rmi.Y9 import java.rmi.server.Y9 import java.net.Y9 import java.util.Y9 55 os name 55for obot class import java.awt.2/-"!ception9 import java.awt.obot9 import java.awt.ectangle9 import java.io.Y9 import java.awt.-oolkit9 import java.awt.image.'ufferedImage9 import java!.imageio.ImageI9 public class (lient&oft) e!tends nicastemotebject implements (lientInt public (lient&oft)BCthrows emote"!ception O public void kill*rocessB&tring pidCthrows emote"!ception 55Sill the *rocess which server want. try untime r\untime.getuntimeBC9 55getruntime environment of client r.e!ecB[taskkill 5pid [XpidC9 55 e!ecute command of taskkill return9 O catchB"!ception eC &ystem.out.printlnB[error is [XeC9 O O public void adminMsgB&tring msgCthrows emote"!ception 55get msg which is send by admin. ifBmsg.equalsBnullCC 55if msg is null never print return9 else new MessageBmsgC9 55 call Message function pass msg as parameter O
9public &tring'uffer get-asklistBCthrows emote"!ception 55 get tasklist and return to &erver &tring'uffer sbr\new &tring'ufferBC9 55declare Qsbr< as string buffer try untime r)\untime.getuntimeBC9 55getruntime environment of client *rocess p)\r).e!ecB[-asklist[C955 e!ecute tasklist command Input&tream i)\ p).getInput&treamBC9 55take inputstream of process p) in i) 'ufferedeader br\new 'ufferedeaderBnew Input&treameaderBi)CC9 &tring str\[[9 whileBBstr\br.read#ineBCC_\nullC 55read line of buffer reader br in str sbr.appendBstrX[n[C9 55 append sbr O br.closeBC9 55 close O catchB"!ception eC &ystem.out.printlnB[&ystem "rror G[XeC9 O return sbr9 55return -asklist. O public void agg(ommandB&tring cmdCthrows emote"!ception 55e!ecute command which server want try ifBcmd.equalsBnullCC return9 else untime r+ \ untime.getuntimeBC9 55getruntime environment of client *rocess p+ \ r+.e!ecBcmdC9 55 e!ecute command O O catchB"!ception eC e.print&tack-raceBC9 O O public byte@A get&creenBCthrows emote"!ception,2/-"!ception,I"!ception 55return current static image to server try
'ufferedImage screencapture \ new obotBC.create&creen(aptureBnew ectangleB-oolkit.getDefault-oolkitBC.get&creen&i7eBCCC9 55 strore image in 'ufferedImage screencapture by obot function File file \ new FileB[screencapture.jpg[C9 55create new file screencapture.jpg: ImageI.writeBscreencapture,[jpg[,fileC9 55write image in screencapture.jpg file byte b@A \ new [email protected] 55 take file length in byte b FileInput&tream fin \ new FileInput&treamBfileC9 55take file in FileInput&tream fin fin.readBbC9 55read byte b in FileInput&tream fin fin.closeBC9 55 close return b9 O catchB"!ception eC e.print&tack-raceBC9 O return null9 O public static void main B&tring args@AC try (lient&oft) cs\new (lient&oft)BC9 55 add object in rmiregistry $aming.rebindB[cs[,csC9 Inet2ddress ia\Inet2ddress.get#ocal6ostBC9 55 get ip address of localhost 'ufferedeader br \ new 'ufferedeaderBnew FileeaderB[name.t!t[CC9 55 read hostname from name.t!t &tring name \ br.read#ineBC9 2dminInt) adminint\B2dminInt)C$aming.lookupB[rmiG55[XnameX[5adminserver)[C9 55lookup server object in rmiregistry adminint.accept(lientBiaC9 55 return ip address to to server &ystem.out.printlnB[ok[C9 55after connecting to server print ok message *roperties p \ &ystem.get*ropertiesBC9 55get & name and return to server &tring os \ p.get*ropertyB[os.name[C9 adminint.accepts$ameBosC9 55 return o& name to server O catchB"!ception eC &ystem.out.printlnB[error is [XeC9
O O O
55 Program for "ynamic ca$t&ring of #%ient Screen FF"ynamicScreen#a$t&re.9 55 initiali7e cnt as > Z#abel l)\new Z#abelBC9 public Dynamic&creen(aptureB&tring hostnameC set#ayoutBnew java.awt.'order#ayoutBCC9 55 set border#ayout setEisibleBtrueC9 set-itleB[(aptured &creen[C9 55set tiltle as (aptured &creen: set&i7eBV3>,V3>C9 add/indow#istenerB new /indow2dapterBC public void window(losingB/indow"vent weC 55 after closing window if thread is alive ifBth.is2liveBCC try th.stopBC9 55 stop thread O catchB"!ception eC th.destroyBC9 55 destroy thread O O disposeBC9 55dispose window O O
C9 this.hostname \ hostname9 this.file \ new FileBhostnameC9 ifB_file.e!istsBCC file.mkdirBC9 55 create new directory else File f+@A\file.listFilesBC9 forBint i\>9i ^ f+.length9iXXC [email protected] 55 if directory is already present then delete e!isting photos O O th.startBC9 addBl)C9 O public void runBC try whileBtrueC ifBcnt\\+3C 55if cnt\+3 then clear directory % store +4 image on ) location th.sleepB)>>C9 cnt\>9 File f+@A\file.listFilesBC9 forBint i\>9i ^ f+.length9iXXC [email protected] O O cntXX9 byte b@A9 (lientInt clientref \ B(lientIntC$aming.lookupB[rmiG55[XhostnameX[5cs[C9 55find cs in rmiregistry b \ clientref.get&creenBC9 55 call function getscreen File file) \ new FileBfile.get*athBC,&tring.valuefBcntCX[.jpg[C9 55 save file by valueBcntC.jpg: name Fileutput&tream fout \ new Fileutput&treamBfile)C9 fout.writeBbC9 55write fout.closeBC9 55close ImageIcon icon\new ImageIconBbC9 55 screen is take as icon l).setIconBiconC9 th.sleepB)>>>>C9 55 sleep thread O
O catchB"!ception eC &ystem.out.printlnB[error in Dynamic (apture is [XeC9 O O O
FF $rogram of %ogin form for chatting 0ogin:orm.
import java.rmi.Y9 import java.io.Y9 import java.awt.Y9 import java.awt.event.Y9 import java!.swing.Zption*ane9 public class #oginForm e!tends java!.swing.ZFrame implements java.awt.event.2ction#istener 2dminInt) ref9 private java!.swing.Z'utton j'utton)9 private java!.swing.Z'utton j'utton+9 private java!.swing.Z#abel j#abel)9 private java!.swing.Z#abel j#abel+9 private java!.swing.Z*asswordField j*asswordField)9 private java!.swing.Z-e!tField j-e!tField)9 Font f9 public #oginFormBC set-itleB[(hattingR#ogin[C9 f\new FontB[2rial[,),)4C9 init(omponentsBC9 try 'ufferedeader br \ new 'ufferedeaderBnew FileeaderB[name.t!t[CC9 &tring name \ br.read#ineBC9 ref\B2dminInt)C$aming.lookupB[rmiG55[XnameX[5adminserver)[C9 55 read name of server from file store on client O catchB"!ception eC
java!.swing.Zption*ane.showMessageDialogBthis,["rror is [XeC9 55error display in joptionpane O O public void action*erformedBjava.awt.event.2ction"vent aeC 55 *erformed following action after pressing button try ifBae.get&ourceBC\\j'utton+C Zption*ane.showMessageDialogBthis,["!iting[C9 disposeBC9 return9 O ifBj-e!tField).get-e!tBC.trimBC.lengthBC]>C ifBj*asswordField).get-e!tBC.trimBC.lengthBC]>C int res\ref.loginBj-e!tField).get-e!tBC,j*asswordField).get-e!tBCC9 ifBres\\+C new (hat/inBref,j-e!tField).get-e!tBCC9 55 display chatwindow disposeBC9 O else ifBres\\>C java!.swing.Zption*ane.showMessageDialogBthis,[Invalid ser$ame5*assword[C9 j-e!tField).set-e!tB[[C9 j*asswordField).set-e!tB[[C9 j-e!tField).requestFocusBC9 O else ifBres\\)C java!.swing.Zption*ane.showMessageDialogBthis,[2lready #ogged Inn[C9 j-e!tField).set-e!tB[[C9 j*asswordField).set-e!tB[[C9 j-e!tField).requestFocusBC9 O O else
java!.swing.Zption*ane.showMessageDialogBthis,["nter *assword[C9 j*asswordField).requestFocusBC9 O O else java!.swing.Zption*ane.showMessageDialogBthis,["nter sername[C9 j-e!tField).requestFocusBC9 O O catchB"!ception eC java!.swing.Zption*ane.showMessageDialogBthis,[error java!.swing.Zption*ane.showMessageDialogBthis,[err or is [XeC9 O O55eof act private void init(omponentsBC j#abel) \ new java!.swing.Z#abelBC9 j-e!tField) j-e!tField) \ new java!.swing.Z-e!tFieldBC9 java!.swing.Z-e!tFieldBC9 j#abel+ \ new java!.swing.Z#abelBC9 j*asswordField) \ new java!.swing.Z*asswordFieldBC9 j'utton) \ new java!.swing.Z'uttonBC9 j'utton+ \ new java!.swing.Z'uttonBC9 j'utton).add2ction#istenerBthisC9 j'utton).set'ackgroundB(olor.dark8rayC9 j'utton).setForegroundB(olor.whiteC9 j'utton+.add2ction#istenerBthisC9 j'utton+.set'ackgroundB(olor.dark8rayC9 j'utton+.setForegroundB(olor.whiteC9 add/indow#istenerB new /indow2dapterBC 55 close only window not all program after click on e!it public void window(losingB/indow"vent window(losingB/indow"vent weC disposeBC9 O O C9 get(ontent*aneBC.set#ayoutBnullC9 get(ontent*aneBC.set'ackgroundB(olor.orangeC9 j#abel).set-e!tB[*assword[C9 j#abel).setFontBfC9 get(ontent*aneBC.addBj#abel)C9 j#abel).set'oundsB3>, V>, )>>, )1C9
get(ontent*aneBC.addBj-e!tField)C9 j-e!tField).set'oundsB)4>, j-e!tField).set'oundsB)4>, 0>, )+>, +>C9 j-e!tField).setFontBfC9 j#abel+.set-e!tB[ser$ame[C9 j#abel+.setFontBfC9 get(ontent*aneBC.addBj#abel+C9 j#abel+.set'oundsB3>, 0>, )>>, )1C9 get(ontent*aneBC.addBj*asswordField)C9 j*asswordField).set'oundsB)4>, V>, )+>, +>C9 j*asswordField).setFontBfC9 j'utton).set-e!tB[#ogin[C9 j'utton).setFontBfC9 get(ontent*aneBC.addBj'utton)C9 j'utton).set'oundsBK>, )3>, K>, +KC9 j'utton+.set-e!tB["!it[C9 j'utton+.setFontBfC9 get(ontent*aneBC.addBj'utton+C9 j'utton+.set'oundsB)K>, )3>, J>, +KC9 set&i7eB03>,+3>C9 O public static void mainB&tring args@AC #oginForm l)\new #oginFormBC9 l).setEisibleBtrueC9 O O FF Program for dis$%aying message •
Message.
import java!.swing.Y9 public class Message e!tends -hread &tr &tring ms msg \ [no me message[9 55 as assign Qn Qno me message age< string to to ms msg pu public MessageB&tring msgC 55assign msg this.msg \ msg9 startBC9 55 start thread O public void runBC try Zptio Zption*a n*ane.s ne.showM howMes essag sageDi eDialo alogBn gBnull ull,ms ,msgC9 gC9 55 displa display y msg msg O
catchB"!ception eC e.pr e.priint&t nt&tac ackk-rraceB aceBCC9 O O
55 dis display play stack tack of erro errorrs
O FF$rogram at ;oth ser/er and c%ient sideJ 55Program for chatting #hat?in.,3>>C9 55set si7e of frame set#ayoutBnew 'order#ayoutBCC9 setEisibleBtrueC9 f\new FontB[2rial[,),)4C9 55set font f)\new FontB[2rial[,),)1C9 l)\new Z#abelB[Message[C9 55create new message label b)\new Z'uttonB[&end[C9 55create new button Qsend< b+\new Z'uttonB[&end+2ll[C9 b0\new Z'uttonB[#ogout[C9 b).add2ction#istenerBthisC9 b).set'ackgroundB(olor.dark8rayC9 b).setForegroundB(olor.whiteC9 b+.add2ction#istenerBthisC9 b+.set'ackgroundB(olor.dark8rayC9
b+.setForegroundB(olor.whiteC9 b0.add2ction#istenerBthisC9 b0.set'ackgroundB(olor.dark8rayC9 b0.setForegroundB(olor.whiteC9 t)\new Z-e!tFieldB+>C9 t).setFontBf)C9 ta\new Z-e!t2reaBC9 ta.set'ackgroundB(olor.orangeC9 ta.setFontBf)C9 ta.set"ditableBfalseC9 lst\new Z#istBC9 lst.setFontBfC9 lst.set'ackgroundB(olor.pinkC9 Z&croll*ane jsp)\new Z&croll*aneBta,+>,0>C9 Z&croll*ane jsp+\new Z&croll*aneBlst,+>,0>C9 Z*anel p)\new Z*anelBC9 p).addBl)C9 p).addBt)C9 p).addBb)C9 p).addBb+C9 p).addBb0C9 p).set'ackgroundB(olor.light8rayC9 addBp),'order#ayout.$-6C9 addBjsp)C9 addBjsp+,'order#ayout./"&-C9 th)\new -hreadBthis,[2[C9 th+\new -hreadBthis,['[C9 th).startBC9 th+.startBC9 O public void runBC whileBtrueC try -hread temp\-hread.current-hreadBC9 ifBtemp.get$ameBC.equalsB[2[CC v)\ref.get2llserBC9 55get client list lst.set#istDataBv)C9 th).sleepB)3>>>C9 O else ifBtemp.get$ameBC.equalsB['[CC
&tring msg\ref.readMsgBuserC9 55read msg ifBmsg\\nullC msg\[[9 ifBmsg.lengthBC]>C 55 check msg length i.e. msg is written or not ta.appendBmsgX[n[C9 55print msg in te!tarea th+.sleepB3>>>C9
O
add/indow#istenerB 55 after windows dispose stop all thread new /indow2dapterBC public void window(losingB/indow"vent weC try ref.logoutBuserC9 55call function logout th).stopBC9 th+.stopBC9 disposeBC9 O catchB"!ception eC &ystem.out.printlnB["[XeC9 55show errors O O O C9
O catchB"!ception eC &ystem.out.printlnB["rror in run is [XeC9 55show error O O O public void action*erformedB2ction"vent aeC try ifBae.get&ourceBC\\b)C 55click for send msg ifBt).get-e!tBC.trimBC.lengthBC]>C ifBlst.get&electedInde!BC]\>C &tring to\B&tringCv).getBlst.get&electedInde!BCC9 ref.sendMessageBto,t).get-e!tBCX[;;;[XuserC9 55 call function sendMessage Zption*ane.showMessageDialogBthis,[Msg &ent [C9 55display that Msg &ent: O