Network Packet Analyzer: Joseph Brian Kasozi Musanje S09B23/323
Network Packet Analyzer: Joseph Brian Kasozi Musanje S09B23/323
By
Supervisor
INNOCENT NDIBATYA
April, 2012
Acknowledgement
Fist I give the Glory to God, the source of strength and grace for granting me both mental and physical
endurance, persistence and consistency to complete all the tasks assigned to me by my supervisor
during this research.
Credit is given to Mr. Ndibatya Innocent who has been a very strong pillar to the success of this
research following his guidance and advice as a supervisor it has created a lot of confidence and
persistence hence completion of the research.
Secondly I wish to acknowledge Mr. Wabwire John Bosco who has been a great inspiration during
the course of the research.
Special thanks go to my parents Mr. and Mrs. Musoke for the support and advice given to me
during the research, without them I would not have succeeded.
I can forget to acknowledge Kisakye Charles, Male henry Kenneth, Komugabe Maureen and
Kyambadde Michael they have been very good friends and have helped during the course of
research.
May the good Lord bless you all.
I
Declaration
I Joseph Brian Musanje Kasozi S09b23/323 hereby declare that this Research project report is my
original work. All that is in this report was researched and compiled by me. I did not copy and no one
copied my work.
……………………………… ………………………………….
Signature Date
II
Approval
……………………………………… ………………………………………
Signature Date
III
Table of Contents
Acknowledgement......................................................................................................................................I
Declaration................................................................................................................................................II
Approval..................................................................................................................................................III
Table of Contents.....................................................................................................................................IV
List of Figures..........................................................................................................................................VI
ABSTRACT...........................................................................................................................................VII
LIST ACRONYMS...............................................................................................................................VIII
CHAPTER ONE:.......................................................................................................................................1
1.0 Introduction......................................................................................................................................1
1.1 Background......................................................................................................................................1
1.2 Problem Statement...........................................................................................................................1
1.3 OBJECTIVES..................................................................................................................................2
1.4 Significance......................................................................................................................................2
1.5 Scope................................................................................................................................................2
CHAPTER TWO: LITERATURE REVIEW............................................................................................3
2 Introduction.........................................................................................................................................3
2.0 Information and Network Security...................................................................................................3
2.1 Differentiating Data Security and Network Security.......................................................................3
2.2 Technology for Internet Security.....................................................................................................5
CHAPTER THREE: METHODOLOGY................................................................................................10
3.0 INTRODUCTION.............................................................................................................................10
3.1 ANALYSIS PHASE.......................................................................................................................10
3.1.1 SYSTEM ANALYSIS.................................................................................................................10
3.2 DESIGN PHASE...........................................................................................................................13
3.3 IMPLEMENTATION PHASE.......................................................................................................18
3.4 TESTING AND VALIDATION..................................................................................................19
CHAPTER FOUR: RESULTS AND SYSTEM IMPLEMENTATION..................................................20
4.2 Components of the Network Traffic Analysis Application............................................................22
CHAPTER FIVE: CONCLUSIONS.......................................................................................................25
5.1 Challenges......................................................................................................................................25
5.2 Solutions to the Challenges............................................................................................................25
5.3 Recommendations..........................................................................................................................25
5.4 Conclusion.....................................................................................................................................26
REFERENCES........................................................................................................................................27
APPENDICES.........................................................................................................................................28
APPEDIX 1: Admin login Code..............................................................................................................28
APPEDIX 2: HTTP Analyzer.................................................................................................................31
APPENDIX 3: Select Network Dialog Box............................................................................................33
APPENDIX 4: Line Graph......................................................................................................................33
IV
List of Figures
V
ABSTRACT
Uganda Christian University has adopted the use of Computer networks to easy the sharing of data
and other resources. This has improved on the service delivery and academics at large.
However they have faced a very fundamental threat of denial of service (DOS) where the network
is slowed down due to irrelevant usage .This would be solved by managing and monitoring of
packets that are communicated over the network using a network packet analyzer.
Network packets contain a lot of useful information about network activity that can be used as a
description of the general network behavior. Network packet analyzers become a useful tool for
system and network administrators to capture such kind of network information. In this report, an
implementation of java packet capture library [4], a popular network java library, is described.
This fully configurable tool concentrates particularly on its flexible input and output options so
that it can easily be incorporated into a network to perform more complicated tasks, such as real-
time online or offline network monitoring and management.
VI
LIST ACRONYMS
VII
CHAPTER ONE:
Introduction
In the modern society, computers are no longer treated as stand-alone machines instead, they are
communicating to share resources and data through computer networks. Network packets are units of
data traveling in these computer networks, and they carry all the important information from its source
to its final destination. There is a large amount of personal, commercial activities on the network
and security is becoming of great importance because of the internet. System and network
technology is a key technology for wide variety of applications. Security is crucial to networks and
applications. Although, network security is a critical requirement in emerging networks, there is a
significant lack of security methods that can be easily implemented to maximize its utilization.
1.1 Background
Uganda Christian University is located 23 kilometers from Kampala, in Mukono town, along Kampala
Jinja road. It is a private university, chartered and fully accredited by the President of the Republic of
Uganda, through the Ministry of Higher Education and Sports, and the National Council for Higher
Education. UCU is owned by the Province of the Church of Uganda, and has campuses in Eastern,
Western and Northern Uganda. The University was born in 1997 out of Bishop Tucker Theological
College which was founded in 1913.
Recent interest in security was fueled by the crime committed by Kevin Mitnick who committed the
largest computer‐related crime in U.S. history [3]. The losses were eighty million dollars in U.S.
intellectual property and source code from a variety of companies [3]. Since then, information security
came into the spotlight. Uganda Christian University has got Information technology policy which
manages all the Information technology assets under which there is the network resources which are
utilized by both students and staff who in the long run violet the policy.
1.3 OBJECTIVES
1.3.1 Main Objectives
The purpose of this project was to come up with a network Packet Analyzer which will help in controlling,
monitoring and managing both wired and wireless Uganda Christian University networks thus
increasing or improving its efficiency.
1.4 Significance
Personally this project improved on my skills of System analysis and design because it enabled me to
learn and it has shaped me for the tasks ahead. This project was also a Partial Fulfillment of the
Requirements for the Award of the Degree of Bachelor of Science in Computer Science of Uganda
Christian University.
The importance of this project to the students of the University is that it will enable them to learn more
about the Network traffic analysis and this will also broaden their knowledge and skills about networks
and protocols.
The system developed will help reduce the problem of network misuse, overload during peak hours
since it shows the administrators the statistics of all the traffic over the network reducing the chances of
slow Internet connection.
2
1.5 Scope
The project target scope was Uganda Christian University faculty of science and technology’ network
environment where the users of the network are over one hundred.
2 Introduction
Literature review is a process to search, collect, analyze all concluded debates and issues raised in the
work that has been done in the past. It also provide the examples, case studies and other relevant work
that has been done by other people in the past, it gives the chance to investigate areas and read the
subject that users may not have thought about before.
Common internet attacks methods are broken down into categories. Some attacks gain system
knowledge or personal information, such as eavesdropping and phishing. Attacks can also interfere
with the system’s intended function, such as viruses, worms and Trojans. The other form of attack is
when the system’s resources are consumes uselessly, these can be caused by denial of service (DOS)
attack. Other forms of network intrusions also exist, such as land attacks, and teardrop attacks. These
attacks are not as well-known as DOS attacks, but they are used in some form or another even if they
aren’t mentioned by name.
i) Eavesdropping
2.2.2 Firewall
A firewall is a typical border control mechanism or perimeter defense. The purpose of a firewall is to
block traffic from the outside, but it could also be used to block traffic from the inside. A firewall is the
front line defense mechanism against intruders. It is a system designed to prevent unauthorized access
to or from a private network. Firewalls can be implemented in both hardware and software, or a
combination of both [8].
5
2.2.3 Intrusion Detection Systems
An Intrusion Detection System (IDS) is an additional protection measure that helps ward off computer
intrusions. IDS systems can be software and hardware devices used to detect an attack. IDS products
are used to monitor connection in determining whether attacks are been launched. Some IDS systems
just monitor and alert of an attack, whereas others try to block the attack.
Viruses, worms and Trojan horses are all examples of malicious software, or Malware for short. Special
so‐called anti‐Malware tools are used to detect them and cure an infected system.
The Secure Socket Layer (SSL) is a suite of protocols that is a standard way to achieve a good level of
security between a web browser and a website. SSL is designed to create a secure channel, or tunnel,
between a web browser and the web server, so that any information exchanged is protected within the
secured tunnel. SSL provides authentication of clients to server through the use of certificates. Clients
present a certificate to the server to prove their identity.
Some of the security technologies that can be used on a local area network to mitigate risks include a
network analyzer also called a packet analyzer which is a combination of hardware and programming,
or in some cases a stand-alone hardware device that can be installed in a computer or network to
enhance protection against malicious activity. Network analyzers can also analyze the packets in real
time in order to alert the administrator about problems. A network analyzer also called a "packet
analyzer," "traffic analyzer" and "protocol analyzer," [5] plugs into a port on a network hub or switch in
real network and decodes one or more protocols into a human-readable format for the network
administrator. Network analyzers functionality is such as [6]:
i) Provide detailed statistics for current and recent activity on the network
ii) Detect unusual levels of network traffic.
iii) Detect unusual packet characteristics.
iv) Identify packet sources or destinations.
v) Configure alarms for defined threats.
vi) Search for specific data strings in packets.
6
vii) Monitor bandwidth utilization as function of time.
Employ packet header data collected at a network access point for traffic analysis. This data includes
source destination address, port numbers, traffic volume in bytes, packets and other useful information
[3]. The concept of end-to-end is used as a relative comparison with hop-by-hop. Data transmission
seldom occurs only between adjacent nodes, but via a path which may include many intermediate
nodes. End-to-end delay is the sum of delays experienced at each hop from the source to the
destination. The delay at each intermediate node has two components: axed delay which includes the
transmission at sender node and the propagation over the link to the next node and a variable delay
which includes the processing and queuing at sender node.
[4] The last decade has seen a rapid growth in both the volume and variety of network traffic, while at
the same time it is becoming even more important for analysts to understand network behaviors to
provide quality of service, security, and misuse monitoring. To aid analysts in these tasks, researchers
are seeking better visual analysis techniques for network traffic. These researchers present a network
traffic visualization system that enables previous visual discoveries to be used in analysis. The system
accomplishes this by allowing the analyst to interactively create models of observed patterns, which are
stored in a reusable knowledge base. The reuse of knowledge creates the analytical cycle;
Figure 2.0
7
From the cycle; (1) the analyst uses visualization enhanced with previous knowledge to discover
patterns in the data. (2) Once a pattern is discovered, the analyst creates a model for the pattern.
(3) The analyst commits the model into the knowledge base to reuse in future analysis.
The models discussed in this paper are useful in the development of my system as they create patterns
to be captured. For example: To capture the pattern exhibited by a web page load, the analyst selects
one horizontal sequence of marks from the visualization. The system then identifies predefined
predicates that are true for the selected events. In this example the following predicates are identified:
“from same IP”, “to same IP”, “temporal locality”, “source port locality”, “destination port HTTP”.
The analyst then engages in an interactive loop to create a clause describing the pattern from the
identified predicates
This popular wireless stumbler for Mac OS X offers many of the features of its namesake Kismet,
though the code base is entirely different. Unlike console-based Kismet, KisMAC offers a pretty GUI
and was around before Kismet was ported to OS X. It also offers mapping, Pcap-format import and
logging, and even some decryption and de-authentication attacks.
Ettercap
Ettercap is a suite for man in the middle attacks on LAN. It features sniffing of live connections,
content filtering on the fly and many other interesting tricks. It supports active and passive dissection of
many protocols (even ciphered ones) and includes many features for network and host analysis.
Dsniff
This popular and well-engineered suite by Dug Song includes many tools: dsniff, filesnarf, mailsnarf,
msgsnarf, urlsnarf, and webspy passively monitor a network for interesting data (passwords, e-mail,
files, etcetera.); arpspoof, dnsspoof, and macof facilitate the interception of network traffic normally
unavailable to an attacker (for example, due to layer-2 switching); and sshmitm and webmitm
implement active monkey-in-the-middle attacks against redirected ssh and https sessions by exploiting
weak bindings in ad-hoc PKI. [9].
All these tools just display the packet information without availability to change or control the packet
and for large networks, it would be necessary to store Gigabytes of event data every day. The new
program can capture the packet of internet in real time, display the field which we want, monitor any
field in the specific header, and control the incoming and outgoing packet. This will increase the
efficiency of the network.
9
CHAPTER THREE: METHODOLOGY
3.0 INTRODUCTION
The methodology used in developing this application was incremental development model where the
analysis, design and implementation were performed and a number of increments produced which were
later integrated to make a full system.
This phase answered the questions of who would use the system, what the system would do, where
and when it would be used and it included the following;
Analysis of the current system.
Gathering of required information that was used to develop the system.
Characterized network traffic, this meant identifying the sources, destinations, direction,
volume of network traffic and type of flow between these points.
This involved gathering all information about the current system that was in use for analyzing and
monitoring network traffic and studying its strength and weaknesses. This analysis was to help in
designing the proposed system
The current system network Overload is identified manually where the administrator is notified
by the users that the network is slow.
The current system limits the number of users on the network during peak hours by
disconnecting some.
10
3.1.1.1 Weaknesses of the Current System
The current system does not analyze the performance of the network.
The current system does not report statistics of traffic for a given period.
The proposed system analyses and monitors the source and destination of traffic, Blocks Heavy
Websites, counts dropped packets during network overload and congestion, displays the packets traffic
with their respective protocols through filtering and displays the statistics of the traffic through
graphical presentations.
These are requirements that users expect the system to have to fulfill their needs. These are categorized
into two namely functional and non-functional requirements.
Functional requirements define what a system is supposed to do. Functional requirements are usually in
the form of system shall (do requirement).
The application allows the Administrator (user) to select the interface to capture.
The application detects less priority destinations and drops the packets.
11
3.2.1.2 Non -function requirements
A non-functional requirement is a requirement that specifies criteria that can be used to judge the
operation of a system, rather than specific behaviors. Non-functional requirements are in the form of
system shall be (requirement). Non-functional requirements are often called qualities of a system.
Other terms for non-functional requirements are constraints, quality attributes, quality goals, quality of
service requirements and non-behavioral requirements. Non –functional requirements can be divided
into two main categories.
I. Execution qualities, such as security and usability, which are observable at run time.
II. Evolution qualities, such as testability, maintainability, extensibility and scalability, which are
embodied in the static structure of the software system.
The system requires the user to have knowledge about networking and its principles.
The security of the Application is implemented in a way that one to get access to it he or she has to
have a user name and password plus administrative rights.
This involves the unseen side of the system. This is the side which supports the system. It is also
referred to as the backbone of the system. The following are the tools that were used
Java packet capture library. This is a library of all packets captured from the interfaces and platform
independent (Operating systems).
Jpcap.dll file. This is a library of all classes used in coding. This library is moved to the JDK library
files.
12
This involves what the system will run on. This allows the user to interact with the system and also
known as the physical components of the system. They include:
The following models show different system components and how data flow from one component to
another to achieve the systems goal. They also show the unseen side of the system.
The purpose of a class diagram is to depict the classes within a model. In an object oriented application,
classes have attributes (member variables), operations (member functions) and relation-ships with other
classes. In a class diagram we can show the member variables, and member functions of a class. We
can also show whether one class inherits from another, or whether it holds a reference to another.
13
14
Figure 3.1: CLASS DIAGRAM
A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that
shows how processes operate with one another and in what order. It is a construct of a Message
Sequence Chart. A sequence diagram shows object interactions arranged in time sequence. It depicts
the objects and classes involved in the scenario and the sequence of messages exchanged between the
objects needed to carry out the functionality of the scenario. Sequence diagrams typically are
associated with use case realizations in the Logical View of the system under development.
: administrator
press
invokes
generates
view
save/print
add/remove
15
Figure 3.2: Sequence Diagram
Start Monitoring
Start Capture
Capture Packets
Display Graph
17
Figure 3.4 Data Flow diagrams
Data flow diagram illustrates the different process and how data flows
from one process to another.
Here the administrator runs the application then after he is required to login with valid username and
password. After he has to select the network interface whose traffic is to be captured. When the
interface is selected and the capture started, the host machine will be put in a promiscuous mode (a
network device is able to intercept and read each network packet that arrives in its entirety.).Now the
host machine is able to capture all network traffic on that particular interface.
Than the administrator is able to determine the network traffic flow and the different protocols used at
that particular time since the host machine or device is able to capture all traffic from and to the entire
hosts on the network.
The Administrator now is able to determine the different irrelevant destinations by matching the
different Internet Protocols captured and those stored in the database after which all packets to that
given destination can be blocked hence improving the efficiency of the network. After all the captures
the administrator is able to save the captures for further analysis.
On the management bit of it the administrator can also manage other users. He can add or delete any
new users as illustrated in figure 4.5.
18
3.3 IMPLEMENTATION PHASE
Under this phase the developed system was installed and tested and it performed as designed and
contained in this section is a post-implementation review of the system.
3.3.1 Java
Java was used because it is a general-purpose, concurrent, class-based, object-oriented language that is
specifically designed to help implement platform independent applications. It is intended to let
application developers "write once, run anywhere".
3.3.3 Simulation
Network simulation is a technique where a program simulates the behavior of a network. This
simulation was performed with the use of the Uganda Christian University LAN traffic
3.4.1 Testing
The system was tested by compiling and running it using the Net bean integrated development
environment 6.9.1 and it was found bug free.
3.4.2 Validation
The application was availed to my project supervisor to interact with it and he validated it since it was
able to capture, monitor and block heavy or unwanted websites on the network.
19
CHAPTER FOUR: RESULTS AND SYSTEM IMPLEMENTATION
4.1 Introduction
This deals with result of the design and implementation of the system. The system is made up of
various components which help it to achieve its intended objectives as proposed in the earlier chapters.
In this chapter the application Graphical User Interface will be analyzed as well as its back logic.
Is var X Execute
TCP
request
NO
YES
Is var Execute
Z
UDP
request
NO
YES
Is var Execute
Y
ICMP
request
NO YES
Is var
b Execute ARP request
Is no Drop
Capture packets
packets Packet
>=set
Packets
Capture statistics
21
Stop
Figure 4.1: Flow Chart
Front End
22
(b) Selecting Protocol Type. Through selecting the type of protocol to filter out, the user only snoops
only packets from filtered protocols. These include TCP, ARP, ICMP and UDP; two protocols can be
filtered at a time.
(c) Start Capture Button. The system has a start snooping button that helps to start the snooping on the
selected interface.
(d) Stop Capture Button. This is a button that prompts the user to stop snooping if he wishes to stop the
snooping.
(e) Change Network Interface Button. The system has a button that enables the user to change the
network interface to that of his choice.
(f) Clear All Button. This clears all the content that has been displayed after the snooping.
(g) About Button. This button displays brief information about the system and the developer of the
system.
(h) Help Menu Button. The system has a help menu with all the details on how to use this system. This
can take the user through all the steps and the description of the output.
(I) Network Interface details jText Area. This area displays the details of the interface selected. The
name of the interface, Mac address, IP address, subnet mask and broad cast address.
(j) All Packets details jText Area. This displays the packets snooped from the interface, their source and
destination addresses, packet length, protocol, priority, sequence number, number of hops plus the
packets dropped.
23
Figure 4.3: Shows the Interface with the capture table. Its this GUI which displays the real time
capture of the network traffic.
This component displays the statistics of the packets captured in graphical form. It plots the number of
packets captured per a second with an assumption that ten packets are captured every second. The lines
displayed are for the protocols selected for example; TCP, ICMP and UDP protocols respectively.
APPENDIX 4: Shows a plot of IPV4, IPV6 and ARP packets captured from the Ethernet interface,
presenting a higher number of TCP packets at some point being captured.
24
Figure 4.5 Pie Chart.
Figure 5.5 Shows the a pie chart that displays the ratio of the different Network layer protocol packets
captured at a given time
Back End
The back end of the application is the database which was build using Microsoft access 2003. It
comprises of tables that’s AdminLogin which stores administrator username and passwords, Webs
which stores Internet Protocols mapped to the respective Domain name.
5.1 Challenges
There were some challenges I faced during the course of the project.
Accessing information concerning the network topology, performance and available tools used to
monitor the network traffic. The administrators considered this information as confidential.
The instability of the network connections made it had to make a conclusive study of the network. The
network was always on and off.
Building a platform to capture packets from the local area or wireless network. This involved
downloading Java packet capture library (JPCap) whose process of downloading was always
interrupted hence taking more time than planned.
Installing java packet capture library of classes to the JDK setup. Some setups would get corrupted
25
before installing.
To test the local area network, I used the TP3 laboratory for wired and tech_staff network for wireless
network for my study.
5.3 Recommendations
Uganda Christian University being the case study for my research, I would like to recommend the
following;
The university authority should facilitate the improvement of this application so that it can be used to
monitor the network traffic prompting the network administrators to take affirmative action’s only at
times it’s needed.
From the study of the network topology, I recommend the university to eliminate the flat network and
acquire different routers for each faculty in order to avoid network congestion and bleach of security.
I recommend further research to be made on how to block traffic automatically during network
overload at peak hours. This would improve the system from being a passive system to an active
system.
The university should encourage students to develop applications that can improve service delivery at
the university. This will empower the faculty of science and technology to lead in technology
innovations.
5.4 Conclusion
Beginning with the research proposal and ending with the implementation of the project, this has been
an opportunity to discover my potential and be a part of the initiative to improve service delivery
through technology innovations.
26
REFERENCES
[1] Micheal Colline et al, (2006) ’ HANDBOOK SiLK version 0.10.3 , PA 15213-3890
[2] Shrirom Sarvotham et al, (2001) Connection-level Analysis and Modeling of network Traffic
[3] Seong Soo Kim et al (2004) A Study of Analyzing Network Traffic as Images in Real-Time
[4] Xiao et al (2004 )Enhancing Visual Analysis of Network Traffic Using a Knowledge
Representation.
[5] Jean-Francois Raymond (2000) Traffic Analysis: Protocols, Attacks, Design Issues and Open
Problems, Zero-Knowledge Systems, Inc.
[7] Robert Geist and James Westal (2002) Simulation Modeling of self-similarity in Network Traffic
Department of Computer Science, Clemson University, Lucent Technologies.
[8] Steven L. Scott and Padhraic Smyth, “The Markov Modulated Poisson Process and Markov Poisson
Cascade with Applications to Web Traffic Modeling”
http://www.datalab.uci.edu/papers/ScottSmythV7.pdf
[9] Andrew S. Tanenbaum, Computer Networks, Third Edition, Prentice Hall International
Editions, 1996.http://ieeexplore.ieee.org/iel5/35/13111/00601746.pdf?isnumber=&arnumber=601746
[10] R.Jain (1991) The Art of Computer Systems Performance Analysis, John Wiley and sons New York
[11] Victor S. Frost and Benjamin Melamed, Traffic Modeling for Telecommunications Networks,
27
IEEE Communications, Mar. 1994. http://ieeexplore.ieee.org/iel1/35/6685/00267444.pdf
[13] X. Yang, A.P. Petropulu, "The Extended Alternating Fractal Renewal Process for Modeling
Traffic in High-Speed Communication Networks," IEEE Trans. Sig. Proc., vol. 49, no. 7, July 2001.
http://citeseer.ist.psu.edu/cache/papers/cs/30369/http:zSzzSzwww.ece.drexel.eduzSzCSPLzSzpublicati
onszSzEAFRP-final.pdf/yang01extended.pdf
APPENDICES
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.*;
import java.util.*;
public class JdcapLogin extends JFrame {
Date now=new Date();
JLabel username,password,time;
JPasswordField pass;
JTextField user;
JButton Login,Cancel; Connection con;
Dimension window = Toolkit.getDefaultToolkit().getScreenSize();
Connection connect;
public JdcapLogin(){
super("ADMINISTRATOR LOGIN");
this.setBackground(Color.green);
this.getContentPane().setLayout(null);
this.setSize(370, 250);
this.setResizable(false);
this .setBackground(Color.red);
this.setLocation((window.width - 700) / 2, ((window.height - 450) / 2));
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
28
username=new JLabel("USERNAME");
password=new JLabel("PASSWORD");
time=new JLabel("TODAY is:"+now + " ", JLabel.CENTER);
user=new JTextField();
pass=new JPasswordField();
Login=new JButton("LOGIN");
Cancel= new JButton("CANCEL");
this.add(username);
this.add(password);
this.add(time);
this.add(user);
this.add(pass);
this.add(Login);
this.add(Cancel);
getContentPane().add(time, BorderLayout.PAGE_END, JLabel.CENTER);
this.dispose();
}
else{
JOptionPane.showMessageDialog(null, "WELCOME TO UCU \n "+"NETWORK PACKET
ANALYZER",null,
JOptionPane.INFORMATION_MESSAGE);
this.dispose();}
}//constructor closed
29
String username = user.getText();
String password = pass.getText();
String SQL;
//String category = cmbCat.getSelectedItem().toString();
SQL = "SELECT username,password FROM AdminLog WHERE username='" +
username + "' AND password='" +
password + "'";
JpcapDumper r=new JpcapDumper();
this.dispose();
try {
Statement stmt = con.createStatement();
stmt.execute(SQL);
ResultSet rs = stmt.getResultSet();
boolean recordfound = rs.next();
if (recordfound==true) {
Splash_1 t=new Splash_1(9000,true);//splash
Class c=Class.forName("jpcap.JpcapCaptor");
JDPacketAnalyzerLoader.loadDefaultAnalyzer();
JDStatisticsTakerLoader.loadStatisticsTaker();
r.loadProperty();
r.openNewWindow();
} else {
JOptionPane.showMessageDialog(null,
"The system could not log you in.\n" +
" Please make sure your username and password are correct", "Login Failure",
JOptionPane.INFORMATION_MESSAGE);
user.setText("");
pass.setText("");
user.requestFocus();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Error on login operation",
"Login Error", JOptionPane.ERROR_MESSAGE);
}//try catch closed
}
private class ButtonListener implements ActionListener {
30
return;
}
if (pass.getText() == null || pass.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Enter password",
"Missing field", JOptionPane.DEFAULT_OPTION);
pass.requestFocus();
return;
}
login();
public HTTPAnalyzer(){
layer=APPLICATION_LAYER;
}
try{
BufferedReader in=new BufferedReader(new StringReader(new String(p.data)));
method=in.readLine();
if(method==null || method.indexOf("HTTP")==-1){
// this packet doesn't contain HTTP header
method="Not HTTP Header";
return;
}
String l;
//read headers
while((l=in.readLine()).length()>0)
headers.addElement(l);
}catch(IOException e){}
}
return values;
}
}
32
APPENDIX 3: Select Network Dialog Box
33