You are on page 1of 68

1.

INTRODUCTION

monitoring is the main aspect of Network with out monitoring, Network


never succeeds. Active Network system is a system for monitoring the clients
and server in the network. It should allow System Administrators to gather
information from all the clients in the network without installing server-side
applications on the computers.

1.1 Problem
This project ANS is a administrator assistant. Network monitoring is
handled in two modules namely LAN Monitoring and Application Monitoring.
LAN monitoring determines the host name, host address and type of address
assigned in LAN, the routing table, protocol statistics and h/w addresses in
LAN .In application monitoring it monitors application’s usage, session
maintenance and broadcasting.
6t7t7868dfhgfhgjhgjj
1.2 Software Tools
Operating System : Windows XP
Language : Java1.5, JSP2.0
Database : MS- Access

1.2.1 FEATURES OF JAVA


The Software tool used to implement this project is an outstanding
Language “JAVA”
Java is familiar and simple
Java programs simply import the s/w packages they need. These
packages may be in another directory or another drive. The java compiler and
interpreter figure out what objects are referenced and supply the necessary
linkage.

1
Java is object oriented
Java deals with classes and objects, pure and simple.
Java is safer and more reliable
Java won’t automatically convert data types. You have to explicitly
convert from one class to another. Complex printer arithmetic is avoided.
Java is secure
The java runtime system is designed to enforce a security policy that
prevents execution of malicious code. It does this by remembering how
objects are secure access to those objects according to its security rules. It
performs byte code. Verification by passing compiled classes through a
simple theorem proves that either proves that the code is secure or prevents
the code from being loaded and executed. The class is java’s basic execution
unit and security is implemented at the class level.
Java is interpreted and portable

FEATURES OF JSP

Java Server Pages (JSP) is a technology that lets you mix regular,
static HTML with dynamically generated HTML
JSP technology has facilitated the segregation of work profile of a Web
designer and a Web developer
A JSP page after compilation generates a servlet and incorporates all
servlet functionalities
Servlet and JSP thus share common features such as platform
independence, creation of database driven web Application and server side
programming capabilities.

2
1.3 PROBLEM STATEMENT

The main modules of this project Active Network System (ANS) are
• LAN monitoring
• Application Monitoring
1.3.1 LAN Monitoring
This module is designed as GUI Mode Application. So that it is very
easy to handle by end users.
This main objective of the project is used to avoid Data Collision / IP
Confliction between a System and another system of same or different block
when each blocks interconnected.
It is used to determine Host Names, Host Addresses of systems of in
this LAN and systems of different block when each block is interconnected. It
determines routing table of the server host, network protocol statistics in the
LAN and H/W address of each host in the LAN.
Also determines which type of IP Address assigned to a system or
group of systems of this LAN or different LAN when each block is
interconnected after the connection was established.
It involves establishing connection to the remote Host(s) given by the
user. It is possible to send messages between systems in LAN.
Additional features like Calculator and browser is included in this
project to improve the user interface.

1.3.2 Application Monitoring


In this module an application like Website is going to monitor.
The Application module helps the administrator to measure how many users
is using the application for the specified day or specified period of time. This
information will not be made visible to the end users of the application. This
project assists the administrator for the future enhancement of the application.

3
1.4 METHODOLOGY

In this project the important concepts in JAVA are described below


1.4.1 Class
Classes encapsulate the objects. A single class can be used instantiate
multiple objects. This means that you can have many active objects or
instance of a class.
Class<classname>
{
Variable declarations;
}
<classname> <object name>;

Action Listener
The action Listener is a key word for the concept of Event handling.
The event class is central to the JAVA window event generation and handling
mechanism. Event objects are generated by the user who interacts with a
JAVA window program or applet and by the JAVA runtime system. User
generated events occur when user make selection on a menu or press a key
Events generated by the runtime system include errors and Exceptions. They
are handled by the set of predefined event-handling methods that are defined
by the component class and its subclass.
Class<class name> implements Action Listener
{
St1;
St2;
}
Public void action performed (Action Event ae)
{
-----
-----
-----
}

4
Exceptions
JAVA handles potentially recoverable errors through exceptions a
special object class that handles virtually all errors in JAVA. Exception
handling code resides in the java. Lang package and is automatically included
in all compiled code. JAVA uses the try catch and throws keywords to do
actual exception handling. They are conceptually similar to switch statement.
Throw
The first concept in exception handling is throwing an exception. If the
error during reading the file ie says a method could not read the file because
the file did not exit, this would generate an IOException in JAVA terminology. It
is said that the method threw an IOException.
Catch
An exception catch is code that realizes the exception has occurred
and deals with it

1.4.2 Java.net PACKAGES


GetName
Set the name of this network interface

Syntax
Public string getName( )
String S = Ia.getName( )
System.out.println(S);
getInetAddresses
Convenience method to return an enumeration will all or a sub set of
the InetAddresses bound to the network interface.

Syntax
InetAddress<array obj> = InetAddress.getInetAddress( )

getDisplayName

5
Get the display name of this network interface. A display name is a
human readable string describing the network device.

Syntax
Ia.getDisplayName( );
Where, Ia is object of the InetAddres class.

getByName
Searches for the network interface with the specified name.
syntax
Ia.getByName(<IPAddress>) / < Host Name> )
Where, ia is an object of the class InetAddress.

getByInetAddress
Convenience method to search for a network interface that has the
specified internet protocol (IP) address bound to it. If the specified (IP address
is bound to multiple network interfaces it is not defined which network
interface is returned.

Syntax
NetworkInterface getByInetAddress(Inet Address ia)

getNetworkInterfaces
Returns all the interfaces on this machine. Returns null if no network
interfaces could be found on this machine. If returns an enumeration of
network interfaces found on this machine.

getAllByName
This method returns all IP address of this machine or remote machine
it associates with InetAddress object.

Syntax
InetAddress ia.getAll By Name(charles);
getHostName

6
Returns a HostName of the given IP address is associates with
InetAddress object.
Ia.getHostName( )
getHostAddress
It returns IP address of the given HostName. It gets with the object of
InetAddress class
1.4.3 JAVA I/O PACKAGE
The java .io. Package contains various types of classes and its
respective packages. These packages used to read data from memory
devices such as floppy disk, Hard disk, CD Rom, Flash memory and also from
primary memory. Also write Data to memory devices such as FDD, HDD,
CDROM, etc.
Type of I/O streams:
There are various types of streams found in java.io.* package. They
are

1. ByteArrayInputStream:
Allows a buffer in memory to be used as an input stream
Methods:
available ( ), mark ( ), mark supported ( ), read ( ), insert ( ) & skip( )
2. FileInputStream:
For reading information from a file
Methods:
available ( ), close( ), finalize( ), read( ), skip( ).
3. FilterInputStream:
Abstract class providing an interface for useful functionality to the other
input stream classes.
Methods:
available ( ), close( ), mark( ), mark supported( ), skip( ), read( ),
reset( ).
4. ByteArrayOutputStream:
Creates a buffer in memory. All the data we send to stream is placed in
this buffer.
Methods:

7
reset(), size( ), toBytearray( ), tostring( ), write( ), writeto( ).
5. FileOutputStream:
For sending information to a file
Methods:
Close( ), finalize( ), write( ).
6. FilterOutputStream:
Abstract class providing an interface for useful functionality to the other
o/p stream classes.
Method:
Close( ), finalize( ), write( ).
7. FileReader:
The file reader class enables reading character files. It uses default
character encoding.
Constructor:
Public file reader (File f)
8. CharArrayReader:
The char array reader allows the usage of a character array as an input
stream. This class is similar to Byte Array Input stream.
Constructor:
Public char Array Reader (char ch []);
9. StringReader:
The string Reader class reads characters from a string.
Constructor:
Public string Reader (String s);
10. FileWriter:
The file writer allows writing character files. It uses the default encoding
character and buffer size. This class is similar to that of file output stream
class.
Constructor:
Public file writer (File f)
11. CharArrayWriter:
This class allows to use a character buffer as an o/p stream.
Constructor:
Public char Array writer( ).

8
12. BufferedWriter:
The buffered writer class buffers data to the character output stream.
Constructor:
Public buffered writer (writer w)
1.4.4 javax.swing PACKAGES
Swing Classes
Swing classes can be used to produce pure 100% java windowing
toolkit. Some swing classes and its descriptions are as follows.
1. JFrame
This class represents the swing frame that is more sophisticated than
the AWT frame. You can add components in layers, add a Manu bar, or paint
over the component.
Constructor
JFrame <object> = new J frame (<title>);
Ex.
JFrame Jfm = new J frame (“Remote Host Monitory System”);
2. Container
The container class have few layout managers by using any one of
these layout managers, a program can control the arrangement and sizes of
components to preserve the appearance of a user interface.
They are as follows:
 Flow layout
 Grid layout
 Border layout
 Grid Bag layout
 Box layout
 Overlay layout
 Scroll pane layout
 View port layout

Constructor
Container <obj> = <frame object> . get content pane ();
Ex

9
JFrame jfm = JFrame(“monitoring”);
Container cnr = jfm.getContentPane ();
Cnr.setlayout(null);
3. JMenuBar
A menu bar is a narrow rectangular component that is positioned at the
top edge of an applet or a frame. The menu bar contains the labels of drop
down menus that will be attached to if.

Constructor
JMenuBar <obj> = new JMenuBar();
Ex
JMenuBar jmb = new JMenuBar();
4. JMenu
Once a menu bar has been created you can add menus to it by using
the following constructors
Public JMenu ()
Public JMenu(String title)
Public JMenu(String label, Boolean turn_ off)

The Boolean parameter is meant to declare whether the menu is turn _


off or not. The turn _ off menus are menus with there own look and feel.
Ex JMenu jm = new JMenu(“file”);
JMenu jm = new JMenu(“file”, true);
5. JMenuItem
The swing menu item can be a created with simple text, an icon, or
both you can also specify the mnemonic key, Typically you create a menu
item and then add if to a menu.
The following is the list of constructors supported to create menu item
objects.
Public JMenuItem()
Public JMenuItem(Icon icn)
Public JMenuItem(String text)
Public JMenuItem(String text, Icon icn)
Public JMenuItem(String text, int mnemonic);

10
Ex
JMenuBar jmb = new JMenuBar()
JMenu JM = new JMenu(“File”)
JMenuItem jmi = new JMenuItem(“search”);
Cnr.add(jmb)
Jmb.add(jm)

6.JButton
The class represents swing buttons. These buttons can poses an icon
as well as text with suitable (absolute as well as relative) positioning.

Constructor
JButton <obj> = new JButton(<caption>)
Ex
JButton jbn = new JButton(“Ok”)

7. JLabel
This class represents swing labels that can display a place of text as
well as icons with suitable positioning. A label object can be created by using
the following statement:

Constructor
JLabel<obj> = new JLabel(text)
Ex. JLabel Jlb = new JLabel(“Enter your name”);
8. JComboBox
A swing combo box is an enhancement over the AWT component
called choice. The combo box is a pull down list with a capability to display the
selected item in a display area. You can also enter an item in the display area
to edit it info the list.

Constructor
JComboBox <obj> = new JComboBox( )
Ex. JComboBox jcb = new JComboBox( )

11
9. JTextField
The swing text field can be used to display or edit a single line of plain
text. The swing text field is a light weight component. A text field object is
created by using the class JText field, which is a direct subclass of JText
component.

Constructors
public JTextField( )
public JTextField(String text)
public JTextField(String text, int width)
public JTextField(Document model, string text, int width);
Ex.
JText Field JTF = new JText Field(“Welcomes you”);

12
1.5. PROBLEM DESCRIPTION
1.5.1 NETWORKING
Networking is the means by which computers share and exchange
information and resources across either short distances Local Area Network
(LAN) or globally wide Area Networks (WAN). Making the best use of
networking technology is about making better use of business resources,
enhancing productivity and efficiency, reducing costs and gaining competitive
advantage.
Networking enables everyone in an organization to communicate with
and share resources with everyone else-giving them access to data held in
individual PCs by remote office sites or external suppliers and giving users the
ability to share printers, fax, CD-ROM and Modem Technology, etc. networks
can be designed for organizations of all sizes from the small office with
between two and ten workstations to the largest international corporations
linking thousands of workstations.
1.5.1.1 Local Area Network (LAN)
A LAN is a group of desktop computers located relatively close to one
another and connected through cabling system to enable them to share
access to computing resources. LAN satisfies two fundamental requirements
(a) sharing information, and (b) sharing computer resources.
A LAN typically consists of PCs on the same floor in the same
buildings. It may even consist of computers which are with in the factory area,
but spread across various buildings like administrative block or production
block or warehouse, etc.
LANs consist of workstations which are connected to a central
computer called file server (special purpose computers). [Workstations are the
nodal computers on which users do their work-like executing their own
applications programs locally and sending request to the file server for any of
the network function and receiving the response from the file server. All
workstations on LAN would have a Network interface.
LAN’s topology is of 3 types (a) star, (b) Ring, and (c) Bus. LAN can be
connected to larger networks including mainframe computers. This gives the
user of LAN access to enormous computing power and excellent

13
communication facilities. The distinctive feature of LAN is its inherent
capability for distributed processing.
LANs use File servers to control and manage the network resources
which are shared by the Network users. These file servers are used to
perform (a) control of the traffic of requests and messages on the network, (b)
security requirements, (c) centralized Hard disk storage, and (d) control of
peripherals like printers, etc.
1.5.2 HOST AND NETWORKS
IP addressing is based on the concept of Host and networks. A host is
essentially anything on the network that is capable of receiving and
transmitting IP packets on the network servers and client workstations are IP
hosts.
The hosts are connected together by one or more networks the IP
address of any host consists of its network address plus its own host address
on the networks.
1.5.2.1 IP addressing and classes

An IP address is 32 bits wide, and as discussed, it is composed of two


parts the network number, and the host number. By convention, it is
expressed as four decimal numbers separated by periods. Such as
“172.100.101.134” representing the decimal value of each of the four bytes.
Valid addresses thus range from 0.0.0.0 to 255.255.255. a total of
about 4.3 billion addresses.
Any address starting with 127 is a loop back address and should never
be used for addressing outside the host. A host number of all binary is
indicates a directed broadcast over the specific network.
A network is a set of computers and peripherals which are physically
connected together. Networking enables sharing of resources and
communication. Networking in Java is possible through the use of java.net
package. The classes within the package encapsulate the socket model
developed by Bex Koley software division.

14
1.5.2.2 Protocols

Communication between computers in a network or a different network


requires certain set of rules which is called protocols java networking is done
using TCP/IP protocol. Some of the different kinds of protocols available are
HTTP, FTP, SMTP, SNMP, NNTP, etc.
1.5.2.3 Client and Server

A computer, which requests for some service from another computer, is


called a client. The one that processes the request is called as server. A
server waits till one of its clients makes a request. It can accept multiple
connections at a time to the same port number.
1.5.3 TCP (Transmission Control Protocol)

The most common higher level protocol in the suite is TCP. It provides
a reliable, connection-oriented packet delivery service on top of IP.
TCP guarantees the delivery of packet, ensure proper sequences of
the data, and provide a check sum secure that validates both the packet
heads and its data for accuracy.
This reliable makes TCP protocol of choice for session based data
transmission, client-server application and critical services, such as electronic
mail. Because TCP headers required additional bits to provide proper
sequencing of information, as well as a check sum to ensure reliability of both
the TCP packet header & the packet, TCP is slower than UDP

To guarantee successful data delivery, the protocol also required that


the recipient acknowledge successful receipt of data.

15
1.5.3.1 TCP PACKET STRUCTURE:

S.No Field Explanation


01. Source port TCP port of sending host
02. Destination port TCP port of destination host
03. Sequence number Ensures all bytes have been received
04. Ack number The sequence number of the next byte
05. Data length Length of the TCP segment
06. Reserved Reserved
07. Flags What content is in the segment
08. Windows How much space is in the TCP windows
09. Check sum Ensures validity of the header
10. Urgent pointer If urgent data is being sent, this specifies
the end of that data in the segment.

1.5.4 IP (Internet Protocol)

IP provides packet delivery for all higher level protocol within the suite.
It provides best efforts delivery of as unreliable and connection less nature.
Delivery is not guaranteed and a packet might be last, delivery out of
sequence duplicated or delayed.

1.5.4.1 IP PACKET STRUCTURE

1. Source IP address - Identifies the sender of the datagram


by IP address
2. Destination IP address - Identifies the destination of the
datagram by IP address.
3. Protocol - Indicates whether the data should
be passed to UDP or TCP at
the destination host.
4. Checksum - A field used to verify the packets
integrity upon arrived at the
destination.
5. Time to Live - The number of seconds a datagram is
allowed to stay on the network before

16
being discarded, otherwise packets could
endlessly loop around an internet.
A router will decrease the TTL by at
Least 1 second when if handles the
Packet, and is required to decrement the
TTL by at least the time spent in the router.

17
CHAPTER -2

2. SOFTWARE AND HARDWARE REQUIREMENTS

2.1 Hardware requirements

• Pentium II 266 Mhz

18
• 64 MB RAM

• Hard Disk Drive 6GB

2.2 Software requirements

• Microsoft Windows XP

• Winsock 2.0

• SMTP

• Apache Tomcat Server 5.0

19
CHAPTER -3

3. SYSTEM ANALYSIS &DESIGN

20
3.1 SYSTEM FLOW DIAGRAM

3.1.1 LAN MONITORING


This module is used to determine Host Names,
Host Addresses of systems of in this LAN and systems of different block when
each block is interconnected. It determines routing table of the server host,
network protocol statistics in the LAN and H/W address of each host in the
LAN.

Fig6.1.LAN Monitoring work flow


3.1.2 APPLICATION MONITORING

21
in this module an application like Website is going to monitor.
The Application module helps the administrator to measure how
many users is using the application for the specified day or
specified period of time.

22
LOGIN NEW USER

USER VALIDITY EXISTING USER

ADMIN USER

ADMIN USER SERVER MAIL


DETAIL DETAILS DETAILS DETAILS

TOTAL CLIENT NO OF
USERS AND MAILS
SERVER SEND
DETAILS

MAILING COMPOSE AND SESSION


PAGE SEND MAIL MAINTANANCE

LOGOUT

APPLICATION MONITORING MODULE.

23

If ctr > 15 min


3.2FEASIBILITY STUDTY
The feasibility study is examining all issues related to this proposal,
including privacy, reporting burden, technical capabilities, and the coordination
of reporting for public institutions, timing/census dates, and implementation
The three primary areas of feasibility study are:
• Economic feasibility
• Technical feasibility
• Legal feasibility

The Economic study is based on the cost-benefit analysis, potential


market growth, cost of resources needed for development etc., as this project
is dealt with cost benefit analysis, so that the cost does not overweigh the
benefits
The Technical study is of product engineering process, where
functions, performance and constraints are the major heads.
All the legal formalities such as contracts, which include liability,
infringement, legal approval and justifications, are been made for the
proposed system.
• This project is feasible with current technology since all the software
used are available in our environment
• This project is economically feasible since software can de
downloaded from internet at free of cost
• This project is technically feasible since it continuously monitors the no.
of clients we can increase the instance number whenever needed

24
3.3 DATA COLLECTION
Data was collected only for application module. MS Access was used
as the back end.

The essential data can be classified into three categories.

• Server details
• User details
• Messaging details

In server details static information like server version number and compatible
versions are stored. This information is essential for any new administrator for
accompanying the applications.

In User Details information like number of clients visited the application for
any particular date from the date of installing the application is maintained.
For any particular session login and logout time is maintained. This
information is utilized in instance control.
Details regarding existing users their authorized status and their password are
maintained. This criteria is for abstraction.
Facility for new user registration is also provided, so information regarding
new user is also maintained.

In Messaging Details, Details include the client who have messaged to the
admin, their message, message size, date of messaging are stored.

25
3.4 DATABASE DESIGN
• Table Name : Server Details
Table Description : This stores static server details

FIELDS DATATYPE
Servlet/JSP specification Text(15)
Version Text(15)
• Table Name : Number of users
Table Description : This is to find the number of users visited
the Application in a particular date.

FIELDS DATATYPE
S.No Auto Number
Date Text(15)
No.of .User Number
• Table Name : New user
Table Description : This stores registration information

FIELDS DATATYPE
Row id Auto Number
FName Text(20)
LName Text(20)
Pwd Text(6)
Age Number
Gender Text(6)
Address Text(50)
Phone Number
Mail-id Text(20)
• Table Name : Messaging Details
Table Description : This table contains data about the clients
Who messaged for the application admin
FIELDS DATATYPE
Row-id Number
To addr Text(15)
From Text(15)
addr
Subject Text(10)
Msg Text(100)

26
Msg Size Number
Date Text(10)

• Table Name : Login


Table Description : This table is for Login validation
FIELDS DATATYPE
Uname Text(30)
Pword Text(6)
Status Text(2)

• Table Name : Session Details


Table Description : This table is for session maintenance
FIELDS DATATYPE
Uname Text(30)
Host Text(10)
Login Text(10)
Logout Text(10)
Date Text(10)

3.5 Source Code


3.5.1 Sample code for LAN Monitoring

import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.net.*;
import java.io.*;
import java.net.InetAddress.*;
public class NetView extends JFrame
{
JButton jbn;
Icon icn;
NetView()

27
{
JMenuBar jmb=new JMenuBar();
Container cnr=this.getContentPane();
cnr.setLayout(null);

JMenu file=new JMenu("File");


JMenu view=new JMenu("View");
JMenu mesg=new JMenu("Net Shower");
JMenu appl=new JMenu("Utility");
JMenu help=new JMenu("Help");
JMenu ByIp=new JMenu("IP Local LAN");
JMenu Ipot1=new JMenu("IP Selective");
JMenu find=new JMenu("Search");
JMenuItem Ipot2=new JMenuItem("IP of All");
JMenuItem eXit=new JMenuItem("Exit");
JMenuItem ByHo=new JMenuItem("By Host Name");
JMenuItem Repo1=new JMenuItem("Consolidate");
JMenuItem Repo2=new JMenuItem("Passed");
JMenuItem Repo3=new JMenuItem("Failed");
JMenuItem Calc=new JMenuItem("Calculator");
JMenuItem noTe=new JMenuItem("Browser");
JMenuItem mesg1=new JMenuItem("Sessioner");
JMenuItem mesg2=new JMenuItem("Viewer");
JMenuItem mesg3=new JMenuItem("Message");
JMenuItem mesg4=new JMenuItem("MAC_Addr");
JMenuItem mesg5=new JMenuItem("Proto_Statis");
JMenuItem mesg6=new JMenuItem("Name_Tbl");
JMenuItem Read=new JMenuItem("Read Me");
JMenuItem Myho=new JMenuItem("My Host");
JMenuItem Sthi=new JMenuItem("Single Host");
JMenuItem Soth=new JMenuItem("A Host");
JMenuItem Mthi=new JMenuItem("Several Host");
JMenuItem Moth=new JMenuItem("All Hosts");
file.setMnemonic('F');

28
find.setMnemonic('S');
view.setMnemonic('V');
appl.setMnemonic('U');
help.setMnemonic('H');
mesg.setMnemonic('M');
eXit.setMnemonic('X');
Repo1.setMnemonic('C');
Repo2.setMnemonic('P');
Repo3.setMnemonic('F');
Calc.setMnemonic('C');
noTe.setMnemonic('B');
Read.setMnemonic('R');
mesg1.setMnemonic('S');
mesg2.setMnemonic('V');
mesg3.setMnemonic('M');

find.add(Myho);
find.add(ByHo);
find.add(ByIp);
find.add(Ipot1);
find.add(Ipot2);
file.add(find);
file.add(eXit);

view.add(Repo1);
view.add(Repo2);
view.add(Repo3);
mesg.add(mesg4);
mesg.add(mesg5);
mesg.add(mesg6);
mesg.add(mesg1);
mesg.add(mesg2);
mesg.add(mesg3);
appl.add(Calc);

29
appl.add(noTe);
help.add(Read);
ByIp.add(Sthi);
ByIp.add(Mthi);
Ipot1.add(Soth);
Ipot1.add(Moth);

icn=new ImageIcon("d:/lanmonitor/natpark.jpg");
jbn=new JButton("",icn);
jbn.setLocation(300,150);
jbn.setSize(240,240);

jmb.add(file);
jmb.add(view);
jmb.add(appl);
jmb.add(mesg);
jmb.add(help);
cnr.add(jbn);
Ipot2.addActionListener(new Action());
eXit.addActionListener(new Action());
ByHo.addActionListener(new Action());
Sthi.addActionListener(new Action());
Soth.addActionListener(new Action());
Mthi.addActionListener(new Action());
Moth.addActionListener(new Action());
Myho.addActionListener(new Action());
Repo1.addActionListener(new Action());
Repo2.addActionListener(new Action());
Repo3.addActionListener(new Action());
mesg1.addActionListener(new Action());
mesg2.addActionListener(new Action());
mesg3.addActionListener(new Action());
mesg4.addActionListener(new Action());
mesg5.addActionListener(new Action());

30
mesg6.addActionListener(new Action());

Calc.addActionListener(new Action());
noTe.addActionListener(new Action());
Read.addActionListener(new Action());

setTitle(" Active Network System - Network Monitoring :


Done by : J.Geetha,S.Indhumathi,M.Lakshmibala");
setSize(800,600);
setJMenuBar(jmb);
show();
}
public static void main(String arg[]) throws Exception
{
NetView n=new NetView();
}
}

class Action implements ActionListener


{
String s,s1;
public void actionPerformed(ActionEvent e)
{
s=e.getActionCommand();
if(s=="Exit")
{
System.exit(0);
}
if(s=="Browser")
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("c:/Program files/Internet Explorer/iexplore");

31
}
catch(Exception e1)
{
String act="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(act);
}
}
if(s=="Calculator")
{ Runtime rt=Runtime.getRuntime();
try
{
rt.exec("u:/Calf.class");
}
catch(Exception e1)
{
String act="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(act);
}
}
if(s=="Consolidate")
{
Runtime rt=Runtime.getRuntime();
Process p=null;
try
{
p=rt.exec("Wordpad d:\\ Consol.class");
p.waitFor();
}
catch(Exception e1)
{
String s1="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();

32
msg.ErrorMesgWin(s1);
}
p.exitValue();
}

if(s=="Passed")
{
Runtime rt=Runtime.getRuntime();
Process p=null;
try
{
p=rt.exec("wordpad d:\\ Passed.class");
p.waitFor();
}
catch(Exception e1)
{
String s1="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(s1);
}
p.exitValue();
}

if(s=="Failed")
{ Runtime rt=Runtime.getRuntime();
Process p=null;
try
{
p=rt.exec("wordpad.exe d:\\ Failed.class");
p.waitFor();
}
catch(Exception e1)
{
String s1="Invalid Path/File Name";

33
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(s1);
}
p.exitValue();
}
if(s=="Sessioner")
{
Runtime rt;
Process p;
try
{
rt=Runtime.getRuntime();
p=rt.exec("d:/lanmonitor/session.bat");
p.waitFor();
p.exitValue();
rt.exec("notepad d\\Session.class");
}
catch(Exception e1)
{
String s1="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(s1);
}
}
if(s=="Viewer")
{
Runtime rt;
Process p;
try
{
rt=Runtime.getRuntime();
p=rt.exec("d:/viewer.bat");
p.waitFor();
p.exitValue();

34
rt.exec("notepad d: \\SViewer.class");
}
catch(Exception e2)
{
String s1="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(s1);
}
}
if(s=="Message")
{
MessageSender ms=new MessageSender();
ms.MsgSender();
}
if(s=="Read Me")
{
Runtime rt;
Process p;
try
{
rt=Runtime.getRuntime();
p=rt.exec("WordPad d:/lanmonitor/mainfiles/Readme.txt");
p.waitFor();
p.exitValue();
}
catch(Exception e1)
{
String s1="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(s1);
}
}
if(s=="My Host")
{

35
MyHost mY=new MyHost();
mY.IamUrHost();
}
if(s=="By Host Name")
{
HostWise Hw=new HostWise();
Hw.HWisesrc();
}
if(s=="Single Host") //IP Local LAN <Single Host>
{
SglinLAN sgli=new SglinLAN();
sgli.SglInLAN();
}
if(s=="A Host") //IP Selective <Remote Host>
{
SgloutLAN sglo=new SgloutLAN();
sglo.SglOutLAN();
}
if(s=="Several Host") //IP Local LAN <Several Host>
{
LANin mni=new LANin();
mni.ManyInLAN();
}
if(s=="Hosts")
//IP Selective <Remote Hosts>
{
LANout mnyo=new LANout();
mnyo.ManyOutLAN();
}

if(s=="All Hosts") //IP of All <Single Host>


{
LANout mnyo=new LANout();
mnyo.ManyOutLAN();

36
}
if(s=="MAC_Addr")
{ Runtime rt=Runtime.getRuntime();
MACAddr mac=new MACAddr();
mac.MAC_tbl();
try
{
rt.exec("wordpad d:\\MACtbl.class");
}
catch(Exception e1)
{
String act="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(act);
}
}
if(s=="Name_Tbl")
{
Runtime rt;
NameTable nt=new NameTable();
nt.Name_tbl();
try
{
rt=Runtime.getRuntime();
rt.exec("notepad d:\\Nametbl.class");
}
catch(Exception e1)
{
String act="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(act);
}
}

37
if(s=="Proto_Statis")
{
Runtime rt=Runtime.getRuntime();
ProtocolViewer rout=new ProtocolViewer();
rout.ProtocolView();
try
{
rt.exec("notepad d:\\Status.class");
}
catch(Exception e1)
{
String act="Invalid Path/File Name";
ErrMsgWindow msg=new ErrMsgWindow();
msg.ErrorMesgWin(act);
}
}
}
}
class SgloutLAN implements ActionListener
{
JFrame jfm;
JTextField jtf;
JButton jbn1,jbn2,jbn3;
int count=0;
Counter cnt=new Counter();
public void SglOutLAN()
{
jfm=new JFrame("IP Selective <Remote Host>");
Container cnr=jfm.getContentPane();
cnr.setLayout(null);

JLabel jlb1=new JLabel("Enter an IP Address");


jlb1.setLocation(40,50);
jlb1.setSize(300,25);

38
jbn1=new JButton("Ok");
jbn1.setMnemonic('O');
jbn1.setLocation(200,130);
jbn1.setSize(100,25);
jbn1.addActionListener(this);

jtf=new JTextField();
jtf.setLocation(200,50);
jtf.setSize(250,25);

jbn2=new JButton("Cancel");
jbn2.setMnemonic('C');
jbn2.addActionListener(this);
jbn2.setLocation(350,130);
jbn2.setSize(100,25);

jbn3=new JButton("Continue");
jbn3.setMnemonic('n');
jbn3.setLocation(50,130);
jbn3.setSize(100,25);
jbn3.addActionListener(this);

cnr.add(jbn1);
cnr.add(jbn2);
cnr.add(jbn3);
cnr.add(jlb1);
cnr.add(jtf);

jfm.setLocation(150,200);
jfm.setSize(500,200);
jfm.setVisible(true);
}
public void actionPerformed(ActionEvent e1)

39
{
String s=e1.getActionCommand();
if(s=="Ok")
{
String s1=jtf.getText();
RemoteHost Rh=new RemoteHost();
Rh.RemoteID(s1);
}
if(s=="Continue")
{
count=cnt.Counting(count);
System.out.println("count "+count);
}
if(s=="Cancel");
{
jfm.setVisible(false);

}
}
}

class Counter
{
public int Counting(int i)
{
i+=1;
return i;
}
}
6.5.2 Sample Code in Application Module

Code for checking validity


<%@ page import="java.sql.*" errorPage="errpage.jsp" %>
<%

40
String u=request.getParameter("uname");
String p =request.getParameter("pword");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:eg");
Statement s=con.createStatement();
ResultSet r=s.executeQuery("select * from login where uname='"+u+"'
and pword='"+p+"'");
out.println("Hello");
if(!r.next())
{
out.println(" Invalid UserName ");
out.println(" Check Your UserName and PassWord !");
out.println("<a href=login.html> Login Again </a>");
}
else
session.putValue("uname",u);
%>
<jsp:forward page="ehome.jsp" />

Code for registering New User

<%@ page import="java.sql.*" errorPage="errpage.jsp" %>


<%! int n=0; %>
<%

String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String pword=request.getParameter("pword");
int age=Integer.parseInt(request.getParameter("age"));
String gender=request.getParameter("gender");
String addr=request.getParameter("addr");
long zipcode=Long.parseLong(request.getParameter("zipcode"));

41
long phone=Long.parseLong(request.getParameter("phone"));
String mailid=request.getParameter("mailid");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("Jdbc:Odbc:eg");

String str="insert into


newuser(fname,lname,pword,age,gender,addr,zipcode,phone,mailid)
values('"+fname+"','"+lname+"','"+pword+"',"+age+",'"+gender+"','"+addr+"',"+z
ipcode+","+phone+",'"+mailid+ "')";
PreparedStatement s=con.prepareStatement(str);
n=s.executeUpdate();
if(n==0)
out.println("Error in insertion : 1");

str="insert into login(uname,pword) values('"+fname+"','"+pword+"')";


s=con.prepareStatement(str);
n=s.executeUpdate();
if(n==0)
out.println("Error in insertion : 2");
%>
<jsp:forward page="ehome.jsp" />

Code for admin details

<%@ page import="java.sql.*" errorPage="errpage.jsp" %>


<%! int n=0; %>
<%

String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String pword=request.getParameter("pword");
int age=Integer.parseInt(request.getParameter("age"));

42
String gender=request.getParameter("gender");
String addr=request.getParameter("addr");
long zipcode=Long.parseLong(request.getParameter("zipcode"));
long phone=Long.parseLong(request.getParameter("phone"));
String mailid=request.getParameter("mailid");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("Jdbc:Odbc:eg");
String str="insert into
newuser(fname,lname,pword,age,gender,addr,zipcode,phone,mailid)
values('"+fname+"','"+lname+"','"+pword+"',"+age+",'"+gender+"','"+addr+"',"+z
ipcode+","+phone+",'"+mailid+ "')";
PreparedStatement s=con.prepareStatement(str);
n=s.executeUpdate();
if(n==0)
out.println("Error in insertion : 1");

str="insert into login(uname,pword) values('"+fname+"','"+pword+"')";


s=con.prepareStatement(str);

n=s.executeUpdate();
if(n==0)

out.println("Error in insertion : 2");


%>
<jsp:forward page="ehome.jsp" />

Code for calculating tot User

<%@ page import="java.sql.*" errorPage="errpage.jsp" %>


<%! int n=0; %>
<%

43
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String pword=request.getParameter("pword");
int age=Integer.parseInt(request.getParameter("age"));
String gender=request.getParameter("gender");
String addr=request.getParameter("addr");
long zipcode=Long.parseLong(request.getParameter("zipcode"));
long phone=Long.parseLong(request.getParameter("phone"));
String mailid=request.getParameter("mailid");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("Jdbc:Odbc:eg");
String str="insert into
newuser(fname,lname,pword,age,gender,addr,zipcode,phone,mailid)
values('"+fname+"','"+lname+"','"+pword+"',"+age+",'"+gender+"','"+add
r+"',"+zipcode+","+phone+",'"+mailid+ "')";

PreparedStatement s=con.prepareStatement(str);
n=s.executeUpdate();

if(n==0)
out.println("Error in insertion : 1");
str="insert into login(uname,pword)
values('"+fname+"','"+pword+"')";
s=con.prepareStatement(str);
n=s.executeUpdate();
if(n==0)
out.println("Error in insertion : 2");
%>
<jsp:forward page="ehome.jsp" />

44
45
CHAPTER -4

4. IMPLEMENTATION.

4.1 MODULE DISCRIPTION

The main modules of this project Active Network System (ANS) are
• LAN monitoring
• Application Monitoring
4.1.1 LAN Monitoring

46
This module is designed as GUI Mode Application. So that it is very
easy to handle by end users.
This main objective of the project is used to avoid Data Collision / IP
Confliction between a System and another system of same or different block
when each blocks interconnected.
It is used to determine Host Names, Host Addresses of systems of in
this LAN and systems of different block when each block is interconnected. It
determines routing table of the server host, network protocol statistics in the
LAN and H/W address of each host in the LAN.
Also determines which type of IP Address assigned to a system or
group of systems of this LAN or different LAN when each block is
interconnected after the connection was established.
It involves establishing connection to the remote Host(s) given by the
user. It is possible to send messages between systems in LAN.
Additional features like Calculator and browser is included in this
project to improve the user interface.

4.1.2 Application Monitoring


In this module an application like Website is going to monitor.
The Application module helps the administrator to measure how many users
is using the application for the specified day or specified period of time. This
information will not be made visible to the end users of the application. This
project assists the administrator for the future enhancement of the application.

47
48
CHAPTER -5

5. SYSTEM TESTING AND IMPLEMENTATION

5.1. TESTING FUNDAMENTALS

Software testing is an important element of


S/W quality assurance and represents the ultimate review of
specification, design and coding. The increasing visibility of S/W
as a system element and the costs associated with a S/W failure
are motivating forces for well planned, through testing.

49
Though the test phase is often thought of as
separate and distinct from the development effort--first develop, and
then test--testing is a concurrent process that provides valuable
information for the development team.

There are at least three options for integrating


Project

Builder into the test phase:

• Testers do not install Project Builder, use Project Builder


functionality to compile and source-control the modules to be
tested and hand them off to the testers, whose process remains
unchanged.

• the testers import the same project or projects that the


developers use.

• Create a project based on the development project but


customized for the testers (for example, it does not include
support documents, specs, or source), who import it.

A combination of the second and third options


works best. Associating the application with a project can be useful
during the testing phase, as well. We can create actions to
automatically run test scripts or add script types and make them
dependent on the modules to test.

5.2. TESTING OBJECTIVES

There are several rules that can serve as testing objectives.

They are

• Testing is a process of executing a program with the intent of


finding an error.

• A good test case is one that has a high probability of finding an


undiscovered error.

50
• A successful test is one that uncovers an undiscovered error.

If testing is conducted successfully according to the


objectives stated above, it will uncover errors in the software. Also,
testing demonstrates that software functions appear to the working
according to specification, that performance requirements appear to
have been met.

5.3. OBJECT ORIENTED TESTING

5.3.1. UNIT TESTING


Unit testing focuses the verification effort on the
smallest unit of S/W design i.e., the module. The unit testing is
always white-box oriented and the step can be conducted in
parallel for modules.

During unit test, testers can use the same


project or projects as the developers, if functional units organize the
project, or separate projects have been created for functional units.
The project or projects can also be exported, so unit test can take
place in a variety of environments and on a variety of platforms.

5.3.1.1. UNIT TEST CONSIDERATIONS

The tests that occur as part of unit testing.


The module ‘interface’ is tested to ensure that information properly
flows into and out of the program unit under test. The ‘local data
structures’ are examined to ensure that data stored temporarily
maintains its integrity during all steps in an algorithms execution.

51
‘Boundary Conditions’ are tested to ensure that
the module operates properly at boundaries established to limit or
restrict processing. All ‘independent paths’ through the control
structures are exercised to ensure that all statements in a module
have been executed at least once. Finally, all ‘error-handling paths’
are tested.

5.3.1.2. UNIT TEST PROCEDURES

Unit testing is considered an equivalent to the


coding step. After the source level code has been developed,
reviewed and verified for correct syntax, unit test case design begins
since a module is not a stand alone program, ‘driver’ and/or ‘stub’
S/W must be developed for each unit test. In most applications, a
driver is nothing more than a main program that accepts test case
data, passes such data to the module to be tested, and prints the
relevant results. The stubs serve to replace modules that are
subordinates called by the modules to be tested. A stub or a dummy
stub or a dummy subprogram uses the subordinate modules
interface, may do minimal data manipulation, prints verification of
entry, and returns. The drivers and scrubs represent overhead i.e.,
both are S/W that must be written but that is not delivered with the
final S/W product. If the drivers and the stub are kept simple, then
the overhead is low.

The Unit Test is carried out in this project, and is


found successful. The data is flowing correctly to all part of the
project.

5.3.2. INTEGRATION TESTING

Integration testing is a systematic technique for constructing


the program structure while at the same time conducting test to
uncover errors associated with interfacing. The objective is to take
unit-tested modules and build a program structure that has been
dictated by design.

52
5.3.2.1. TOP-DOWN INTEGRATION

This method is an incremental approach to the construction of


program structure. Modules are integrated by moving downward
through the control hierarchy, beginning with the main program
module.

IMPORTING THE TEST PROJECT AND SETTING UP THE


TESTING ENVIRONMENT

The process of
importing a test project and setting up a testing environment is the
same as the process for importing a project and setting up the
environment for development.

ADDING TEST SCRIPTS AND TEST DATA TO THE PROJECT

You may need to add


some items, such as test scripts, to the project. In addition, you may
need to add connection strings to database accounts containing test
data.

Remember that you can automate the


running of test scripts just as you can automate actions associated
with the modules in your application.

Modifying actions and macros to facilitate testing

If actions specifying "run with debugging" have not


already been provided, you can either modify existing actions to include a
debug flag, or create new actions.

53
5.4. IMPLEMENTATION

Once the system has been designed, the next step is to


convert the designed one in to actual code, so as to satisfy the user
requirements as excepted. If the system is approved to be error free
it can be implemented.

When the initial design was done for the system, the
department was consulted for acceptance of the design so that
further proceedings of the system development can be carried on.
After the development of the system a demonstration was given to
them about working of the system. The aim of the system illustration
was to identify any malfunctioning of the system.

Implementation includes proper training to end-users. The


implemented software should be maintained for prolonged running
of the software.

Initially the system was run parallel with manual system. The
system has been tested with data and has proved to be error-free and
user-friendly. Training was given to end -user about the software and
its features.

54
5.5 SCREEN SHOTS

Fig7.1 Home Page

Fig 7.2 File Menu

55
Fig7.3 Search thru Host Name

Fig 7.4 IP address is obtained

56
Fig7.5 Searching several host

Fig 7.6 Range of IP addresses

57
Fig7.8 View Menu

Fig 7.9 Consolidated output

58
Fig 7.10 Net Shower menu

Fig 7.11 Mac table doc

59
Fig 7.12 Net Shower

Fig 7.15 Viewer

60
Fig 7.16 Messenger

Fig7.18 Application module –Home page

61
Fig 7.19 Admin Details

62
Fig 7.20 User Details

63
Fig 7.21 for any Particular date –User details

Fig 7.22 – Server configuration details

64
Fig 7.23 Mailing details

65
CHAPTER -6

66
6. CONCLUSION & FUTURE ENHANCEMENT

6.1 CONCLUSION
The Active Network System is developed to successfully incorporate
the essential requirements. In this project monitoring is handled in two ways.
LAN Monitoring is highly administrator friendly. It is designed with java
swing, an efficient GUI environment is provided. It assists the administrator to
know about the active and inactive clients in the LAN network along with their
status.
Application Monitoring is highly beneficial for any application
administrator. In this project website is taken as the specific application. It is
efficient in Instance control and session maintenance.

6.2 FUTURE ENHANCEMENT

Success of any project lies in its flexibility to inculcate any future


modifications. This project can easily accommodate changes. It is planned to
enhance application monitoring in Internet. In LAN monitoring module in
addition to simple monitoring function administrator should be given some
controlling power which is also the future enhancement of this project.

67
6.3 BIBLIOGRAPHY
6.3.1 Books

1. Patrick Naughter, Heerbert schildt, “The Complete Reference –JAVA”,Tata


Mc graw Hill,New Delhi,2001
2. Hans Bergsten, “Java Server Pages” ,Shroff publishers,Calcutta,2003
3. Doglas E.Comer, “Internetworking with TCP/IP, LPE, New Delhi,2002

6.3.2 web sites


1. JSP http://the Jsptags.com
2. Jakrtha tag http://jakartha apache.org
3. Networking http://aboutlan.com

68

You might also like