Você está na página 1de 128

JAVA PROXY SERVER

PROJECT CATEGORY
This project has been developing in JAVA. Hence the category of the project comes into WBA (Web Based Application) and it is an Object Oriented System. So relation database management system (RDBMS) is used java is a power full programming language to develop sophisticated window very quickly. Our project is delicately falls in Relational Database Management system (RDBMS) environment; RDBMS is one of the important environments for commercial data. Processing in the world. The oracle enterprise version takes care of the following: 1) Updating the database 2) Retrieving information from the data base 3) Accepting query language statement 4) Enforcing security specification 5) Enforcing data integrity specification 6) Enforcing information consistency 7) Managing data sharing 8) Optimizing query 9) Managing system catalog

PROPERTIES OF JAVA (FRONT END):1|Page

JAVA PROXY SERVER

JAVA is pure object oriented programming language, which has derived C syntax and C++ object oriented programming features. Is compiled and interpreted language and is platform independent and can do graphics, networking, multithreading. It was initially called as OAK. Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. in 1991. Java can used to create two types of programs: application and applets. Application is a program that runs on your computer, under the operating system of that computer. That is an application created by Java is more or less like one created using C or C++. An applet is an application designed to be transmitted over the Internet and executed by a Java-compatible Web browser. Java provides the Java Virtual Machine (JVM). Java are following list of buzzwords: Simple Secure Portable Object-oriented Robust Multithreading Architecture-neutral Interpreted High Performance Distributed
2|Page

JAVA PROXY SERVER

Dynamic

FRONT END TOOL: JAVA


The name Java is a trademark of Sun Microsystems and refers to the programming language developed by Sun and released in public alpha and beta versions in 1995. Java is used to create executable content that can be distributed through networks. Used generically, the name Java refers to a set of software tools for creating and implementing executable content using the Java programming language. In order for users to use Java content, they must have a key piece of Java softwarethe Java interpreter. To view Java content on the Web, a users Web browser must be Java-enabled. In the alpha release of Java, available during the spring and summer of 1995, only the special browser called Hot Java could interpret programs created by the Java language. Hot Java was developed by Sun to showcase the capabilities of the Java programming language. Other brands of Web browsers have since been upgraded to be able to interpret Java programs, most notably, the Netscape Navigator Web browser. According to Michael OConnells feature article on the origins of Java in the July 7, 1995 issue of Sun World Online, the development of Java began at Sun Microsystems in California by a team which included Java creator James Gosling even as the World Wide Web was being developed in Switzerland in 1991. The goal of this early development
3|Page

JAVA PROXY SERVER

team was to develop consumer electronic products that could be simple and bug-free. What was needed was a way to create platformindependent code and thus allow the software to run on any Central Processing Unit (CPU). According to the information provided by Sun Microsystems, Java is a simple, object-oriented, distributed, interpreted, robust, secure,

architecture neutral, portable, high-performance, multithreaded, and dynamic language. The growth of Java during the last few years has been phenomenal. It has now emerged as the language of choice of the world computing community due to its simplicity, portability, and security. Java, the only pure object-oriented language available today, is now used in almost all applications, from simple home appliances control systems to complex space control systems. It has also revolutionized application development for Intranets and the Internet. Javas motto is Write Once, Run Anywhere. In order to accomplish this, Java has undergone many improvements and enhancements during these years of growth and popularity, primarily to add new capabilities required for the Internet applications of the language. Java2, the latest version of the language includes new features that enrich and extend the Java platform and provides upward comp ability and improved performance. Its rich class libraries provide system developers with the elements they need to build portable and distributed applications.

4|Page

JAVA PROXY SERVER

Java has two lives, one as a stand-alone computer language for general-purpose programming and the other as a supporting language for Internet programming. The general-purpose programs are known as applications and programs written for Internet are known as applet. Stand-alone applications are programs written in Java to carry out certain tasks on a stand-alone local computer. In fact, Java can be used to develop programs for all kinds of applications. Executing a stand-alone Java program involves two steps:1. 2. Compiling source code into byte code using javac compiler. Executing the byte code program using java interpreter. programs can read and write files and perform

Stand-alone

certain operation that applets cannot do. An applet can only within a Web browser. Reasons of selection: Java is platform independent programming language, which is very small in size, platform independent, secure and robust. The Java system has embedded auto garbage collection. It dramatically cuts down on the number of bugs and generally eliminates the hassle of memory management. Java has ability to share both information and the data processing either on the server or on the client. Objects used in Java can be loaded from local machines i.e. machines connected by network like LAN or remote machine i.e. machine connected by using modem and telephone lines like WAN. Java application can easily communicate with TCP/IP
5|Page

JAVA PROXY SERVER

protocols like HTTP and FTP. Java follows the oops concepts some oops feature are given below: ---Firstly we see what is oops concept. OBJECT-ORIENTED PROGRAMMING CONCEPT : Object-oriented Programming (OOP) is an approach to program organization and development, which attempts to eliminate some of the pitfalls of conventional programming methods by incorporating the best of

structured programming features with several new concepts. It is a new way of organizing and developing programs and has nothing to do with any particular language. However, not all languages are suitable to implement the OOP concepts easily. The latest one added to this list is Java, a pure object-oriented language. The general concepts of OOP which form the heart of Java Language. OBJECTS AND CLASSES: - Objects are the basic runtime entities in an object-oriented system. In this project they may be news information, party detail, advertisement order monitoring by employee, that the programs handle while coding. Objects should be chosen such that they match closely with the real-world objects. When a program is executed, the objects interact by sending messages to one another. DATA ABSTRACTION AND ENCAPSULATION: -Data encapsulation is the most striking feature of a class. The wrapping up of data and methods into a single unit (called class) is known as encapsulation. INHERITANCE:-Inheritance is a process by which objects of one class acquire the properties of objects of another class. Inheritance supports

6|Page

JAVA PROXY SERVER

the concepts of hierarchical classification. In OOP, the concept of inheritance provides the idea of reusability. POLYMORPHISM: -Polymorphism is another important property of OOP. Polymorphism means the ability to take more than one form. OBJECT-ORIENTED PARADIGM: -The features of object-oriented are: Emphasis is on data rather than procedure. Programs are divided in such a ways and that are known as Objects. Data structures are designed such that they characterize the objects. Methods that operate on the data of an object are tied together in the data structure. Data is hidden and cannot be accessed by external functions.

MySQL The MySQL Database powers the most demanding Web, E-commerce and Online Transaction Processing (OLTP) applications. It is a fully integrated transaction-safe, ACID compliant database with full commit, rollback, crash recovery and row level locking capabilities. MySQL delivers the ease of use, scalability, and performance that has made MySQL the world's most popular open source database. Some of the world's most trafficked websites like Facebook, Google, ticketmaster, and eBay rely on MySQL for their business critical applications.

7|Page

JAVA PROXY SERVER

MySQL Enterprise Monitor The MySQL Enterprise Monitor continuously monitors your MySQL servers and alerts you to potential problems before they impact your system. Its like having a "Virtual DBA Assistant" at your side to recommend best practices to eliminate security vulnerabilities, improve replication,

optimize performance and more. As a result, the productivity of your developers, DBAs and System Administrators is improved significantly.

8|Page

JAVA PROXY SERVER

TOOLS/PLATFORM
3.1.1 HARDWARE SPECIFICATION

VIRTUAL MEMEORY PROCESSOR RAM : 32 BIT, Pentium IV : 1 GB 9|Page

JAVA PROXY SERVER HARD DISK MONITOR : 40 GB : (1024 * 768 RESOLUTIONS)

3.1.2 SOFTWARE SPECIFICATION

OPERATING SYSTEM FRONT END BACK END

: Windows 2000/XP. : JAVA : My SQL

SYSTEM ANALYSIS
IDENTIFICATION OF NEED To identify the need for software we use the Principles of Requirement Engineering. Requirement engineering provides the appropriate

mechanism for understanding what the customer wants, analyzing need, assessing feasibility, negotiating a reasonable solution, specifying the solution unambiguously, validating the specification and managing the
10 | P a g e

JAVA PROXY SERVER

requirement as they are transformed into an operational system.

The

requirement engineering process can be described in five distinct steps: Requirement elicitation. Requirement analysis & negotiation. Requirement specification. System Modeling. Requirement validation. Requirement Management.

In other words we can say that requirement analysis is a software task that bridges the gap between system level requirement engineering and software design. Requirement analysis allows the software

engineering to refine the software allocation and build models of the data, functional and behavioral domains that will be treated by software. Requirement analysis provides the software designer with a

representation of information, function and behavior that can be translated into data, architectural, interface and component level design; finally the requirement specification provides the developer and the customer with the means to assess quality once software is built. The most commonly used requirement elicitation technique is to conduct a meeting or interview. The first meeting between a software engineer and customer can be likened to the awkwardness of a first date between to adolescents. Neither person knows what to say or ask, Both are worried that what they do say will be misinterpreted, both are thinking
11 | P a g e

JAVA PROXY SERVER

about where it might lead (Both likely have radically different expectation here) Both want to get the think over with, but at the same time, both want it to be a success. Here according to this principle the analyst starts by asking context-free-questions. That is a set of question that will lead to a basic understanding of the problem, the people who want a solution, the nature of solution that is desired, and the effectiveness of the first encounter itself. The first set of Context-free question focuses on the customer, the overall goals, and the benefits. For example, the analyst might ask: Who is behind the request for this work? Who will use the solution? What will be economic benefit of a successful solution? Is there another source for the Solution that you need? The next set of the questions enables the software engineer to gain a better Understanding of the problem and the customer to voice his or her perceptions about a solution: How would you characterize good output that would be generated by a successful solution? What problem(s) will this solution address? Can you show me (or describe) the environment in which the solution will be used? Will special performance issues or constraints affect the way of the solution is approached?
12 | P a g e

JAVA PROXY SERVER

Are you the right person to answer these questions? Are your answers? Official?

Are my questions relevant to the problem that you have? Am I asking too many questions? Can anyone else provide additional information? Should I be asking you anything else?

According to the above concepts I went to the various consultancy and met its staffs, management, and some persons related with the organizational work, which advised me related with my project.

Preliminary Investigation
The first step in the system development life cycle is the preliminary investigation to determine the feasibility of the System. The purpose of the preliminary investigation is to evaluate project requests. It is neither a design study nor does it includes the collection of details top describe the business system in all respect. Rather, it is collecting of information that helps committee members to evaluate the merits of the project request

13 | P a g e

JAVA PROXY SERVER

and make an informed judgment about the feasibility of the proposed project. Here for the Consultancy Agency Agency , I have worked on the preliminary investigation that accomplished the following objectives: Clarify and understand the project request. Determine the size of the project. Assess costs and benefits of alternative approaches. Determine the technical and operational feasibility of alternative approaches. Considering above criteria I also keep in mind that the requirements are clearly understandable when the clarification of project request is enquired. The data of the agency which are collected by me during preliminary investigation, are: Reviewing organization Documents Onsite observation and

FEASIBILITY STUDY:
A feasibility study is conducted to select the best system that meets performance requirements. This entities an identification description, an evaluation of candidate systems, and the selection of the best system for the job.

Economic feasibility:

14 | P a g e

JAVA PROXY SERVER

Economic analysis is the most frequently used method for evaluating the effectiveness of the candidate system. More commonly known as cost/benefit analysis, the procedure is to determine the benefits and savings that benefits outweigh costs, then the decision is made to design and implement the system. Otherwise, further justification or alterations in the proposed system will have to be made if it is to have a enhance to approve.

Technical feasibility:
Technical analysis centers on the existing computer system (hardware, software, etc.) and to what extent it can support the proposed addition. This involves financial considerations to accommodate technical

enhancement. If the budget is a serious constraint, then the project is judged not feasible.

Behavioral feasibility:
An estimate should be made of how strong a reaction the user staff is likely to have toward the development of a computerized system. It is common knowledge the computer installations have something to do with turnover, transfers and changes in employee job status. Therefore it is understandable that the introduction of a candidate system requires special effort to educate, sell, and train the staff on new ways of conducting business.
Project Planning

15 | P a g e

JAVA PROXY SERVER

The planning, design, and installation of a system termed a project and is directed by a project leader who uses the available resources to produce a new or better system for the organisations. Thus, project planning for any company has the following four main steps: 1. Organising the resources available for the project. 2. Scheduling the events of the project. 3. Evaluating the progress. 4. Establishing standards for the project. An effective manager is essential for successful project planning. The techniques of project planning are not a substitute for good management, but merely a tool to be used by managers to achieve better results. Only effective management can complete the project on time, within budget, and with satisfactory results.

Project Scheduling
In project management, a schedule consists of a list of a project's terminal elements with intended start and finish dates. Terminal elements are the lowest element in a schedule, which is not further subdivided. Those items are often estimated in terms of resource requirements, budget and duration, linked by dependencies and scheduled.
16 | P a g e

JAVA PROXY SERVER

The charting techniques are the scheduling tools of the project planner. Even the simplest project should be charted so that progress can be measured. The Gantt chart is effective in simple projects, especially when the interrelationships among events are not too complex. Complicated scheduling usually requires a PERT chart. When a project is behind schedule, corrective steps must be taken. Establishing milestones is meaningless unless the project manager can enforce adherence to schedule. Enforcement is a normal managerial duty. If a project leader cannot enforce a schedule, someone else should be leading the project. The following are variety of options that are open to the project leader: Increase the budget. Increase manpower in the form of overtime or additional people. Add equipment.

GANTT CHART

17 | P a g e

JAVA PROXY SERVER

20Days

Coding

Testing

PERT CHART

18 | P a g e

JAVA PROXY SERVER

SOFTWARE REQUIREMENTS SPECIFICATION The requirements gathering process is intensified and focused specifically on software. To understand the nature of the program(s) to be built, the
19 | P a g e

JAVA PROXY SERVER

software engineer (analyst) must understand the information domain for the software, as well as required function, behavior, performance, and interface. Requirements for both the system and the software are

documented and reviewed with the customer.


DESIGN

Software design is actually a multi step process that focuses on four distinct attributes of a program data structure, software architecture, interface representations, and procedural (algorithmic) detail. The design process translates requirements into a Representation of the software that can be accessed for quality before coding begins. Like requirements, the design is documented and becomes part of the software configuration.
Requirement & Code Generation: Analysis Specification

The design must be translated into a machine-readable form. The code generation step performs this task.
Design&

If design is performed in a detailed

manner, code generation can be accomplished mechanistically.


Testing: Specification

Once code has been generated, program testing begins.

The testing

process focuses on the logical internals of the software, ensuring that all statements have been tested and on the functional externals, that is, conducting tests to uncover errors and ensure that defined input will product actual results that agree with required results.
Integration System Testing Module Testing Coding

20 | P a g e Delivery Maintenance

JAVA PROXY SERVER

Waterfall Model of Software Life Cycle

SOFTWARE ENGINEERING PARADIGM Linear Sequential Model has been used in carrying out this project work. The Linear Sequential Model is the oldest and the most widely used paradigm for Software Engineering. Linear Sequential Model is called

sometimes the Classic Life Cycle or the Waterfall Model.


21 | P a g e

JAVA PROXY SERVER

The Linear Sequential Model suggests a systematic, Sequential approach to software development that begins at the system level and progresses through Analysis, Design, Coding, Testing and Support. Linear Sequential Model contains the following activities: System / Information Engineering and Modelling: Because software is always part of a larger system (or business), work begins by establishing requirements for all system elements and then allocating some subset of these requirements to software. This system

view is essential when software must interact with other elements such as hardware, people and database. System engineering and analysis

encompass requirements gathering at the system level with a small amount of top-level design and analysis. Information engineering

encompasses requirements gathering at the strategic business level and at the business area level. In this project, very first I get to know how the processing is done in the Transport agency system. When I had accepted this project the purpose is to develop software that should assists to generate the report. The software will serve them as an automated system in performing all the operation of the Transport. Before starting this project or system there are some informations needed, they are: 1. First one is that understand about the working mechanism of The

transport business.

22 | P a g e

JAVA PROXY SERVER

2.

Find out that which type of functionality should be adopted by the

proposed project.. 3. Which type hardware and software platform will be most suitable for

the proposed project? As the proposal system was being maintained onto the form of paper based, literature relating to this system was available in the forms of various reports. Various documents were available to collect data about the shortcoming of the existing system. The system provides information that how the work is being done and how data are maintained which are useful for the user, what changes need to be made.

Requirement specification Problem clarifications in this case are much more difficult. In either case, before any further steps can be taken, the project requests must be clearly states. This phase (initial study) involves estimating whether or not a

development project is worthwhile. Problems with the current automated or manual system are identified, as well as the benefits and costs of an alternative system. If the benefits seem to outright the costs (especially when compared with competing projects), a green signal may be given to continue the project, and detailed plans and schedules are drafted for making the system a reality.

23 | P a g e

JAVA PROXY SERVER

SOFTWARE REQUIREMENT SPECIFICATION (SRS) SRS is software requirement specification it contains the s/w requirement details like what is front-end technology, backend technology, os and hardware architecture of the project. SRS stands for Software Requirement Specification. It establishes the basis for agreement between customers and contractors or suppliers on what the software product is expected to do, as well as what it is not expected to do.
24 | P a g e

JAVA PROXY SERVER

Some of the features of SRS are It sets permits a rigorous assessment of requirements before design can begin. It sets the basis for software design, test, deployment, training etc. It also sets pre-requisite for a good design though it is not enough. It sets basis for software enhancement and maintenance.

It sets Basis for Project plans like Scheduling and Estimation. Thus, SRS should be consistent, correct, unambiguous & complete, document. The developer of the system can prepare SRS after detailed communication with the customer. An SRS clearly defines the following: External Interfaces of the system: They identify the information which is to flow from and to to the system. Functional and non-functional requirements of the system. They stand for the finding of run time requirements.

System Design
The system design process is not a step adherence of clear procedures and guidelines. Though, certain clear procedures and guidelines have emerged in recent days, but still much of design work depends on knowledge and experience of the designer. When designer starts working on system design, he will face different type of problems. Many of these will be due to constraints imposed by the user or limitation of the hardware and software available in
25 | P a g e

JAVA PROXY SERVER

the market. Sometimes, it is difficult to enumerate the complexity of the problems and solutions therefore since the variety of likely problems is so great and no solutions are exactly similar. However, following

considerations should be kept in mind during the system-designing phase. Design Objectives The primary objective of the design, of course, is to deliver the requirement as specified is the feasibility report. In general, the following design objectives should be kept in mind. A. Practicality: The system must be stable and can be operated by people with average intelligence.

B. Efficiency:

This involves accuracy, timeliness and comprehensiveness of the system output. C. Cost: It is desirable to aim for a system with a minimum cost subject to the condition that it must satisfy all the requirements. D. Flexibility:

26 | P a g e

JAVA PROXY SERVER

The system should be modifiable depending on the changing needs of the user. Such modifications should not entail extensive reconstructing or It should also be portable to different computer

recreation of software. system. E. Security:

This is very important aspect of the design and should cover areas of hardware reliability, fall back procedures, physical security of data and provision for detection of fraud and abuse. In actually System Design

involves first logical design and then physical construction of the system. The logical design describes the structure and characteristics of features, like the outputs, inputs, files, databases and procedures. The physical

construction, which follows the logical design, produces actual program software, files and a working system.

Design Constraints The designer normally will work under following constraints: A) Hardware: The existing hardware will obviously affect the system design. B) Software: The available software (Operating System, Utilities, Language etc.) in the market will constrain the design?
27 | P a g e

JAVA PROXY SERVER

C) Budget: The budget allocated for the project will affect the scope and depth of design. D) Time-Scale: The new system may be required by a particular time (e.g. the start of a financial year). This may put a constraint on the designer to find the best design. E) Interface with other Systems: The new system may require some data from another computerized system or may provide data to another system in which case the files must be compatible in the format and the system must operate with a certain processing cycle. Mainly, following five parts have been included in the system design process: i) Output Design: The starting point of the design process is the proper knowledge of system requirements, which will normally be converted in terms of output. ii) Input Design: Once the output requirements have been finalized, the next step is to find out what data need to be made available to the system to produce the desired outputs. The basic documents in which these data are available

28 | P a g e

JAVA PROXY SERVER

need to be identified.

If necessary, these documents may have to be

revised or new documents may have to be introduced. iii) File Design: Once the input data is captured in the system, these may have to be preserved either for a short or long period. These data will generally be stored in files in a logical manner. The designer will have to devise the

techniques of storing and retrieving data from these files. iv) Procedure Design: This step involves specification of how processing will be performed in this, there are two aspects: Computer procedure. Non-computer procedure. The computer procedure will specify what Functions will be

carried out on computer, what will be different programs and in what sequence the programs will be run. v) Control Design: The control design indicates necessary procedures which will ensure correctness of processing, accuracy of data, timely output etc. This will ensure that the system is functioning as per plan. Input Design The design of input play very significant role in getting the correct output. It covers all phases of input from creation of initial data to
29 | P a g e

JAVA PROXY SERVER

actual entering the data to the system for processing. The input design is the link that ties the information system into the world of its users. Some feature of design may very depending on whether the system is batch oriented or online. The various objectives of input design which focus on: Controlling amount of input. Avoiding delay. Avoiding errors in data. Avoiding extra steps.

Major Concerns Regarding Input: We must consider on some important points regarding input, they are: What input is needed? How and where is the input created? How should the source documents be designed?

Output Design Presenting the data processed by a computer-based information system in an attractive and usable form has become very essential. Success and acceptance of a system to some extent depend on good presentation. Therefore, system analysts must know fully how to design output report in an attractive way. Many new output devices are being introduced in the market because of recent development in computer technology.
30 | P a g e

JAVA PROXY SERVER

There are three main reasons why outputs from the computer are required. 1. For communicating to the persons concerned.

For re-input to the computer for being connected with other data and further processing.

CODING
31 | P a g e

JAVA PROXY SERVER

& LAYOUT

FIREWALL SERVER
Welcome Page
package proxyl.server; public class Welcome extends javax.swing.JFrame { /** Creates new form Welcome */ public Welcome() { initComponents(); } @SuppressWarnings("unchecked") 32 | P a g e

JAVA PROXY SERVER // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Welcome - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/firewall.jpg"))); // NOI18N jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Welcome to Firewall Implementation"); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jButton1.setText("Continue"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });

jButton2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jButton2.setText("Exit"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } });

33 | P a g e

JAVA PROXY SERVER javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 28, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel1)))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(20, 20, 20) 34 | P a g e

JAVA PROXY SERVER .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(19, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack();

}// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Login ln = new Login(); dispose(); 35 | P a g e

JAVA PROXY SERVER ln.show(); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Welcome().setVisible(true); } }); }

// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; // End of variables declaration }

36 | P a g e

JAVA PROXY SERVER

Login Page
package proxyl.server; import java.sql.Connection; 37 | P a g e

JAVA PROXY SERVER import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Login extends javax.swing.JFrame { /** Creates new form Login */ public Login() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); txtuid = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txtpwd = new javax.swing.JPasswordField(); jLabel4 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Login - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Login"); 38 | P a g e

JAVA PROXY SERVER jPanel2.setBackground(new java.awt.Color(204, 102, 0)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.Bor derFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Login", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Adobe Caslon Pro", 0, 11))); // NOI18N jButton1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton1.setText("Login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton3.setText("Register"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel3.setText("Password"); txtuid.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel2.setText("User ID"); txtpwd.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( 39 | P a g e

JAVA PROXY SERVER

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jButton3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1)) .addComponent(txtuid, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtpwd, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(17, 17, 17)

40 | P a g e

JAVA PROXY SERVER

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(txtuid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(33, 33, 33) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(txtpwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jButton1) .addComponent(jButton3)) .addContainerGap()) ); jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton3}); jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/login.jpg"))); // NOI18N jButton2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton2.setText("Forgot Password"); 41 | P a g e

JAVA PROXY SERVER jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING) .addComponent(jButton2) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jLabel1))))

42 | P a g e

JAVA PROXY SERVER .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(jLabel1) .addGap(27, 27, 27) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING, false) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton2) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) );

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); 43 | P a g e

JAVA PROXY SERVER layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Register reg = new Register(); dispose(); reg.show(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String login = null; String pwd = null; login = txtuid.getText(); if (login.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your user id."); return; } pwd = txtpwd.getText(); if (pwd.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your password."); return; } try { 44 | P a g e

JAVA PROXY SERVER Connection con = dbconnection.makeConnection(); PreparedStatement ps = con.prepareStatement("select * from registration where userid=? and password=?"); ps.setString(1, login); ps.setString(2, pwd); ResultSet rs = ps.executeQuery(); if (rs.next()) { //insert into login history String sql = "insert into login_history(uname,login_date,login_time) values(?,now(),now())"; ps = con.prepareStatement(sql); ps.setString(1, login); ps.executeUpdate(); //send profile page Home cpi = new Home(); dispose(); cpi.show(true); } else { javax.swing.JOptionPane.showMessageDialog(rootPane, "User id ans password are wrong.!Re-try"); } } catch (Exception e) { e.printStackTrace(); } }

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Forgotpassword reg = new Forgotpassword(); dispose(); reg.show(); 45 | P a g e

JAVA PROXY SERVER } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Login().setVisible(true); } }); }

// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPasswordField txtpwd; private javax.swing.JTextField txtuid; // End of variables declaration }

46 | P a g e

JAVA PROXY SERVER

47 | P a g e

JAVA PROXY SERVER

Register
package proxyl.server; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Register extends javax.swing.JFrame { public Register() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtname = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtage = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtaddress = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); txtuid = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); txtskey = new javax.swing.JTextField(); 48 | P a g e

JAVA PROXY SERVER txtpwd = new javax.swing.JPasswordField(); jLabel7 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Register - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Register"); jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Name"); txtname.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Age"); txtage.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Address"); txtaddress.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("User ID"); txtuid.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel6.setForeground(new java.awt.Color(255, 255, 255)); 49 | P a g e

JAVA PROXY SERVER jLabel6.setText("Password"); txtskey.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N txtpwd.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("Secret Key"); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton1.setText("Submit"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton2.setText("Go to Login"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(68, 68, 68)

50 | P a g e

JAVA PROXY SERVER

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 358, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 366, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel1) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(jLabel7)) .addGap(30, 30, 30) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(txtage) .addComponent(txtname) 51 | P a g e

JAVA PROXY SERVER .addComponent(txtaddress) .addComponent(txtuid) .addComponent(txtpwd) .addComponent(txtskey) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1))))))) .addGap(83, 83, 83)) );

jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton1, jButton2});

jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(jLabel1) .addGap(34, 34, 34) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel2) .addComponent(txtname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 52 | P a g e

JAVA PROXY SERVER .addGap(29, 29, 29) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING) .addComponent(jLabel3) .addComponent(txtage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING) .addComponent(jLabel4) .addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(36, 36, 36) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel5) .addComponent(txtuid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel6) .addComponent(txtpwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(33, 33, 33)

53 | P a g e

JAVA PROXY SERVER

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(txtskey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addGap(40, 40, 40) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(50, Short.MAX_VALUE)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton2}); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> 54 | P a g e

JAVA PROXY SERVER private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Login lg = new Login(); dispose(); lg.show(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String name = null; String address = null; String age = null; String login = null; String pwd = null; String skey = null; name = txtname.getText(); if (name.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your name."); return; } login = txtuid.getText(); if (login.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your user id."); return; } pwd = txtpwd.getText(); if (pwd.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your password."); return; 55 | P a g e

JAVA PROXY SERVER } skey = txtskey.getText(); if (skey.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your seckret key."); return; } //check user availability try { Connection con = dbconnection.makeConnection(); PreparedStatement ps = con.prepareStatement("select * from registration where userid=?"); ps.setString(1, login); ResultSet rs = ps.executeQuery(); if (rs.next()) { javax.swing.JOptionPane.showMessageDialog(rootPane, "" + login + " is Available.!Please enter diffrent users."); txtuid.setText(""); return; } } catch (Exception e) { e.printStackTrace(); } age = txtage.getText(); address = txtaddress.getText(); try { Connection con = dbconnection.makeConnection(); String sql = "insert into registration(userid,password,secretkey,name,age,address,reg_date) values(?,?,?,?,?,?,now())"; 56 | P a g e

JAVA PROXY SERVER PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, login); ps.setString(2, pwd); ps.setString(3, skey); ps.setString(4, name); ps.setString(5, age); ps.setString(6, address); int i = ps.executeUpdate(); if (i > 0) { JOptionPane.showMessageDialog(rootPane, "Your information has been successfully submited."); txtname.setText(""); txtage.setText(""); txtaddress.setText(""); txtuid.setText(""); txtpwd.setText(""); txtskey.setText(""); } else { JOptionPane.showMessageDialog(rootPane, "Your information has not been submited.! Try-agin"); } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(rootPane, "Problem in database."); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { 57 | P a g e

JAVA PROXY SERVER new Register().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtaddress; private javax.swing.JTextField txtage; private javax.swing.JTextField txtname; private javax.swing.JPasswordField txtpwd; private javax.swing.JTextField txtskey; private javax.swing.JTextField txtuid; // End of variables declaration }

58 | P a g e

JAVA PROXY SERVER

59 | P a g e

JAVA PROXY SERVER

Forgot Password
package proxyl.server; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Forgotpassword extends javax.swing.JFrame { /** Creates new form Forgotpassword */ public Forgotpassword() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtuid = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); 60 | P a g e

JAVA PROXY SERVER txtskey = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Forgot Password - Firewall Implementation");

jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Forgot Password"); jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel2.setText("User ID"); txtuid.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel3.setText("Secret Key"); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton1.setText("Go to Login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton2.setText("Submit"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); 61 | P a g e

JAVA PROXY SERVER txtskey.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(44, 44, 44) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel1) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(69, 69, 69) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(txtskey) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE) .addComponent(jButton2)) .addComponent(txtuid)))) .addGap(64, 64, 64)) 62 | P a g e

JAVA PROXY SERVER ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(30, 30, 30) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING) .addComponent(txtuid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel1) .addGap(52, 52, 52) .addComponent(jLabel2))) .addGap(50, 50, 50) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel3) .addComponent(txtskey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(54, 54, 54) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jButton2) .addComponent(jButton1)) .addContainerGap(77, Short.MAX_VALUE)) ); 63 | P a g e

JAVA PROXY SERVER javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //login Login lg = new Login(); dispose(); lg.show(); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String login = null; String skey = null; login = txtuid.getText(); if (login.equals("")) { 64 | P a g e

JAVA PROXY SERVER JOptionPane.showMessageDialog(rootPane, "Please enter your user id."); return; } skey = txtskey.getText(); if (skey.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter your secret key."); return; } try { Connection con = dbconnection.makeConnection(); PreparedStatement ps = con.prepareStatement(" select * from registration where userid=? and secretkey=?"); ps.setString(1, login); ps.setString(2, skey); ResultSet rs = ps.executeQuery(); if (rs.next()) { javax.swing.JOptionPane.showMessageDialog(rootPane, "Your password is " + rs.getString("password") + "."); } else { javax.swing.JOptionPane.showMessageDialog(rootPane, "Invalid user id and secret key."); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { 65 | P a g e

JAVA PROXY SERVER new Forgotpassword().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtskey; private javax.swing.JTextField txtuid; // End of variables declaration }

66 | P a g e

JAVA PROXY SERVER

67 | P a g e

JAVA PROXY SERVER

Firewall Home
package proxyl.server; //import server.*; public class Home extends javax.swing.JFrame { ServerThread st; public Home() { initComponents(); st = new ServerThread(); Thread t = new Thread(st); t.start(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {

jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); 68 | P a g e

JAVA PROXY SERVER jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Home - Firewall Implementation");

jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 32)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Firewall Implementation"); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton1.setText("Add Ip Address."); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton2.setText("IP List"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton3.setText("Attracker List"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } 69 | P a g e

JAVA PROXY SERVER }); jButton6.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton6.setText("Exit"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/firewall1.jpg"))); // NOI18N javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING)

70 | P a g e

JAVA PROXY SERVER .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jLabel2) .addGap(22, 22, 22)))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1) .addGap(36, 36, 36) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1) .addGap(62, 62, 62) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 71 | P a g e

JAVA PROXY SERVER .addComponent(jButton3) .addGap(75, 75, 75) .addComponent(jButton6)) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(27, Short.MAX_VALUE)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton2, jButton3, jButton6}); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold> private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //exits button dispose(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 72 | P a g e

JAVA PROXY SERVER // TODO add your handling code here: //Add Ip address IPAddress ip = new IPAddress(); ip.show(); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //decription IPAddressList iplst = new IPAddressList(); iplst.show(); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: AttackerList atlst = new AttackerList(); atlst.show(); } public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); 73 | P a g e

JAVA PROXY SERVER break; } } } catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Home().setVisible(true); } }); }

// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; // End of variables declaration 74 | P a g e

JAVA PROXY SERVER }

75 | P a g e

JAVA PROXY SERVER

Add IP Address
package proxyl.server; import java.sql.Connection; import java.sql.PreparedStatement; 76 | P a g e

JAVA PROXY SERVER import java.sql.ResultSet; import javax.swing.JOptionPane; public class IPAddress extends javax.swing.JFrame { public IPAddress() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtclientname = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtipaddress = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Register - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Add IP Address");

jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Client Name"); txtclientname.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N 77 | P a g e

JAVA PROXY SERVER jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("IP Address");

txtipaddress.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton1.setText("Submit"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N jButton2.setText("Close"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(68, 68, 68) 78 | P a g e

JAVA PROXY SERVER

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(62, 62, 62) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.TRAILING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txtipaddress, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtclientname, javax.swing.GroupLayout.Alignment.LEADING)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); 79 | P a g e

JAVA PROXY SERVER jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(jLabel1) .addGap(34, 34, 34) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel2) .addComponent(txtclientname, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(28, 28, 28) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jLabel3) .addComponent(txtipaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(101, 101, 101) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) 80 | P a g e

JAVA PROXY SERVER .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(39, Short.MAX_VALUE)))) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton2}); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold> private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String clientName = null; String ipAddress = null; 81 | P a g e

JAVA PROXY SERVER clientName = txtclientname.getText(); if (clientName.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter client name."); return; } ipAddress = txtipaddress.getText(); if (ipAddress.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter ip address."); return; } //check user availability try { Connection con = dbconnection.makeConnection(); PreparedStatement ps = con.prepareStatement("select * from ip_address where ipaddress=?"); ps.setString(1, ipAddress); ResultSet rs = ps.executeQuery(); if (rs.next()) { javax.swing.JOptionPane.showMessageDialog(rootPane, "" + clientName + " is allready saved in database."); txtclientname.setText(""); txtipaddress.setText(""); return; } } catch (Exception e) { e.printStackTrace(); } try { Connection con = dbconnection.makeConnection(); 82 | P a g e

JAVA PROXY SERVER String sql = "INSERT INTO ip_address(client_name,ipaddress) VALUES(?,?)"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, clientName); ps.setString(2, ipAddress); int i = ps.executeUpdate(); if (i > 0) { JOptionPane.showMessageDialog(rootPane, "IP Address has been successfully added."); txtclientname.setText(""); txtipaddress.setText(""); } else { JOptionPane.showMessageDialog(rootPane, "IP Address has not been added."); } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(rootPane, "Problem in database."); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new IPAddress().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; 83 | P a g e

JAVA PROXY SERVER private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtclientname; private javax.swing.JTextField txtipaddress; // End of variables declaration }

84 | P a g e

JAVA PROXY SERVER

85 | P a g e

JAVA PROXY SERVER

IP Address List
package proxyl.server; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.table.DefaultTableModel; public class IPAddressList extends javax.swing.JFrame { Object data[][] = {}; Object col[] = {"ID", "Client Name", "IP Address"}; DefaultTableModel model = new DefaultTableModel(data, col); public IPAddressList() { initComponents(); //Show Data jTable1.setModel(model); String totValue = getTableName(); String[] temp = totValue.split(";"); int k = temp.length; //dispaly data in inbox for (int i = 0; i < k; i++) { String val[] = temp[i].split(":~"); model.insertRow(jTable1.getRowCount(), new Object[]{ val[0], val[1], val[2], }); } }

public String getTableName() { 86 | P a g e

JAVA PROXY SERVER String res = ""; try { Connection con = dbconnection.makeConnection(); Statement st = con.createStatement(); String QueryString = "SELECT id,client_name,ipaddress FROM ip_address ORDER BY id ASC"; ResultSet rst = st.executeQuery(QueryString); while (rst.next()) { res = res + rst.getString(1) + ":~" + rst.getString(2) + ":~" + rst.getString(3) + ";"; } } catch (Exception e) { e.printStackTrace(); } return res; } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("IP Address - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jTable1.setModel(new javax.swing.table.DefaultTableModel( 87 | P a g e

JAVA PROXY SERVER new Object [][] { }, new String [] { "ID", "Client Name", "IP Address" } ){ Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jScrollPane1.setViewportView(jTable1); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N jButton1.setText("Close"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("IP Address List"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( 88 | P a g e

JAVA PROXY SERVER

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) 89 | P a g e

JAVA PROXY SERVER .addComponent(jButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); } public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

90 | P a g e

JAVA PROXY SERVER * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } }

} catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.L evel.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new IPAddressList().setVisible(true); 91 | P a g e

JAVA PROXY SERVER } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration }

92 | P a g e

JAVA PROXY SERVER

93 | P a g e

JAVA PROXY SERVER

Attracker List
package proxyl.server; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.table.DefaultTableModel; public class AttackerList extends javax.swing.JFrame { Object data[][] = {}; Object col[] = {"ID", "IP Address", "Date"}; DefaultTableModel model = new DefaultTableModel(data, col); public AttackerList() { initComponents(); //Show Data jTable1.setModel(model); String totValue = getTableName(); String[] temp = totValue.split(";"); int k = temp.length; //dispaly data in inbox for (int i = 0; i < k; i++) { String val[] = temp[i].split(":~"); model.insertRow(jTable1.getRowCount(), new Object[]{ val[0], val[1], val[2],
94 | P a g e

JAVA PROXY SERVER

}); } }

public String getTableName() { String res = ""; try { Connection con = dbconnection.makeConnection(); Statement st = con.createStatement(); String QueryString = "SELECT id,ip_address,DATETIME FROM attacker ORDER BY DATETIME ASC"; ResultSet rst = st.executeQuery(QueryString); while (rst.next()) { res = res + rst.getString(1) + ":~" + rst.getString(2) + ":~" + rst.getString(3) + ";"; } } catch (Exception e) { e.printStackTrace(); } return res; } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel();
95 | P a g e

JAVA PROXY SERVER

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Attacker List - Firewall Implementation"); jPanel1.setBackground(new java.awt.Color(204, 102, 0)); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "ID", "IP Address", "Date" } ){ Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jScrollPane1.setViewportView(jTable1); jButton1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N jButton1.setText("Close"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });
96 | P a g e

JAVA PROXY SERVER

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Attacker List"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LE ADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Ali gnment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())
97 | P a g e

JAVA PROXY SERVER

); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LE ADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
98 | P a g e

JAVA PROXY SERVER

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) );

pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); } public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) {
99 | P a g e

JAVA PROXY SERVER

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.log ging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.log ging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.log ging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.log ging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AttackerList().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration
100 | P a g e

JAVA PROXY SERVER

101 | P a g e

JAVA PROXY SERVER

FIREWALL CLIENT Home Page


package firewall.client; import proxyl.server.*; import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException;
102 | P a g e

JAVA PROXY SERVER

import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane;

//import server.*; public class Home extends javax.swing.JFrame {

ReceiverClient rc; public Home() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {

jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); txtipaddress = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CL OSE); setTitle("Home - Firewall Implementation");

103 | P a g e

JAVA PROXY SERVER

jPanel1.setBackground(new java.awt.Color(204, 102, 0));

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 32)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Firewall Implementation");

jButton5.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N jButton5.setText("Send File"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } });

jButton6.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N jButton6.setText("Exit"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } });

jLabel2.setText("IP Address");

104 | P a g e

JAVA PROXY SERVER

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N jButton1.setText("Connect ot Server"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });

javax.swing.GroupLayout javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(

jPanel1Layout

new

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Align ment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING) .addComponent(jLabel1) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1) .addGap(27, 27, 27) .addComponent(jButton5) .addGap(28, 28, 28) .addComponent(jButton6)) .addGroup(jPanel1Layout.createSequentialGroup()

105 | P a g e

JAVA PROXY SERVER

javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30)

.addComponent(jLabel2, 61,

.addComponent(txtipaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(112, Short.MAX_VALUE)) );

jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton5, jButton6});

jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Align ment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(jLabel1) .addGap(41, 41, 41) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.BASELINE) .addComponent(txtipaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(72, 72, 72) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.BASELINE) .addComponent(jButton6)
106 | P a g e

JAVA PROXY SERVER

.addComponent(jButton5) .addComponent(jButton1)) .addContainerGap(84, Short.MAX_VALUE)) );

jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton5, jButton6});

javax.swing.GroupLayout javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(

layout

new

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LE ADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LE ADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) );

pack(); }// </editor-fold>

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
107 | P a g e

JAVA PROXY SERVER

//exits button dispose(); } private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //start client for receiving a file String ipAddress = txtipaddress.getText(); if (ipAddress.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter ip address"); return; } else { rc = new ReceiverClient(ipAddress); }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:

String ipAddress = txtipaddress.getText(); if (ipAddress.equals("")) { JOptionPane.showMessageDialog(rootPane, "Please enter ip address"); return; } else { Socket sockett;
108 | P a g e

JAVA PROXY SERVER

try { sockett = new Socket(ipAddress, 2222); java.io.OutputStream sockett.getOutputStream(); sockett.close(); } catch (UnknownHostException ex) { Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex); } outputstream =

try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) {
109 | P a g e

JAVA PROXY SERVER

java.util.logging.Logger.getLogger(Home.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Home.class.getName()).log(java .util.logging.Level.SEVERE, null, ex); } //</editor-fold>

/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Home().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JTextField txtipaddress; // End of variables declaration }
110 | P a g e

JAVA PROXY SERVER

111 | P a g e

JAVA PROXY SERVER

Testing Approach

112 | P a g e

JAVA PROXY SERVER

Computer s/w has become more complex. The need for specialized testing approaches has also grown. The white box and black box testing methods are applicable across all environments. GUI present integrity challenges for software engineers. Because of reusable components provided, the creation of the user interface has become less time consuming and more process. But at the same time the completely of GUI s has grown, leading to more difficulty is the design and execution of test crises. Finites step modeling graphs man be used to drive a series of test that address specific data and programs objects that are relevant to the GUI. Due to the large no. of permutation associated with GUI operations testing should be approached using automated fools.

Verification and validation:Verification refers to the set of activity that insures that software correctly implements a specific function. Validation refresh to a different set of activities that insure that the software that has built that is traceable customer requirements. In other words validation provides final assurance that software meets all functional, behavioral and performance requires. Boebam states another way: Verification: - Are we building the product right. Validation: - Are we building the right product. Verification and validation encompasses a wide array of SQA (software quality assurance) activities that include formal technical review, quality
113 | P a g e

JAVA PROXY SERVER

and configuration audits, performance monitoring, simulation, fusibility study, documentation review, development testing, qualification testing and installation testing.

Context of system test


Validation testing

Integration testing

Unit testing

Software testing strategy:A strategy for software testing may also be viewed in the context of the spiral.
Requirement System engineers Design

Code

114 | P a g e

JAVA PROXY SERVER

Unit testing is begins at the vortex of the spiral and concentration on each unit (component) of the software as implemented in source code. Testing programs by moving outward along the spiral to integrated testing, where the focus is on design and construction of the software architecture. Taking another term out word on the spiral be in countered validation testing, where requirements established as part of software requirement analysis are validated against the software that has been constructed. Finally we arrive other at system testing where the s/w , we special out along stream lines that we spiral the scope of testing with each turned.

Unit testing:Unit testing focus verification afford on the smallest unit of the software design-the software component / module. Using component level design description as a guide, important control paths are tested to
115 | P a g e

JAVA PROXY SERVER

uncover within the boundary of the module. The unite test is white box printed. The test that occurs as parts of unit tests is illustrated schematically. The module interface is tested to insure that information properly follows into and out of the program unit under test. The local data structure is examined to insure that data stored temporarily maintains its integrity during all steps in an algorithms execution. Boundary condition are tested to insure that the module operates properly at boundaries established to limit or restrict processing. All independent paths through the control structure are executed at least once. And finally all error handling paths are tested.

SYSTEM TESTING AND IMPLEMENTATION


UNIT TESTING ACCEPTANCE TESTING IMPLEMENTATION UNIT TESTING:
116 | P a g e

JAVA PROXY SERVER

Module interfaces were tested to ensure that the information properly flows into and out of the program units.

Logical errors were corrected from each of the modules involved in the system.

All the software functions were checked to be operational. Checked whether all the inputs are properly storing in the database without any change in the data.

Checked if the reports are correctly produced. Checked if the integrity of external information is maintained.

ACCEPTANCE TESTING: Alpha testing had been conducted under acceptance testing. During the process, certain features were misinterpreted by the users that were further corrected by enhancing the system by adding a few more dialog box so that the users could interact in a better way.

PRINT SCREEN OF TESTING

117 | P a g e

JAVA PROXY SERVER

THERE ARE FOLLOWING ERROR IN SYNTEX AND CONNECTION.

ERROR IN METHOD DECLARATION:

118 | P a g e

JAVA PROXY SERVER

VALIDATION CHECK
Implementation means to take into practice. A crucial phase in the system life cycle is the successful implementation of the new system design. Implementation includes all those activities that take
119 | P a g e

JAVA PROXY SERVER

place to convert from the old system to the new one. The new system may be completely new, replacing an existing manual or automated system. This part our documentation describes the information related on security aspects. Security is most vital thing as far as the concern of software development period. Our proposed project is also follows this property of security management. The modern age of software development task is full of

concentrations. It demands a lot of facilities along with high security. We have also introduced here some subway to protect our software from unauthorized person. Each user should have individual login name. Each user should have individual password. Extra security is implemented to safely use the

database. This section o four software takes user ID and PASSWORD time to time.Some part our software is accessible only to the chief persons of the hotel. This is done for security purpose of confidential documents in which core informations of the hotel are stored.

Debugging
Debugging occurs as a consequence of successful testing. Debugging

refers to the process of identifying the cause for defective behavior of a system and addressive that problem. In less complex terms- fixing a bug.
120 | P a g e

JAVA PROXY SERVER

When a test case uncovers an error, debugging is the process that results in the removal of the error. The debugging process begins with the

execution of a test case. The debugging process attempts to match symptoms with cause, thereby leading to error correction. The following are two alternative outcomes of the debugging: the cause will be found and necessary action such as correction or removal will be taken. The cause will not be found.

Characteristics of bugs The symptoms ant the cause may be geographically remote. That is, the symptoms may appear in one part of a program. While the cause may actually be located at a site that is far removed. Highly coupled program structures exacerbate this situation.The symptoms may

disappear(temporarly) when another error is connected.the Symptom may actually be caused by non error(e.g, round-Off inaccuracies). 1. The symptoms may be caused by human error that is not easily traced.

2. The symptom may be a result of timing problems, rather than processing problems. 3. It may be difficult to accurately reproduce input conditions(e.g, a real-time application in which input ordering is indeterminate).

121 | P a g e

JAVA PROXY SERVER

4. The symptom may be intermittent. This is particularly common in embedded inextricably. 5. The symptoms may be due to causes that are distributed across a number of tasks running on different processors. systems that couple hardware and software

COST ESTIMATIONS
Cost estimation is the next step for the project. The cost of the project is derived not only from the estimates of effort and size but from other parameters such as hardware, travel expanses, telecommunication costs, training cost etc. shoul d also be taken into account.
122 | P a g e

JAVA PROXY SERVER

Now once the estimation is complete we may be interested to know the how accurate the estimates are to reality. The answer to this is we do know until the project is complete. There is always some uncertainty associated with all estimation techniques. The accuracy of project will depend on the following: Accuracy of historical data used to project the estimation. Accuracy of input data to various estimates. Maturity of organizations software Developments.

The following are the some of the reasons which make data of cost estimation difficult: Software cost estimation requires significant amount of effort. Sufficient time is not allocated for planning. Software cost estimation is often done hurriedly, without an appreciation for the actual effort require an is far from real issues. Lack of experience for developing estimates, specially for large projects. An estimator used the extrapolation Technique to estimate, ignoring the non linear aspects of software development process. The following are the some of reasons for poor and inaccurate estimation: Requirements are imprecise, also requirement change frequently.
123 | P a g e

JAVA PROXY SERVER

The project is new and is different from past project handled. Non-availability of enough information about past projects. Estimate are forced to be based on available resources.

COST ESTIMATION OF THE PROJECT


TITLE SURVEY PROJECT APPROVAL PROJECT PLANNING ANALYSIS DESIGN SYSTEM IMPROVEMENT COST 200 200 200 250 500 400
124 | P a g e

JAVA PROXY SERVER

CODING TESTING IMPLEMENTATION MAINTENANCE REPORT GENERATION OTHERS TOTAL

200 100 150 150 150 200 2700

SECURITY MECHANISM:
In the software security there are two levels of security. The 1 st level of security, which is provided by the FRONT END and 2 nd level of security provided by the database which is being used. FRONT END SECURITY:This security level is developed or designed by the s/w developer or designer. S/he provides her/his s/w the security for the system, by considering many factors regarding to the particular s/w. In this software following are used to provide security. LOGIN CHECKING: There are two logins are provided in this software one for employees and one for applicants. In order to avail the services of software employees have to provide a valid id and password and only after entering correct id and password employee will get entry otherwise
125 | P a g e

JAVA PROXY SERVER

they will be blocked from accessing any services of this site. Similarly a login check is provided for user applying for job. In order to enter recruitment zone user have to enter id and password which they got after registration , in this way security have been provided for both employee section and applicant section. There is also provision to change the password in case password is known by other. BACK END SECURITY:In this particular software our back end used is Oracle. So all the inbuilt security aspects provided by the Oracle database is used as it is. It will provide the strong feature of security so that it will be difficult to change, modify any personal or university data. Information is vital to success, but when damaged or in the wrong hands, it can threaten success. Oracle provides extensive security features to safe guard your information from both unauthorized viewing and intentional or inadvertent damage. This security is provided by granting or revoking privileges on a person- byperson and privilege-by-privilege basis. There are six ways by which security regarding to the database can be provided. They are as follows(1) CREATE USER (2) DELETE USER (3) MODIFY USER (4) GRANT PERMISSION TO USER (5) COMMIT (6) ROLLBACK

126 | P a g e

JAVA PROXY SERVER

FUTURE SCOPE OF THIS PROJECT


In future this project can be treated as product according to specification and needs of any organisation.

Since proxy server plays key role in any organization; thus, success over a long period of time and reliance of organization over recruitment is going to be one of the most considered topic for any organization.

Therefore Java Proxy Server Process will be of great help in carrying out efficient process smoothly and effectively.

At present days every organization is using web technology for their proper functioning, so this web based project is all in all important from market aspects.

127 | P a g e

JAVA PROXY SERVER

Furthermore if this project will be uploaded, it can be used as recruitment site and any organization can register their self on the site to carry out their server process making this server as Online Proxy Server.

Bibliography
JAVA- Black Book Wrox-Professional My SQL HTML 4.0-E.Stephen Mack and Janan Platt By Kevin Loney and George Koch System analysis and Design-Elias M. Awad Roger S. Pressman, Software Engineering (A Practitioners

Approach), McGraw-Hill 2000 Website : www.google.com www.egyankosh.ac.in

128 | P a g e

Você também pode gostar