You are on page 1of 86

1.

1 INTRODUCTION
The two main issues that we address in context of such response policies are that of policy matching, and policy administration. For the policy matching problem, we propose two algorithms that efficiently search the policy database for policies that match an anomalous request. We also extend the Postgre SQL DBMS with our policy matching mechanism, and report experimental results. The experimental evaluation shows that our techniques are very efficient. The other issue that we address is that of administration of response policies to prevent malicious modifications to policy objects from legitimate users. We propose a novel Joint Threshold Administration Model (JTAM) that is based on the principle of separation of duty. The key idea in JTAM is that a policy object is jointly administered by at least k database administrator (DBAs), that is, any modification made to a policy object will be invalid unless it has been authorized by at least k DBAs. We present design details of JTAM which is based on a cryptographic threshold signature scheme, and show how JTAM prevents malicious modifications to policy objects from authorized users.

1.2 ABOUT THE PROJECT PROJECT PURPOSE


With greater data integration, aggregation and disclosure, preventing data theft, from both inside and outside organizations, has become a major challenge.StandardDatabase security mechanisms, such as access control, authentication, and encryption, are not of much help when it comes to preventing data theft from insiders [5]. Such threats have thus forced organizations to reevaluate securitystrategies for their internal databases [4]. Database to detect potential intrusions, intrusion detection (ID), is a crucial technique that has to be part of any comprehensive security solution for high-assurance database security.

PROJECT SCOPE
A response policy is required by the database security administrator to specify

appropriate response actions for different circumstances. In this paper, we proposea high-level language for the specification of such policies which makes it very easy to specify and modify them. The two main issues that we address in the context of such response policies are that of policy matching and policy administration. Policy matching is the problem of searching for policies applicable to an anomalous request.

PRODUCT FEATURE
We present a framework for specifying intrusion response policies in the context of a DBMS. We present a novel administration model called JTAM for administration of response policies. implement JTAM in the PostgreSQL DBMS, and report experimental results on the efficiency of our techniques. When an anomaly is detected, the response system must search through the policy database and find policies that match theanomaly.

1.3 EXISTING SYSTEM


Standard database security mechanisms, such as access control, authentication, and encryption, are not of much help when it comes to preventing data theft from insiders. The Intrusion Detection systems that are developed are not customized for a Database Management System (DBMS).

1.4 DRAWBACKS OF THE EXISTING SYSTEM


There are three main types of response actions that we refer to, respectively, as conservative actions, fine-grained actions, and aggressive actions, the key issue to address is which response measure to take under a given situation.

2.1 PROBLEM DEFINITION


The fundamental problem in such administration model is that of conflict-of-interest. The main issue is essentially that of insider threats, that is, how to protect a response policy object from malicious modifications made by a database user that has legitimate access rights to the policy object.

2.2 PROPOSED SYSTEM


Two main elements which is specifically customized to a DBMS is used: an anomaly detection (AD) system and an anomaly response system. The first element is based on the construction of database access profiles of roles and users, and on the use of such profiles for the AD task. The second element takes some actions once an anomaly is detected.

Advantages:
Interactive response policy language is used which makes it very easy for the database administrators to specify appropriate response actions for different circumstances depending upon the nature of the anomalous request. Two main issues are addressed: policy matching, and policy administration

2.3 SOFTWARE REQUIREMENTS


Front End Operating System : Java : Windows

2.4 HARDWARE REQUIREMENTS Process RAM Hard Disk Monitor :PENTIUM 2.6 GHz :256Mb and above :10GB :VGA and High Resolution Monitor

2.5 FUNCTIONAL REQUIREMENTS


INTRODUCTION Provide an overview of the system and some additional information to place the system in context. A software requirements specification (SRS) is a comprehensive description of the intended purpose and environment for software under development. The SRS fully describes what the software will do and how it will be expected to perform. An SRS minimizes the time and effort required by developers to achieve desired goals and also minimizes the development cost. A good SRS defines how an application will interact with system hardware, other programs and human users in a wide variety of real-world situations. Parameters such as operating speed, response time, availability, portability, maintainability, footprint, security and speed of recovery from adverse events are evaluated. PURPOSE Provide an overall description of the FRD, its purpose. Reference the system name and identifying information about the system to be implemented. SCOPE Discuss the scope of the document and how it accomplishes its purpose of the project. BACKGROUND Describe the organization and its overall responsibilities. Describe who is producing the document and why. REFERENCES List references and controlling documents, including: meeting summaries, white papers, other deliverables, etc.

ASSUMPTIONS AND CONSTRAINTS Provide a list of contractual or task level assumptions and/or constraints that are preconditions to preparation of the FRD. Assumptions are future situations beyond the control of the project, whose outcomes influence the success of a project. ASSUMPTIONS Examples of assumptions include: availability of a technical platform, legal changes and policy decisions. CONSTRAINTS Constraints are boundary conditions on how the system must be designed and constructed. Examples include: legal requirements, technical standards, strategic decisions. Constraints exist because of real business conditions. For example, a delivery date is a constraint only if there are real business consequences that will happen as a result of not meeting the date. If failing to have the subject application operational by the specified date places the organization in legal default, the date is a constraint. Preferences are arbitrary. For example, a date chosen arbitrarily is a preference. Preferences, if included in the FRD, should be noted as such. DOCUMENT OVERVIEW Provide a description of the document organization. USER REQUIREMENTS Provide requirements of the system, user or business, taking into account all major classes/categories of users. Provide the type of security or other distinguishing characteristics of each set of users. List the functional requirements that compose each user requirement. As the functional requirements are decomposed, the highest level functional requirements are traced to the user requirements. Inclusion of lower level functional requirements is not mandatory in the traceability to user requirements if the parent requirements are already traced to them. User requirement information can be in text or process flow format for each major user class that shows what inputs will initiate the system functions, system interactions, and what

outputs are expected to be generated by the system. The scenarios should be comprehensive, to the extent that all user types and all major functions are covered. Give each user requirement a unique number. Typically, user requirements have a numbering system that is separate from the functional requirements. Requirements may be labeled with a leading U or other label

indicating user requirements. DATA FLOW DIAGRAMS Decompose the context level diagrams to determine the functional requirements. Data flow diagrams should be decomposed down to the functional primitive level. These diagrams are further decomposed during design. LOGICAL DATA MODEL/DATA DICTIONARY Create the initial Logical Data Model. Describe data requirements by providing data entities, decomposition, and definitions in a data dictionary. The data requirements describe the business data needed by the application system. Data requirements do not describe the physical database and are not at the level of identifying field names.

NON FUNCTIONAL REQUIREMENTS


Non-Functional Requirements are not really requirements at all. Rather, they are constraints on implementing the functional requirements as defined in the use case documents and other documents or models. However, for the purposes of requirements management they are considered to be requirements and, as such, need to be tested. The first rule of defining nonfunctional requirements, therefore, is to ensure that they are testable. A requirement that cannot be tested may as well not be included as a requirement. The best way to ensure that nonfunctional requirements can be tested is to think about how they might be tested when they are written. If it is not obvious then ask a test developer how they would test it.Other guidelines should include whether they are written in a way that is unambiguous and easy to understand. Some of the requirements may be very technical in nature so not all can be expected to be understood by non-technical people. However, those who will have to implement them and those who will have to test them should be able to understand them easily and completely.Nonfunctional requirements may be present in other documents and models where they have been

added as notes or as high-level requirements. These include the stakeholder needs list, the project overview, the business process model, and the use case documents PROJECT OVERVIEW The chapter 1 one contain the Project Overview summary of known major technical constraints. Add these to the non-functional requirements document and update the project overview with references to them. STAKEHOLDER NEEDS LIST These are single line statements of needs gather early in the project from all stakeholders. Scan through the list and look for those needs that would not have been included in the use case documents. Add them to the appropriate section of the non-functional requirements documents as single sentence statements. Update the stakeholder needs list with the reference to the requirement in the non-functional requirements document. BUSINESS PROCESS MODEL When the business process model is created notes may have been added to the processes as attachment to activities on activity diagrams regarding stakeholder requirements as they have been mentioned by the stakeholder representative or process owner. Search all relevant activities for notes relating to non-functional requirements and add them to the non-functional requirements document. Update the activity notes with the reference to the requirement in the non-functional requirements document. USE CASE DOCUMENTS Use Case Documents have a specific section for non-functional requirements. These should normally apply specifically to the use case in question. It may be, however, that requirements that apply across more than one use case have been included. If so, add the requirements to the non-functional requirements document and reference them in the use case document.

USABILITY Resist making statements such as The system shall be user friendly. It is entirely insufficient. The non-functional requirements document template breaks the section down into seven subsections and prompts for completion of each section. Be specific about the mechanism by which each aspect will be met. For example, in the section Learnability say whether the user is expected to learn how to use the system by looking up the help or using a tutorial or whether the system can be put into a learner mode whereby it guid es a learner user through a use case by offering detailed prompts at every step. If there is to be no documentation at all and the system is to be learnt from the developers demonstrating it to the users, then say so. RELIABILITY Reliability is notoriously difficult to test before the system goes live as it relies on continuous use and metrics. Some guidance here on what is realistic to expect should be sought in consultation with stakeholders. Figures should be defined on the basis of the metrics available for existing systems and the expectations for improvement or relaxation of these values. It will only be known if the system meets these requirements if proper metrics and requirements gathering are put in place. Notes to this effect should be included. If no serious attempt is to be made to do this, then write None in each section. PERFORMANCE Performance can and should be tested early on the development as part of the architectural development phase. Care needs to be taken to specify throughput and response times in terms of the creation and processing of major data entities with reference to specific use cases in the use case model. Ensure that the requirements are written in such a way that the testing of them will be straightforward. If the system is to share infrastructure resources with other systems specify what proportion of those resources must be available if the response times are to be met. Also include any dependencies on outside systems and specify how these are expected to respond if resource and throughput targets are to be met.

SECURITY Security includes all steps that are to be taken to secure the system against both voluntary and involuntary corruption. This includes management of usernames and passwords; encryption of data transfers both internally and across external systems such as the internet; firewalls and protection against viruses, Trojans, worms and all kinds of malicious code attacks including denial of service. It may be useful to refer to the standards specified in section 8.3 under implementation constraints. SUPPORTABILITY Specify ease of installation, configuration and testing in terms both of the time to achieve the goal and specific means for achieving it. Consider, for example, installation software and scripts, use cases for configuration and automatic self-testing. Think carefully about how each of these requirements will actually be tested. INFRASTRUCTURE REQUIREMENTS These should include description of existing or new hardware, software and networks on which the system is expected to run. Create a deployment diagram, or equivalent which shows all processing nodes, peripherals and communication links. Specify the required capacity for each of these, or, where the system runs on existing infrastructure, the amount of capacity that needs to be available for the system to meet its performance requirements. Also specify any external systems of services upon which this system will depend in terms of the performance that is required of these systems if this system is to meet its performance targets. IMPLEMENTATION CONSTRAINTS A constraint is a requirement which leaves no design option. Implementation constraints, rather than describing what the system will do, describe constraints on the design by which what it is to do will be achieved. If there is no constraint in a section, e.g. the developers could use any language they like then say so. Otherwise describe just the constraint. When referring to system interfaces, legacy systems and databases refer to the design documentation for these. Add important diagrams to Appendix A and refer to them in the text. If

there is insufficient information about these external systems then mention that this information will need to be completed for the purposes of the development of this system.

2.6 ANALYSIS MODULE SPECIFICATION


Anomalous Request Intrusion Detection. Policy Matching. Policy Administration. Protection Data Transmission. Intrusion Response.

MODULE DESCRIPTIONS: Anomalous Request :


Interactive response policy language makes it very easy for the database administrators to specify appropriate response actions for different circumstances depending upon the nature of the anomalous request. The conservative actions, such as sending an alert, allow the anomalous request to go through, whereas the aggressive actions can effectively block the anomalous request. Recall that a response policy is created to select a response action to be executed in the event of an anomalous request. Intrusion Detection : Monitoring a database to detect potential intrusions, intrusion detection (ID), is a crucial technique that has to be part of any comprehensive security solution for high-assurance database security. We present a framework for specifying intrusion response policies in the context of a DBMS. The two main issues that we address in context of such response policies are that of policy matching, and policy administration.

Policy Matching: Policy matching is the problem of searching for policies applicable to an anomalous request. When an anomaly is detected, the response system must search through the policy database and find policies that match the anomaly. Our ID mechanism is a real-time intrusion detection and response system; thus efficiency of the policy search procedure is crucial. Policy Administration : The main issue in the administration of response policies is how to protect a policy from malicious modifications made by a DBA that has legitimate access rights to the policy object. .Propose an administration model referred to as the JTAM. The threat scenario that we assume is that a DBA has all the privileges in the DBMS, and thus it is able to execute arbitrary SQL insert, update, and delete commands tomake malicious modifications to the policies.

Protection Data Transmission : Data protection must deal with two general problems. First, data must be protected from unauthorized access and tampering. This is the problem of data security. Second, data must be protected from errors by authorized system users. Concern for data security will take different forms in different system applications. Individual users may be concerned with personal privacy, and wish to limit access to private data files. Corporate organizations may seek to protect data related to proprietary interests.

Intrusion Response: A condition is specified on the attributes of the detected anomaly. An action is the response action executed by the engine Our implementation of the response system can be configured to include/exclude other user-defined anomaly attributes. we address is that of administration of response policies to prevent malicious modifications to policy objects from legitimate users.

FEASIBILITY STUDY
Objectives: In project development and feasibility studies stage of the SDLC, software engineers and developers should be able to:

Identify the Business Value Developing a software is not just creating a good software and presenting them to the market with hopes that someone will actually use or buy it. Before the software is even created, the idea will be evaluated again and again. This objective has to be fulfilled by the companys researchers. They will be presenting the current market situation, current users need or World Wide Web that software engineers can fill. Estimate Investment and Reward on the Project In project planning, the investment on a certain project has to be revealed. This will be the backbone of every project. For one, investment will dictate how much the company will spend to create certain software. This is even truer for companies that usually hire project based developers. Investment will dictate how many people will be working for the project. Aside from investment, project planning and feasibility studies should show how much the company will earn once the project is created. If its just a tool for businesses, it should show how it can increase the productivity of the employees and its actual impact in financial sense. Analyze Feasibility Researchers or proponents of the software will actually show why the software is needed in the actual business sense. Statistical data will always play a crucial role in proving why the particular software is good for public use. Most of the time, researchers will be interviewing individuals in order to get their opinion if they will use if that software is available in the market. It will also take a look at the possible competition and how will the software be different compared to other companies.

3.1DESIGN METHDOLOGIES
This document play a vital role in the development of life cycle (SDLC) as it describes the complete requirement of the system. It means for use by developers and will be the basic during testing phase. Any changes made to the requirements in the future will have to go through formal change approval process. SPIRAL MODEL was defined by Barry Boehm in his 1988 article, A spiral Model of Software Development and Enhancement. This model was not the first model to discuss iterative development, but it was the first model to explain why the iteration models. As originally envisioned, the iterations were typically 6 months to 2 years long. Each phase starts with a design goal and ends with a client reviewing the progress thus far. Analysis and engineering efforts are applied at each phase of the project, with an eye toward the end goal of the project. The steps for Spiral Model can be generalized as follows: The new system requirements are defined in as much details as possible. This usually involves interviewing a number of users representing all the external or internal users and other aspects of the existing system. A preliminary design is created for the new system. A first prototype of the new system is constructed from the preliminary design. This is usually a scaled-down system, and represents an approximation of the characteristics of the final product. A second prototype is evolved by a fourfold procedure: 1. Evaluating the first prototype in terms of its strengths, weakness, and risks. 2. Defining the requirements of the second prototype. 3. Planning an designing the second prototype. 4. Constructing and testing the second prototype.

At the customer option, the entire project can be aborted if the risk is deemed too great. Risk factors might involved development cost overruns, operating-cost miscalculation, or any other factor that could, in the customers judgment, result in a less-than-satisfactory final product. The existing prototype is evaluated in the same manner as was the previous prototype, and if necessary, another prototype is developed from it according to the fourfold procedure outlined above. The preceding steps are iterated until the customer is satisfied that the refined prototype represents the final product desired. The final system is constructed, based on the refined prototype. The final system is thoroughly evaluated and tested. Routine maintenance is carried on a continuing basis to prevent large scale failures and to minimize down time. The following diagram shows how a spiral model acts like:

Fig -Spiral Model

ADVANTAGES Estimates(i.e. budget, schedule etc .) become more relistic as work progresses, because important issues discoved earlier. It is more able to cope with the changes that are software development generally entails. Software engineers can get their hands in and start woring on the core of a project earlier. APPLICATION DEVELOPMENT N-TIER APPLICATIONS N-Tier Applications can easily implement the concepts of Distributed Application Design and Architecture. The N-Tier Applications provide strategic benefits to Enterprise Solutions. While 2-tier, client-server can help us create quick and easy solutions and may be used for Rapid Prototyping, they can easily become a maintenance and security night mare The N-tier Applications provide specific advantages that are vital to the business continuity of the enterprise. Typical features of a real life n-tier may include the following: Security Availability and Scalability Manageability Easy Maintenance Data Abstraction The above mentioned points are some of the key design goals of a successful n-tier application that intends to provide a good Business Solution.

DEFINITION Simply stated, an n-tier application helps us distribute the overall functionality into various tiers or layers: Presentation Layer Business Rules Layer Data Access Layer Database/Data Store Each layer can be developed independently of the other provided that it adheres to the standards and communicates with the other layers as per the specifications. This is the one of the biggest advantages of the n-tier application. Each layer can potentially treat the other layer as a Block-Box. In other words, each layer does not care how other layer processes the data as long as it sends the right data in a correct format.

Fig -N-Tier Architecture

THE PRESENTATION LAYER Also called as the client layer comprises of components that are dedicated to presenting the data to the user. For example: Windows/Web Forms and buttons, edit boxes, Text boxes, labels, grids, etc. 1. THE BUSINESS RULES LAYER This layer encapsulates the Business rules or the business logic of the encapsulations. To have a separate layer for business logic is of a great advantage. This is because any changes in Business Rules can be easily handled in this layer. As long as the interface between the layers remains the same, any changes to the processing logic in this layer can be made without impacting the others. A lot of client-server apps failed to implement successfully as changing the business logic was a painful process. 2. THE DATA ACCESS LAYER This layer comprises of components that help in accessing the Database. If used in the right way, this layer provides a level of abstraction for the database structures. Simply put changes made to the database, tables, etc do not affect the rest of the application because of the Data Access layer. The different application layers send the data requests to this layer and receive the response from this layer. 3. THE DATABASE LAYER This layer comprises of the Database Components such as DB Files, Tables, Views, etc. The Actual database could be created using SQL Server, Oracle, Flat files, etc. In an n-tier application, the entire application can be implemented in such a way that it is independent of the actual Database. For instance, you could change the Database Location with minimal changes to Data Access Layer. The rest of the Application should remain unaffected.

3.2 UML DIAGRAMS

BROWSE FILE

SEND FILE

INTRUDER DETECTED SENDER

SYSTEM

INSERT RECORD

VIEW

DETECTION DETAILS

UsecaseDiagram

: SENDER

: SYSTEM

BROWSE
BROWSING

FILE DISPLAYED

SEND FILE
SENDING

INTRUDER DETECTED

INSERT FILE
INSERTING

VIEW
PROCESSING

DISPLAYS CONTENT OF THE FILE

DETECTION DETAILS
ANALYZING

DISPLAYS ATTACKS AT EACH LAYER

Sequence Diagram

Start

BROWSE A FILE

SEND A FILE

NO INTRUSION RESPONSE SYSTEM

YES

SINK

End

Activity Diagram

class Class M odel JFram e Detector1 ~ ~ ~ + + + + + cl i ent_1: Socket cl i ent_2: Socket tem p: l ong Detector1() Detector2() Detector3() i ni ti al i zeCom ponent() : voi d m ai n(Stri ng[]) : voi d server() : voi d ~ ~ ~ ~ ~ ~ ~ ~ + + + Detector3 cl i ent_1: Socket cl i ent_2: Socket j T extArea1: JT extArea l ength: i nt l ength1: i nt sen: Stri ng = "" server_1: ServerSocket socket_1: Socket tem p: l ong addCom ponent(Contai ner, Com ponent, i nt, i nt, i nt, i nt) : void Detector3() i ni ti al i zeCom ponent() : voi d j Button1_acti onPerform ed(Acti onEvent) : voi d j T abbedPane1_stateChanged(ChangeEvent) : voi d m ai n(Stri ng[]) : voi d server() : voi d JFram e

JFram e Detector2 ~ ~ ~ ~ + + + + cl i ent_1: Socket cl i ent_2: Socket contentPane: JPanel di s: DataInputStream tem p: l ong addCom ponent(Contai ner, Com ponent, i nt, i nt, i nt, i nt) : void Detector2() i ni ti al i zeCom ponent() : voi d j Button1_acti onPerform ed(Acti onEvent) : voi d j T abbedPane1_stateChanged(ChangeEvent) : voi d m ai n(Stri ng[]) : voi d server() : voi d Si nk2() ~ ~ ~ ~ ~ ~ + + + contentPane: JPanel desti nati on: Stri ng i : i nt = 1 Reci eved1: Stri ng rr: Stri ng = "" server_1: ServerSocket socket_1: Socket transferT i m e: JLabel Sink1

JFram e

addCom ponent(Contai ner, Com ponent, i nt, i nt, i nt, i nt) : void i ni ti al i zeCom ponent() : voi d j Button1_acti onPerform ed(Acti onEvent) : voi d j T abbedPane1_stateChanged(ChangeEvent) : voi d m ai n(Stri ng[]) : voi d server() : voi d Si nk1()

JFram e JFram e Source1 ~ ~ ~ ~ ~ + + + + + + a: Stri ng ([]) = {"Sel ect","Prob... b: Stri ng ([]) = {"Graph","probe... contentPane: JPanel d: doubl e dest1: Stri ng desti nati on: Stri ng Detect: JButton fi l epath: JLabel j Button2_acti onPerform ed(Acti onEvent) : voi d j Button3_acti onPerform ed(Acti onEvent) : voi d j Com boBox1_acti onPerform ed(Acti onEvent) : voi d j T extFi el d1_acti onPerform ed(Acti onEvent) : voi d m ai n(Stri ng[]) : voi d pai nt(Graphi cs) : voi d sendData(Stri ng, i nt, Stri ng) : voi d setDest(Stri ng) : Stri ng Source1() vi ew_acti onperform ed(Acti onEvent) : voi d ~ ~ ~ ~ ~ ~ + + + + contentPane: JPanel desti nati on: Stri ng i : i nt = 1 j Button1: JButton j Label 1: JLabel j Panel 1: JPanel j Panel 2: JPanel j Scrol l Pane1: JScrol l Pane j Scrol l Pane2: JScrol l Pane j T abbedPane1: JT abbedPane j T extArea1: JT extArea j T extArea2: JT extArea Reci eved1: Stri ng rr: Stri ng = "" server_1: ServerSocket socket_1: Socket addCom ponent(Contai ner, Com ponent, i nt, i nt, i nt, i nt) : void i ni ti al i zeCom ponent() : voi d j Button1_acti onPerform ed(Acti onEvent) : voi d j T abbedPane1_stateChanged(ChangeEvent) : voi d m ai n(Stri ng[]) : voi d server() : voi d Si nk2() Si nk3() Sink2

JFram e Sink3 ~ ~ ~ + + + contentPane: JPanel desti nati on: Stri ng i : i nt = 1 j Button1: JButton j Label 1: JLabel j Panel 1: JPanel socket_1: Socket addCom ponent(Contai ner, Com ponent, i nt, i nt, i nt, i nt) : void i ni ti al i zeCom ponent() : voi d j Button1_acti onPerform ed(Acti onEvent) : voi d j T abbedPane1_stateChanged(ChangeEvent) : voi d m ai n(Stri ng[]) : voi d server() : voi d Si nk3()

Class diagram Technology Description

JAVA Java was designed to meet all the real world requirements with its key features, which are explained in the following paragraph. SIMPLE AND POWERFUL Java was designed to be easy for the professional programmer to learn and use efficiently. Java makes itself simple by not having surprising features. Since it exposes the inner working of a machine, the programmer can perform his desired actions without fear. Unlike other programming systems that provide dozens of complicated ways to perform a simple task, Java provides a small number of clear ways to achieve a given task. SECURE Today everyone is worried about safety and security. People feel that conducting commerce over the Internet is a safe as printing the credit card number on the first page of a Newspaper. Threatening of viruses and system hackers also exists. To overcome all these fears java has safety and security as its key design principle. Using Java Compatible Browser, anyone can safely download java applets without the fear of viral infection or malicious intent. Java achieves this protection by confining a java program to the java execution environment and by making it inaccessible to other parts of the computer. We can download applets with confidence that no harm will be done and no security will be breached. PORTABLE In java, the same mechanism that gives security also helps in portability. Many types of computers and operating systems are in use throughout the world and are connected to the internet. For downloading programs through different platforms connected to the internet, some portable, executable code is needed. Javas answer to these problems is its well designed architecture.

OBJECT-ORIENTED Java was designed to be source-code compatible with any other language. Java team gave a clean, usable, realistic approach to objects. The object model in java is simple and easy to extend, while simple types, such as integers, are kept as high-performance non -objects. DYNAMIC Java programs carry with them extensive amounts of run-time information that is used to verify and resolve accesses to objects at run-time. Using this concept it is possible to dynamically link code. Dynamic property of java adds strength to the applet environment, in which small fragments of byte code may be dynamically updated on a running system. NEWLY ADDDED FEATURES IN JAVA 2 SWING is a set of user interface components that is entirely implemented in java the user can use a look and feel that is either specific to a particular operating system or uniform across operating systems. Collections are a group of objects. Java provides several types of collection, such as linked lists, dynamic arrays, and hash tables, for our use. Collections offer a new way to solve several common programming problems. Various tools such as javac, java and javadoc have been enhanced. Debugger and profiler interfaces for the JVM are available. Performance improvements have been made in several areas. A JUST-IN-TIME (JIT) compiler is included in the JDK. Digital certificates provide a mechanism to establish the identity of a user, which can be referred as electronic passports. Various security tools are available that enable the user to create the user to create and store cryptographic keys ad digital certificates, sign Java Archive(JAR) files, and check the signature of a JAR file.

SWINGS Swing components facilitate efficient graphical user interface (GUI) development. These components are a collection of lightweight visual components. Swing components contain a replacement for the heavyweight AWT components as well as complex user interface components such as Trees and Tables. Swing components contain a pluggable look and feel (PL & F). This allows all applications to run with the native look and feel on different platforms. PL & F allows applications to have the same behaviour on various platforms. JFC contains operating system neutral look and feel. Swing components do not contain peers. Swing components allow mixing AWT heavyweight and Swing lightweight components in an application. The major difference between lightweight and heavyweight components is that lightweight components can have transparent pixels while heavyweight components are always opaque. Lightweight components can be non-rectangular while heavyweight components are always rectangular. Swing components are JavaBean compliant. This allows components to be used easily in a Bean aware application building program. The root of the majority of the Swing hierarchy is the JComponent class. This class is an extension of the AWT Container class. Swing offers a number of advantages, which include Wide variety of Components Pluggable Look and Feel MVC Architecture Keystroke Handling Action Objects Nested Containers Virtual Desktops Compound Borders Customized Dialogues Standard Dialog Classes

Structured Table and Tree Components Powerful Text Manipulation Generic Undo Capabilities Accessibility Support JAVA DATABASE CONNECTIVITY (JDBC) JDBC AND ODBC IN JAVA: Most popular and widely accepted database connectivity called Open Database Connectivity (ODBC) is used to access the relational databases. It offers the ability to connect to almost all the databases on almost all platforms. Java applications can also use this ODBC to communicate with a database. Then we need JDBC why? There are several reasons: 1. ODBC API was completely written in C language and it makes an extensive use of pointers. Calls from Java to native C code have a number of drawbacks in the security, implementation, robustness and automatic portability of applications. 2. ODBC is hard to learn. It mixes simple and advanced features together, and it has complex options even for simple queries. Structured Query Language (SQL): SQL (Pronounced Sequel) is the programming language that defines and manipulates the database. SQL databases are relational databases; this means simply the data is store in a set of simple relations. A database can have one or more table. You can define and manipulate data in a table with SQL commands. You use the data definition language (DDL) commands to creating and altering databases and tables. You can update, delete or retrieve data in a table with data manipulation commands (DML). DML commands include commands to alter and fetch data. The most common SQL commands include commands is the SELECT command, which allows you to retrieve data from the database. In addition to SQL commands, the oracle server has a procedural language called PL/SQL. PL/SQL enables the programmer to program SQL statement. It allows you to control the flow of a SQL program, to use variables, and to write error-handling procedures.

3.3 CODE DESIGN

Class1: /****************************************************************/ /* Source1 */ /* */ /****************************************************************/ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.net.*; import java.sql.*; /** * Summary description for Source1 * */ public class Source1 extends JFrame { // Variables declaration String fp; Double fs; Double tt; Double rt; Long ls; JTextArea jtr; private JLabel jLabel1; private JLabel jLabel2; private JLabel jLabel3; private JLabel filesize; private JLabel jfileSize; private JLabel transferTime; private JLabel jtransferTime; private JLabel filepath; private JLabel Jfilepath; private JLabel readTime; private JLabel JreadTime; private JTextArea show; private Long los; private JComboBox graph; //private JLabel private JButton view,insert; long loss;

String str; //private JTextField JfileSize; private JTextField jTextField1; private JComboBox jComboBox1; private JTextArea jTextArea1; private JScrollPane jScrollPane1,jsp,jsp1,jsp2,jsp3; private JButton jButton1; private JButton jButton2; private JButton jButton3; private JPanel contentPane; private JButton Detect; private int lossspace; JScrollPane js; Object o; //private JComboBox graph; //private JButton Detect; String dest1; int len; double d; double time; long read; double rd; private String r=""; String msg=""; int flag=1; int flag1=1; Socket n1_client; String destination; int limit; String a[]={"Select","Probe","Dos","R2L","U2R","Normal"}; //int len; int packets; int rem; String b[]={"Graph","probe","DOS","R2L","U2R"}; //int d; FileInputStream fis=null; Image im; // End of variables declaration

public Source1() { super();

initializeComponent(); // // TODO: Add any constructor code after initializeComponent call // this.setVisible(true); try{ FileInputStream f=new FileInputStream(".//Detector.txt"); while((d=f.read())!=-1) { r+=(char)d; } }catch(Exception ex){ex.printStackTrace();} } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always regenerated * by the Windows Form Designer. Otherwise, retrieving design might not work properly. * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder * to retrieve your design properly in future, before revising this method. */ private void initializeComponent() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); jTextField1 = new JTextField(); filesize=new JLabel(); jfileSize=new JLabel(); transferTime=new JLabel(); jtransferTime=new JLabel(); filepath=new JLabel(); Jfilepath=new JLabel(); readTime=new JLabel(); JreadTime=new JLabel(); jLabel1.setFont(new Font("Arial",Font.BOLD,15)); show=new JTextArea(70,80); jComboBox1 = new JComboBox(a); jTextArea1 = new JTextArea(); jScrollPane1 = new JScrollPane(); jButton1 = new JButton(); jButton2 = new JButton(); jButton3 = new JButton(); view=new JButton("View");

graph=new JComboBox(b); insert=new JButton("Insert"); Detect=new JButton("Detection"); jtr=new JTextArea(); js=new JScrollPane(); // im=Toolkit.getDefaultToolkit().createImage("d:/sin.png"); contentPane = (JPanel)this.getContentPane();

// // jLabel1 // jLabel1.setText("<html><h1><b><u><font color=\'white',size=\"6\">SOURCE1</font><u></i></h1></html>"); filepath.setText("<html><font color=\'white',size=\"4\">lossSpace:</font></h1></html>"); // jLabel1.setForeground(new Color(0, 0, 102)); // jLabel2 // jLabel2.setText("<html><b><font color=\'white'>Layers No</font></b></html>"); // readTime.setText("<html><font color=\'white',size=\"4\">ReadTime:</font></h1></html>"); // jLabel3 // jLabel3.setText("<html><b><font color=\'white' >Status Information</font></b></html>"); filesize.setBackground(new Color(255, 255, 255)); filesize.setText("<html><b><font color=\'white',size=\"4\">FileSize:</font></b></html>"); transferTime.setBackground(new Color(255,255,255)); transferTime.setText("<html><b><font color=\'white',size=\"4\">TransferTime:</font></b></html>");

// // jTextField1 // jTextField1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jTextField1_actionPerformed(e);

} }); // // jComboBox1 // jComboBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jComboBox1_actionPerformed(e); } });

Detect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Detect_actionperformed(e); } }); // // jTextArea1 // // // jScrollPane1 // jScrollPane1.setViewportView(jTextArea1); js.setViewportView(jtr); // // jButton1 // jButton1.setBackground(new Color(255, 255, 255)); jButton1.setText("<html><b><font color=\'black' >Browse</font></b></html>"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); // // jButton2 // jButton2.setBackground(new Color(255, 255, 255)); jButton2.setText("<html><b><font color=\'black' >Send</font></b></html>");

jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); insert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { insert_actionperformed(e); }

}); view.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { view_actionperformed(e); } }); // // jButton3 // // Color colr = new Color(0, 0, 255); //jButton3.setBackground(new Color(92,172,238)); jButton3.setText("Exit"); jButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton3_actionPerformed(e); } }); graph.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { graph_actionPerformed(ae); } }); // // contentPane // contentPane.setLayout(null); Color colr = new Color(210,105,30);

//contentPane.setBackground(new Color(0, 0, 255)); contentPane.setBackground(colr); // jLabel1.setBackground(Color.red); jLabel1.setForeground(colr); addComponent(contentPane, jLabel1, 158,14,136,28); addComponent(contentPane, jLabel2, 100,149,60,18); addComponent(contentPane, jLabel3, 165,180,118,23); addComponent(contentPane, jTextField1, 41,80,252,20); addComponent(contentPane, jComboBox1, 180,147,100,22); addComponent(contentPane, jScrollPane1, 60,200,295,246); addComponent(contentPane, jButton1, 317,78,83,28); addComponent(contentPane, jButton2, 317,147,83,28); addComponent(contentPane, jButton3, 317,450,83,28); addComponent(contentPane,filepath,60,500,136,28); addComponent(contentPane,Jfilepath,150,500,280,28); addComponent(contentPane,filesize,310,500,140,28); addComponent(contentPane,jfileSize,390,500,136,28); addComponent(contentPane,transferTime,60,550,136,28); addComponent(contentPane,jtransferTime,180,550,136,28); addComponent(contentPane,readTime,310,550,136,28); addComponent(contentPane,JreadTime,390,550,136,28); addComponent(contentPane,insert,30,600,136,28); addComponent(contentPane,view,80,600,136,28); addComponent(contentPane,graph,250,600,100,28); addComponent(contentPane,Detect,350,600,103,28); addComponent(contentPane,jtr,350,300,400,200); jtr.setVisible(false); // // Source1 // this.setTitle("Source1 - extends JFrame"); this.setLocation(new Point(66, 48)); this.setSize(new Dimension(783, 635)); } /** Add Component Without a Layout Manager (Absolute Positioning) */ private void addComponent(Container container,Component c,int x,int y,int width,int height) { c.setBounds(x,y,width,height); container.add(c); } // // TODO: Add any appropriate code in the following Event Handling Methods

// private void jTextField1_actionPerformed(ActionEvent e) { System.out.println("\njTextField1_actionPerformed(ActionEvent e) called."); // TODO: Add any handling code here } private void jComboBox1_actionPerformed(ActionEvent e) { System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called."); o = jComboBox1.getSelectedItem(); destination=""+o; flag=0; } private void jButton1_actionPerformed(ActionEvent e) { System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); // TODO: Add any handling code here try { int b; Long l=0L; msg=""; FileDialog fd=new FileDialog(this,"Open",FileDialog.LOAD); JFileChooser jf=new JFileChooser(); int s=jf.showOpenDialog(null); File f1=jf.getSelectedFile(); str=f1.getPath(); File f=new File(str); long size1=f1.getTotalSpace(); long freespace=f1.getFreeSpace(); loss=size1-freespace; FileInputStream fos=new FileInputStream(str); // File le=new File(fos); long length=f.length(); // lossspace=(int)freespace; int sizedata=fos.available(); int n=sizedata/4; // jTextArea1.append("Reading First::"+n+"\n\n"); //fd.show(); // File f=new File(fd); //FileInputStream fos=new FileInputStream(fd.getDirectory()+fd.getFile());

//String str=fd.getDirectory(); //FileInputStream fos=new FileInputStream(str); //jTextField1.setText(fd.getDirectory()+fd.getFile()); // jTextField1.setText(""+fd.getSize()); jTextField1.setText(str); while((b=fos.read())!=-1) { msg+=(char)b; l+=b; } byte by[]=new byte[fos.available()]; String sbyte=new String(by); jTextArea1.setText("Size"); fos.read(by); fos.close(); flag1=0; len=msg.length(); d=len/1024; time=d/60; read=l/1024; rd=read/60; // los=Long.toString(loss); // n=fos.available()/2; String source=jTextField1.getText(); System.out.println(""+System.currentTimeMillis()); // jTextArea1.append(); // jTextArea1.setText("<html><img src='str' width='100' height='100'></img></html>"); jTextArea1.append("\n\nSource1 Address::"+source+"\n\n"); jTextArea1.append("Selected File Path "+"<b>"+fd.getDirectory()+fd.getFile()+"</b>"+"\n\n"); jTextArea1.append("Total Size::"+len+"bytes"+"\n\n"); jTextArea1.append("Total space::"+size1+"bytes"+"\n\n"); jTextArea1.append("Total Freespace::"+freespace+"bytes"+"\n\n"); jTextArea1.append("Reading Files:"+l+"bytes"+"\n\n"); //jTextArea1.append("Currnt Time"+time); //jTextArea1.append("Byte to kb"+d+"Kbytes"); // jtransferTime.setText(""+time+"sec"); jfileSize.setText(""+d+"Kb"); Jfilepath.setText(""+loss); JreadTime.setText(""+rd+"Sec");

} //jTextArea1.append("Size"; catch (Exception ex) { ex.printStackTrace(); }} public void insert_actionperformed(ActionEvent e) { // if(e.getSource()=="view") // { // chart c=new chart(rd,time); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String ss="insert into sour1(layerports,filePath,fileSize,transferTime,readTime,lossSpace)values('"+jComboBox1.getS electedItem()+"','"+str+"',"+d+","+time+","+rd+","+loss+")"; // String ss="insert into sour2(filePath,fileSize,transferTime,readTime)values('"+str+"',"+d+","+time+","+rd+")"; stm.executeUpdate(ss); JOptionPane.showMessageDialog(null,"Record Inserted"); //System.out.println(str+d+time+rd+loss); System.out.println("record inserted"); } catch(Exception ex) { ex.printStackTrace(); }} public void view_actionperformed(ActionEvent e) { addComponent(contentPane,show,280,600,236,58); // if(e.getSource()=="view") // { // chart c=new chart(rd,time); try { System.out.println("retrieved************"); Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); ResultSet rs=stm.executeQuery("select * from sour1"); String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"}; String stab[][]=new String[50][50]; // int i=0; for(int i=0;rs.next();i++) { stab[i][0]=rs.getString(1); stab[i][1]=rs.getString(2); stab[i][2]=Double.toString(rs.getDouble(3)); stab[i][3]=Double.toString(rs.getDouble(4)); stab[i][4]=Double.toString(rs.getDouble(5)); stab[i][5]=Double.toString(rs.getDouble(6)); // stab[i][6]=rs.getString(6); //String ss=Double.toString(rs.getDouble(4)); //ps.executeUpdate(); // JOptionPane.showMessageDialog(null,"Record Inserted"); //System.out.println(str+d+time+rd+loss); System.out.println("record inserted"); } JTable jt=new JTable(stab,tb); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane jsp=new JScrollPane(jt,v,h); addComponent(contentPane,jsp,500,450,436,158); // show.append("FilePath"+"\t"+"FileSize"+"\t"+"TransferTime"+"\t"+"ReadTime"+"\t"+"LossSpa ce"+"\n"); // show.append("========================================================== ======================="+"\n"); // show.append(fp+"\t\t"+fs+"\t\t"+tt+"\t\t"+rt+"\t\t"+ls+"\t\t"); } catch(Exception ex) { } }

public void graph_actionPerformed(ActionEvent ae) { //if(a[1].) Object o1=graph.getSelectedItem(); dest1=""+o1; System.out.println("a[3]="+a[3]+"a[4]="+a[4]); if(dest1.equalsIgnoreCase(a[1])) { final probe1chart demo = new probe1chart("Probe1 Layer"); demo.pack(); demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String str="select* from sour1 where layerports='"+a[1]+"'"; ResultSet rs=stm.executeQuery(str); String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"}; String stab[][]=new String[50][50]; for(int i=0;rs.next();i++) { stab[i][0]=rs.getString(1); stab[i][1]=rs.getString(2); stab[i][2]=Double.toString(rs.getDouble(3)); stab[i][3]=Double.toString(rs.getDouble(4)); stab[i][4]=Double.toString(rs.getDouble(5)); stab[i][5]=Double.toString(rs.getDouble(6)); } JTable p=new JTable(stab,tb); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; jsp=new JScrollPane(p,v,h); addComponent(contentPane,jsp,500,250,436,158); jsp1.setVisible(false); jsp2.setVisible(false); jsp3.setVisible(false); // for(int i=0;rs.next();i++)

// {probe1","DOS","R2L","U2R" // final probechart demo = new probechart("probe1"); //demo.pack(); //demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); //demo.setVisible(true); // } } catch(Exception ex) { } else if(dest1.equalsIgnoreCase(a[2])) { final Doschart1 demo = new Doschart1("Dos1 Layer"); demo.pack(); demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String str="select* from sour1 where layerports='"+a[2]+"'"; ResultSet rs=stm.executeQuery(str); String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"}; String stab[][]=new String[50][50]; for(int i=0;rs.next();i++) { stab[i][0]=rs.getString(1); stab[i][1]=rs.getString(2); stab[i][2]=Double.toString(rs.getDouble(3)); stab[i][3]=Double.toString(rs.getDouble(4)); stab[i][4]=Double.toString(rs.getDouble(5)); stab[i][5]=Double.toString(rs.getDouble(6)); } JTable p=new JTable(stab,tb); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;

jsp1=new JScrollPane(p,v,h); addComponent(contentPane,jsp1,500,250,436,158); jsp.setVisible(false); jsp2.setVisible(false); jsp3.setVisible(false); // for(int i=0;rs.next();i++) // {probe1","DOS","R2L","U2R" // final probechart demo = new probechart("probe1"); //demo.pack(); //demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); //demo.setVisible(true); // }} catch(Exception ex) { }} else if(dest1.equalsIgnoreCase(a[3])) { final R2Lchart1 demo = new R2Lchart1("R2L Layer"); demo.pack(); demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String str="select* from sour1 where layerports='"+a[3]+"'"; ResultSet rs=stm.executeQuery(str); String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"}; String stab[][]=new String[50][50]; for(int i=0;rs.next();i++) { stab[i][0]=rs.getString(1); stab[i][1]=rs.getString(2); stab[i][2]=Double.toString(rs.getDouble(3));

stab[i][3]=Double.toString(rs.getDouble(4)); stab[i][4]=Double.toString(rs.getDouble(5)); stab[i][5]=Double.toString(rs.getDouble(6)); } JTable p=new JTable(stab,tb); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; jsp2=new JScrollPane(p,v,h); addComponent(contentPane,jsp2,500,250,436,158); jsp1.setVisible(false); jsp.setVisible(false); jsp3.setVisible(false); // for(int i=0;rs.next();i++) // {probe1","DOS","R2L","U2R" // final probechart demo = new probechart("probe1"); //demo.pack(); //demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); //demo.setVisible(true); // } } catch(Exception ex) { }} else if(dest1.equalsIgnoreCase(a[4])) { System.out.println("U2RChart**************"); final U2Rchart1 demo = new U2Rchart1("U2R Layer"); demo.pack(); demo.setLocation(200,200); // RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String str="select* from sour1 where layerports='"+a[4]+"'"; ResultSet rs=stm.executeQuery(str);

String tb[]={"Layers","FilePath","FileSize","TransferTime","ReadTime","LossSpace"}; String stab[][]=new String[50][50]; for(int i=0;rs.next();i++) { stab[i][0]=rs.getString(1); stab[i][1]=rs.getString(2); stab[i][2]=Double.toString(rs.getDouble(3)); stab[i][3]=Double.toString(rs.getDouble(4)); stab[i][4]=Double.toString(rs.getDouble(5)); stab[i][5]=Double.toString(rs.getDouble(6)); } JTable p=new JTable(stab,tb); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; jsp3=new JScrollPane(p,v,h); addComponent(contentPane,jsp3,500,250,436,158); jsp1.setVisible(false); jsp2.setVisible(false); jsp.setVisible(false); } catch(Exception ex) { } } } public void paint(Graphics g) { // Draw the previously loaded image to Component. g.drawImage(im, 0, 0, null); // Draw sprites, and other things. // .... } private void Detect_actionperformed(ActionEvent ae) { try { Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","intursion","intursion "); Statement stm=con.createStatement(); String sa1="select * from sour1 where layerports='"+a[1]+"'"; String sa2="select * from sour1 where layerports='"+a[2]+"'"; String sa3="select * from sour1 where layerports='"+a[3]+"'"; String sa4="select * from sour1 where layerports='"+a[4]+"'";

//Probe ResultSet rs=stm.executeQuery(sa1); double s6=0,s8=0,s9=0; int i=1; while(rs.next()) { String s1=rs.getString(1); String s2=rs.getString(2); double s3=rs.getDouble(3); s6=rs.getDouble(4)+s6; s8=rs.getDouble(5)+s8; double s4=rs.getDouble(6); i++; // double r=rs.getDouble(4); System.out.println("TransferTime"+r); } double s7=s6/i; s9=s8/i; System.out.println("pobe transferTime="+s7+"\t"+"ReadTime"+s9); //rs.close(); //Dos rs=stm.executeQuery(sa2); double st=0,sr=0,at,ar; int j=1; while(rs.next()) { String s1=rs.getString(1); String s2=rs.getString(2); double s3=rs.getDouble(3); st=rs.getDouble(4)+st; sr=rs.getDouble(5)+sr; double s4=rs.getDouble(6); j++; // double r=rs.getDouble(4);

// System.out.println("TransferTime"+r); } at=st/j; ar=sr/j; System.out.println("Dos transferTime="+at+"\t"+"ReadTime"+ar); rs.close(); //System.out.println("s6"+s6+"ddddd"+s7); //R2L rs=stm.executeQuery(sa3); double st1=0,sr1=0,at1,ar1; int k=1; while(rs.next()) { String s1=rs.getString(1); String s2=rs.getString(2); double s3=rs.getDouble(3); st1=rs.getDouble(4)+st1; sr1=rs.getDouble(5)+sr1; double s4=rs.getDouble(6); k++; // double r=rs.getDouble(4); // System.out.println("TransferTime"+r); } at1=st1/k; ar1=sr1/k; System.out.println("R2L transferTime="+at1+"\t"+"ReadTime"+ar1); //rs2.close();

//U2R rs=stm.executeQuery(sa4); double st2=0,sr2=0,at2,ar2; int l=1; while(rs.next()) { String s1=rs.getString(1); String s2=rs.getString(2); double s3=rs.getDouble(3); st2=rs.getDouble(4)+st2; sr2=rs.getDouble(5)+sr2; double s4=rs.getDouble(6); l++; // double r=rs.getDouble(4);

// System.out.println("TransferTime"+r); } at2=st2/l; ar2=sr2/l; System.out.println("U2R transferTime="+at2+"\t"+"ReadTime"+ar2); //rs3.close();

jtr.append("Name"+"\tAvgTransferTime"+"\t"+"AvgReadTime"+"\n"); jtr.append("============================================================ =======================\n"); jtr.append("Probe"+"\t"+(Math.abs(s7))+"\t"+""+Math.abs(s9)+"\n"); jtr.append("Dos"+"\t"+Math.abs(at)+"\t"+""+Math.abs(ar)+"\n"); jtr.append("R2L"+"\t"+Math.abs(at1)+"\t"+""+Math.abs(ar1)+"\n"); jtr.append("U2R"+"\t"+Math.abs(at2)+"\t"+""+Math.abs(ar2)+"\n"); jtr.setVisible(true); //int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; // int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; // JScrollPane jsp1=new JScrollPane(jtr,v,h); LineChartDemo6 ld=new LineChartDemo6("Detection",s7,s9,at,ar,at1,ar1,at2,ar2); ld.setSize(300,300); ld.setVisible(true); } catch(Exception ex) { ex.printStackTrace(); } } private void jButton2_actionPerformed(ActionEvent e) { System.out.println("\njButton2_actionPerformed(ActionEvent e) called."); jtransferTime.setText(""+time); // TODO: Add any handling code here String dest; if(flag==0) { if(destination.equalsIgnoreCase(a[0])) { JOptionPane.showMessageDialog(null,"Select the Destination!.."); } else if(destination.equalsIgnoreCase(a[1])) { //dba1 code

JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba1sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 1 "); System.out.println("dba1sign : "+dba1sign); if(dba1sign!=null&&!dba1sign.equals("")){ int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is it Conformed?"); System.out.println("dba1conform : "+dba1conform); if(dba1conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba2code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba2sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 2 "); System.out.println("dba2sign : "+dba2sign); if(dba2sign!=null&&!dba2sign.equals("")){ int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is it Conformed?"); System.out.println("dba2conform : "+dba2conform); if(dba2conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba2code //dba3code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba3sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 3 "); System.out.println("dba3sign : "+dba3sign); if(dba3sign!=null&&!dba3sign.equals("")){

int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is it Conformed?"); System.out.println("dba3conform : "+dba3conform); if(dba3conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba4code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba4sign=JOptionPane.showInputDialog("JTAM : Enter q Threshold Signature of DBA 4 "); System.out.println("dba4sign : "+dba4sign); if(dba4sign!=null&&!dba4sign.equals("")){ int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Is it Conformed?"); System.out.println("dba4conform : "+dba4conform); if(dba4conform JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not conformed signature this t ransaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } JOptionPane.showMessageDialog(null,"Now you can insert details of a file into Database "); dest=setDest(a[1]); sendData(r,111,dest); } else if(destination.equalsIgnoreCase(a[2])) { JOptionPane.showMessageDialog(null,"This Is From Dos Layer"); dest=setDest(a[2]); int a; sendData(r,111,dest);

} else if(destination.equalsIgnoreCase(a[3])) { JOptionPane.showMessageDialog(null,"This Is From R2L layer"); //dba1 code JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba1sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 1 "); System.out.println("dba1sign : "+dba1sign); if(dba1sign!=null&&!dba1sign.equals("")){ int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is it Conformed?"); System.out.println("dba1conform : "+dba1conform); if(dba1conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba2code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba2sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 2 "); System.out.println("dba2sign : "+dba2sign); if(dba2sign!=null&&!dba2sign.equals("")){ int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is it Conformed?"); System.out.println("dba2conform : "+dba2conform); if(dba2conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0);

} //dba2code //dba3code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba3sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 3 "); System.out.println("dba3sign : "+dba3sign); if(dba3sign!=null&&!dba3sign.equals("")){ int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is it Conformed?"); System.out.println("dba3conform : "+dba3conform); if(dba3conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba4code

// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba4sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 4 "); System.out.println("dba4sign : "+dba4sign); if(dba4sign!=null&&!dba4sign.equals("")){ int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Is it Conformed?"); System.out.println("dba4conform : "+dba4conform); if(dba4conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); }

JOptionPane.showMessageDialog(null,"Now you can insert details of a file into Database "); dest=setDest(a[3]); sendData(r,222,dest); } else if(destination.equalsIgnoreCase(a[4])) { JOptionPane.showMessageDialog(null,"This Is From U2R Layer");

//dba1 code JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba1sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 1 "); System.out.println("dba1sign : "+dba1sign); if(dba1sign!=null&&!dba1sign.equals("")){ int dba1conform= JOptionPane.showConfirmDialog(null,"DBA 1: Is it Conformed?"); System.out.println("dba1conform : "+dba1conform); if(dba1conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 1 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba2code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba2sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 2 "); System.out.println("dba2sign : "+dba2sign); if(dba2sign!=null&&!dba2sign.equals("")){ int dba2conform= JOptionPane.showConfirmDialog(null,"DBA 2: Is it Conformed?"); System.out.println("dba2conform : "+dba2conform); if(dba2conform!=0){

JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 2 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba2code //dba3code // JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba3sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 3 "); System.out.println("dba3sign : "+dba3sign); if(dba3sign!=null&&!dba3sign.equals("")){ int dba3conform= JOptionPane.showConfirmDialog(null,"DBA 3: Is it Conformed?"); System.out.println("dba3conform : "+dba3conform); if(dba3conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } }else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 3 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } //dba4code

// JOptionPane.showMessageDialog(null,"This Is From PROBE Layer : This transaction need authentication from 4 DBAs"); String dba4sign=JOptionPane.showInputDialog("JTAM : Enter Threshold Signature of DBA 4 "); System.out.println("dba4sign : "+dba4sign); if(dba4sign!=null&&!dba4sign.equals("")){ int dba4conform= JOptionPane.showConfirmDialog(null,"DBA 4: Is it Conformed?"); System.out.println("dba4conform : "+dba4conform); if(dba4conform!=0){ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not conformed signature this transaction is failed. Response Action : ShutDown"); System.exit(0); }

}else{ JOptionPane.showMessageDialog(null,"JTAM : Since DBA 4 not accepted / not entered signature this transaction is failed. Response Action : ShutDown"); System.exit(0); } JOptionPane.showMessageDialog(null,"Now you can insert details of a file into Database "); dest=setDest(a[4]); sendData(r,222,dest); } else if(destination.equalsIgnoreCase(a[5])) { JOptionPane.showMessageDialog(null,"This Is From Normal"); dest=setDest(a[5]); sendData(r,222,dest); } } else JOptionPane.showMessageDialog(null,"Load the File OR Select the Destination!.."); } private void jButton3_actionPerformed(ActionEvent e) { System.out.println("\njButton3_actionPerformed(ActionEvent e) called."); // TODO: Add any handling code here } // // TODO: Add any method code to meet your needs in the following area // public void sendData(String name,int port,String dest) { try { n1_client=new Socket(name,port); DataOutputStream out=new DataOutputStream(n1_client.getOutputStream()); if(out!=null) { out.flush(); }

int outgoing=0; byte buffer[]=msg.getBytes(); int len=buffer.length; int tlength=buffer.length/48; int length11=buffer.length%48; int len1=len; if(length11!=0) { tlength++; } out.writeInt(tlength); out.writeUTF(destination); int st=0; int end=48; jTextArea1.append("Packet Length:"+len+"\n"); String prefinal=""; String finalst=""; if(len<=48) { System.out.println("smaller than 48"); finalst=prefinal+msg+"\n"+"null"; jTextArea1.append("packet\t"+(++outgoing)+"\t"+msg+"\n"); out.writeUTF(dest+msg);

} else { System.out.println("else than 48"); jTextArea1.append("Packet: "+"\t"+(++outgoing)+"\t"+msg.substring(st,end)+"\n"); out.writeUTF(dest+msg.substring(st,end));

while(len1>48) { len1-=48; if(len1<=48) { System.out.println("greateer than 48"); jTextArea1.append("Packet: "+"\t"+(++outgoing)+"\t"+msg.substring(end,len)+"\n"); out.writeUTF(dest+msg.substring(end,len));

} else { System.out.println("else than 48"); int sp=end+48; jTextArea1.append("Packet: "+"\t"+(++outgoing)+"\t"+msg.substring(end,sp)+"\n"); out.writeUTF(dest+msg.substring(end,sp)); end=sp; } } } } catch (Exception exp) { exp.printStackTrace(); } } public String setDest(String Destname) { String Destinationname=""; if(Destname.equalsIgnoreCase(a[1])) { Destinationname="Source1-->D1"; } else if(Destname.equalsIgnoreCase(a[2])) { Destinationname="Source1-->D2"; } else if(Destname.equalsIgnoreCase(a[3])) { Destinationname="Source1-->D3"; } else if (Destname.equalsIgnoreCase(a[4])) { Destinationname="Source1-->D4"; } else if (Destname.equalsIgnoreCase(a[5])) { Destinationname="Source1-->D5"; }

return Destinationname; } //============================= Testing ================================// //= =// //= The following main method is just for testing this class you built.=// //= After testing,you may simply delete it. =// //==================================================================== ==// public static void main(String[] args) { new Source1(); } //= End of Testing =

} Class2: /****************************************************************/ /* Sink1 */ /* */ /****************************************************************/ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.net.*; /** * Summary description for Sink1 * */ public class Sink1 extends JFrame { // Variables declaration private JLabel jLabel1; private JTabbedPane jTabbedPane1; private JButton jButton1; private JPanel contentPane; //----private JTextArea jTextArea1; private JScrollPane jScrollPane1;

private JPanel jPanel1; private JLabel transferTime; private JLabel JtransferTime; //----private JTextArea jTextArea2; private JScrollPane jScrollPane2; private JPanel jPanel2; //----String Recieved1; ServerSocket server_1; Socket socket_1; int i=1; String destination; String rr=""; //----// End of variables declaration

public Sink1() { super(); initializeComponent(); try { server_1=new ServerSocket(101); } catch (Exception exp) { exp.printStackTrace(); } // // TODO: Add any constructor code after initializeComponent call // this.setVisible(true);

} /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always regenerated * by the Windows Form Designer. Otherwise, retrieving design might not work properly.

* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder * to retrieve your design properly in future, before revising this method. */ private void initializeComponent() { jLabel1=new JLabel(); jLabel1.setFont(new Font("Serief",Font.BOLD,16)); jTabbedPane1 = new JTabbedPane(); jButton1 = new JButton(); contentPane = (JPanel)this.getContentPane(); //----jTextArea1 = new JTextArea(); jScrollPane1 = new JScrollPane(); jPanel1 = new JPanel(); jTabbedPane1.setForeground(Color.white); jTabbedPane1.setForeground(new Color(210,105,30)); transferTime=new JLabel(); JtransferTime=new JLabel(); transferTime.setText("TransferTime"); //----jTextArea2 = new JTextArea(); jScrollPane2 = new JScrollPane(); jPanel2 = new JPanel(); //----jLabel1.setForeground(Color.white); jTextArea1.setText("\t**********THIS IS FROM PORT PROBE*************\n\n"); //----// jTextArea2.setText("\t**********THIS IS FROM PORT DoS1**************\n\n"); // jTabbedPane1 // jTabbedPane1.addTab("Dest1", jPanel1); jTabbedPane1.addTab("Dest2", jPanel2); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { jTabbedPane1_stateChanged(e); } }); //

// // jLabel1 // jLabel1.setText("Sink1"); // // jButton1 // jButton1.setText("Exit"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); // // contentPane // contentPane.setLayout(null); contentPane.setBackground(new Color(210,105,30)); addComponent(contentPane, jLabel1, 232,9,193,38); addComponent(contentPane, jTabbedPane1, 21,44,473,374); addComponent(contentPane, jButton1, 228,425,88,32); addComponent(contentPane,transferTime,50,500,193,38); addComponent(contentPane,JtransferTime,100,500,193,38); // // jTextArea1 // // // jScrollPane1 // jScrollPane1.setViewportView(jTextArea1); // // jPanel1 // jPanel1.setLayout(null); addComponent(jPanel1, jScrollPane1, 23,19,418,301); // // jTextArea2 // // // jScrollPane2 // jScrollPane2.setViewportView(jTextArea2); //

// jPanel2 // jPanel2.setLayout(null); addComponent(jPanel2, jScrollPane2, 22,19,416,302); // // jTextArea3 // // // jScrollPane3 // //jScrollPane3.setViewportView(jTextArea3); // // jPanel3 // //jPanel3.setLayout(null); //addComponent(jPanel3, jScrollPane3, 30,18,414,305); // // Sink1 // this.setTitle("Sink1 - extends JFrame"); this.setLocation(new Point(0, 0)); this.setSize(new Dimension(544, 494)); } /** Add Component Without a Layout Manager (Absolute Positioning) */ private void addComponent(Container container,Component c,int x,int y,int width,int height) { c.setBounds(x,y,width,height); container.add(c); } // // TODO: Add any appropriate code in the following Event Handling Methods // private void jTabbedPane1_stateChanged(ChangeEvent e) { System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); // TODO: Add any handling code here } private void jButton1_actionPerformed(ActionEvent e) { System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); // TODO: Add any handling code here

} // // TODO: Add any method code to meet your needs in the following area // public void server() { try { String rr=""; socket_1=server_1.accept(); DataInputStream dis=new DataInputStream(socket_1.getInputStream()); int length=dis.readInt(); . String destination=dis.readUTF(); while(length>0) { rr=dis.readUTF();

if(destination.equalsIgnoreCase("probe")) { jTextArea1.append("Packet "+i+"\t"+rr+" Recieved...\n"); }

else if (destination.equalsIgnoreCase("Dos1")) { jTextArea2.append("Packet "+i+"\t"+rr+" Recieved...\n"); } else JOptionPane.showMessageDialog(null,"No Packets Received"); length--; i++; } i=1; } catch (Exception exp) {

exp.printStackTrace(); } }

//============================= Testing ================================// //= =// //= The following main method is just for testing this class you built.=// //= After testing,you may simply delete it. =// //==================================================================== ==// public static void main(String[] args) {

Sink1 s1=new Sink1(); while(true) { s1.server(); } } //= End of Testing =

} Class3: /****************************************************************/ /* Detector1 */ /* */ /****************************************************************/ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.net.*; import java.lang.*; /** * Summary description for Detector1 * */ public class Detector1 extends JFrame {

// Variables declaration private JLabel jLabel1; private JTextArea jTextArea1; private JScrollPane jScrollPane1; private JButton jButton1; private JPanel contentPane; ServerSocket server_1; DataOutputStream dis1; DataOutputStream dis2; DataInputStream dis; Socket socket_1; Socket client_1; Socket client_2; long temp; int i=1; int length; int length1; String sen=""; // End of variables declaration

public Detector1() { super(); initializeComponent(); this.setVisible(true); try { server_1=new ServerSocket(111); FileInputStream f=new FileInputStream(".//Sink.txt"); while((length1=f.read())!=-1) { sen+=(char)length1; } System.out.println(sen);

} catch (Exception exp) { exp.printStackTrace(); } // // TODO: Add any constructor code after initializeComponent call //

this.setVisible(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always regenerated * by the Windows Form Designer. Otherwise, retrieving design might not work properly. * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder * to retrieve your design properly in future, before revising this method. */ private void initializeComponent() { jLabel1 = new JLabel(); jTextArea1 = new JTextArea(); jScrollPane1 = new JScrollPane(); jButton1 = new JButton(); contentPane = (JPanel)this.getContentPane(); // // jLabel1 // jLabel1.setText("INTRUSION DETECTOR1"); jLabel1.setForeground(Color.white); // // jTextArea1 // // // jScrollPane1 // jScrollPane1.setViewportView(jTextArea1); // // jButton1 // jButton1.setBackground(new Color(255, 255, 255)); jButton1.setText("Exit"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); // // contentPane

// contentPane.setLayout(null); contentPane.setBackground(new Color(210,105,30)); addComponent(contentPane, jLabel1, 172,9,133,38); addComponent(contentPane, jScrollPane1, 26,37,441,341); addComponent(contentPane, jButton1, 204,390,83,28); // // Detector1 // this.setTitle("Detector1 - extends JFrame"); this.setLocation(new Point(0, 0)); this.setSize(new Dimension(505, 462)); } /** Add Component Without a Layout Manager (Absolute Positioning) */ private void addComponent(Container container,Component c,int x,int y,int width,int height) { c.setBounds(x,y,width,height); container.add(c); } // // TODO: Add any appropriate code in the following Event Handling Methods // private void jButton1_actionPerformed(ActionEvent e) { System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); // TODO: Add any handling code here } // // TODO: Add any method code to meet your needs in the following area // public void server() { try { String rr=""; socket_1=server_1.accept(); dis=new DataInputStream(socket_1.getInputStream()); int length=dis.readInt();

String destination=dis.readUTF(); if(destination.equalsIgnoreCase("probe")) { jTextArea1.append("\t**********************************\n"); jTextArea1.append("\tTHIS IS FROM PORT Probe \n"); jTextArea1.append("\t**********************************\n"); Client_1=new Socket(sen,101); dis1=new DataOutputStream(client_1.getOutputStream()); dis1.writeInt(length); dis1.writeUTF(destination); while(length>0) { rr=dis.readUTF(); jTextArea1.append("Packet "+i+"\t"+rr+" Recieved...\n"); dis1=new DataOutputStream(client_1.getOutputStream()); dis1.writeUTF(rr); length--; i++; } i=1; } else if (destination.equalsIgnoreCase("Dos")) { jTextArea1.append("\t**********************************\n"); jTextArea1.append("\tTHIS IS FROM PORT U2R\n"); jTextArea1.append("\t**********************************\n"); while(length>0) { rr=dis.readUTF(); StringBuffer sb=new StringBuffer(rr); sb.delete(7,10); jTextArea1.append("\t\tPacket "+i+"\t"+rr.substring(4,15)+" Recieved...\n"); length--; i++; } i=1; int delay = 100; //milliseconds Timer t=new Timer(delay, new ActionListener() { int count=1; Public void actionPerformed(ActionEvent evt) { if(count<=10) { java.awt.Toolkit.getDefaultToolkit().beep(); count++ } else

return; } }); t.start(); JOptionPane.showMessageDialog(null,"Detector1:From Policy Matching : This is an Anomalous Request :This modification to policy object is invalid"); JOptionPane.showMessageDialog(null,"Detector1:From Policy Administration : Intursion Response System : This request should get authentication from k authorised users "); jOptionPane.showMessageDialog(null,"Detector1:Intursion Response System : Taken Aggresive action i.e.Shutdown !!!!!!"); System.exit(0); }else if (destination.equalsIgnoreCase("DoS1")) { jTextArea1.append("\t**********************************\n"); jTextArea1.append("\tTHIS IS FROM PORT Dos1\n"); TextArea1.append("\t**********************************\n"); client_1=new Socket(sen,101); dis1=new DataOutputStream(client_1.getOutputStream()); dis1.writeInt(length); dis1.writeUTF(destination); while(length>0){ rr=dis.readUTF(); jTextArea1.append("Packet "+i+"\t"+rr+" Recieved...\n"); dis1=new DataOutputStream(client_1.getOutputStream()); dis1.writeUTF(rr); length--; i++; } i=1; }} catch (Exception exp) { exp.printStackTrace(); } }

public static void main(String[] args) { Detector1 r1=new Detector1(); while (true) { r1.server(); } }

INPUT DESIGN The input design is the link between the information system and the user. It comprises the developing specification and procedures for data preparation and those steps are necessary to put transaction data in to a usable form for processing can be achieved by inspecting the computer to read data from a written or printed document or it can occur by having people keying the data directly into the system. The design of input focuses on controlling the amount of input required, controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The input is designed in such a way so that it provides security and ease of use with retaining the privacy. Input Design considered the following things: What data should be given as input? How the data should be arranged or coded? The dialog to guide the operating personnel in providing input. Methods for preparing input validations and steps to follow when error occur.

OBJECTIVES 1.Input Design is the process of converting a user-oriented description of the input into a computer-based system. This design is important to avoid errors in the data input process and show the correct direction to the management for getting correct information from the computerized system. 2. It is achieved by creating user-friendly screens for the data entry to handle large volume of data. The goal of designing input is to make data entry easier and to be free from errors. The data entry screen is designed in such a way that all the data manipulates can be performed. It also provides record viewing facilities. 3.When the data is entered it will check for its validity. Data can be entered with the help of screens. Appropriate messages are provided as when needed so that the user will not be in maize of instant. Thus the objective of input design is to create an input layout that is easy to follow. OUTPUT DESIGN A quality output is one, which meets the requirements of the end user and presents the information clearly. In any system results of processing are communicated to the users and to other system through outputs. In output design it is determined how the information is to be displaced for immediate need and also the hard copy output. It is the most important and direct source information to the user. Efficient and intelligent output design improves the systems relationship to help user decision-making.

1. Designing computer output should proceed in an organized, well thought out manner; the right output must be developed while ensuring that each output element is designed so that people will find the system can use easily and effectively. When analysis design computer output, they should Identify the specific output that is needed to meet the requirements. 2.Select methods for presenting information. 3.Create document, report, or other formats that contain information produced by the system. The output form of an information system should accomplish one or more of the following objectives. Convey information about past activities, current status or projections of the Future. Signal important events, opportunities, problems, or warnings. Trigger an action. Confirm an action.

3.4 SCREEN DESIGNS Process Specification(Techniques And Algorithm Used) Policy Matching Policy Administration

File Sending

Open the project and run it

File Running

Sending Data

Providing DBA Name

Conformation of DBA

Intrusion Detection

Data Receiving in Sink1

Request Rejecter

Data Receiving by the DBA

Result of the request

4.1 SYSTEM TESTING


Black Box testing Black Box testing is also known as functional testing. A software testing technique whereby the internal workings of the item being tested are not known by the tester. For example, in a black box test on a software design the tester only knows the inputs and what the expected outcomes should be and not how the program arrives at those outputs. The tester does not ever examine the programming code and does not need any further knowledge of the program other than its specifications. White box testing White box testing also known as glass box, structural, clear box and open box testing. A software testing technique whereby explicit knowledge of the internal workings of the item being tested are used to select the test data. Unlike black box testing, white box testing uses specific knowledge of programming code to examine outputs. The test is accurate only if the tester knows what the program is supposed to do. He or she can then see if the program diverges from its intended goal. White box testing does not account for errors caused by omission, and all visible code must also be readable. Unit testing Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing is often automated but it can also be done manually.Unit testing involves only those characteristics that are vital to the performance of the unit under test. This encourages developers to modify the source code without immediate concerns about how such changes might affect the functioning of other units or the program as a whole. Once all of the units in a program have been found to be working in the most efficient and error-free manner possible, larger components of the program can be evaluated by means of integration testing. System testing System testing is the process of performing a variety of tests on a system to explore functionality or to identify problems. System testing is usually required before and after a system is put in place. A series of systematic procedures are referred to while testing is being performed. These procedures tell the tester how the system should perform and where common mistakes may be found. Testers usually try to "break the system" by entering data that may cause

the system to malfunction or return incorrect information. For example, a tester may put in a city in a search engine designed to only accept states, to see how the system will respond to the incorrect input. Integration testing Integration testing is also known as integration and testing, is a software development process which program units are combined and tested as groups in multiple ways. In this context, a unit is defined as the smallest testable part of an application. Integration testing can expose problems with the interfaces among program components before trouble occurs in real-world program execution.There are two major ways of carrying out an integration test, called the bottom-up method and the top-down method. Bottom-up integration testing begins with unit testing, followed by tests of progressively higher-level combinations of units called modules or builds. In top-down integration testing, the highest-level modules are tested first and progressively lower-level modules are tested after that.

5.1 HOW TO OPERATE THE PACKAGE


Steps in the execution of a EEVCS Application: 1. First of all we need to install the software java jdk 1.6. 2. Next install Net Beans ide for executing this application 3. Place the EEVCS application in Net Beans 4. Open project in Net Beans and run it. 5. Then a window appears which provides user interface to interact with the application. 6. Select image from file menu which we want to send to the receiver.

6. SCOPE FOR FURTHER DEVELOPMENT

7. CONCLUSION
The response component of intrusion detection system for a DBMS is described. The response component is responsible for issuing a suitable response to an anomalous user request. An interactive Event-Condition-Action type response policy language is presented that makes it very easy for the database security administrator to specify appropriate response actions for different circumstances depending upon the nature of the anomalous request. The two main issues that is addressed in the context of such response policies are policy matching, and policy administration. For the policy matching procedure, an algorithm is described to efficiently search the policy database for policies matching an anomalous request assessment. The other issue that is addressed is the administration of response policies to prevent malicious modifications to policy objects from legitimate users.

8.BIBLIOGRAPHY
[1] A. Conry-Murray, The Threat from within. Network Computing (Aug. 2005), http://www.networkcomputing.com/showArticle. jhtml?articleID=166400792, July 2009. [2] R. Mogull, Top Five Steps to Prevent Data Loss and Information Leaks. Gartner Research (July 2006), http://www.gartner.com, 2010. [3] M. Nicolett and J. Wheatman, Dam Technology Provides Monitoring and Analytics with Less Overhead. Gartner Research (Nov. 2007), http://www.gartner.com, 2010. [4] R.B. Natan, Implementing Database Security and Auditing. Digital Press, 2005. [5] D. Brackney, T. Goan, A. Ott, and L. Martin, The Cyber Enemy within Countering the Threat from Malicious Insiders, Proc. Ann. Computer Security Applications Conf. (ACSAC). pp. 346-347, 2004. [6] A. Kamra, E. Terzi, and E. Bertino, Detecting Anomalous Access Patterns in Relational Databases, J. Very Large DataBases (VLDB), vol. 17, no. 5, pp. 1063-1077, 2008. [7] A. Kamra, E. Bertino, and R.V. Nehme, Responding to Anomalous Database Requests, Secure Data Management, pp. 50- 66, Springer, 2008. [8] A. Kamra and E. Bertino, Design and Implementation of SAACS: A State-Aware Access Control System, Proc. Ann. Computer Security Applications Conf. (ACSAC), 2009. [9] Postgresql 8.3. The Postgresql Global Development Group, http://www.postgresql.org/, July 2008. [10] J. Widom and S. Ceri, Active Database Systems: Triggers and Rules for Advanced Database Processing. Morgan Kaufmann, 1995. [11] Oracle Database Concepts 11g Release 1 (11.1), http://

download.oracle.com/docs/cd/B28359_01/server.111/b28318/ datadict.htm, July 2009. [12] V. Shoup, Practical Threshold Signatures, Proc. Intl Conf. Theory and Application of Cryptographic Techniques (EUROCRYPT), pp. 207- 220, 2000. [13] R. Gennaro, T. Rabin, S. Jarecki, and H. Krawczyk, Robust and Efficient Sharing of RSA Functions, J. Cryptology, vol. 20, no. 3, pp. 393-400, 2007. [14] D. Kincaid and W. Cheney, Numerical Analysis: Mathematics of Scientific Computing. Brooks Cole, 2001. [15] Openpgp Message Format. rfc 4800, http://www.ietf.org/rfc/ rfc4880.txt, July 2009.

You might also like