project report on proxy server

Upload: akanksha-khanwe

Post on 06-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Project report on proxy server

    1/80

    1

    1.INTRODUCTION :

    1.1 OVERVIEWS AND ISSUES INVOLVEDOverview of proxy server:

    Proxy Server Overview:

    Proxy Server enables you to connect the private network or LAN to a

    public network such as the Internet, by acting as a gateway for internal

    client computers to the Internet. Proxy Server is a secure gateway which

    you can use to provide Internet connectivity for IP and IPX based

    networks. A gateway is a computer that makes it possible for two networks

    to communicate.

    Proxy Server services should run on one computer to which both the

    private network and the public network is connected to. The computer

    running the Proxy Server services should have two network interfaces:

    A network interface that points to the public network.

    A network interface that points to the private network.

  • 8/3/2019 Project report on proxy server

    2/80

  • 8/3/2019 Project report on proxy server

    3/80

    3

    Issues of proxy server:

    When proxy servers go down, the calls seem to come all at once. "Is

    there a problem with the proxy server?" "I can't get to my Web site."

    "I keep getting this message saying the computer can't find the

    server." Admittedly, many browsers and proxy servers don't explainto users what went wrong with their request. However, you can

    categorize nearly every proxy server problem into one of four

    categories:

    The browser or client is misconfigured. The URL or Web site is down. Connectivity or network problems exist. An actual proxy server problem exists.

    Local Connectivity and Network Issues:

    Network problems are common problems that every proxy server

    administrator faces. Even the proxy servers with the highest availability

    rates still have to account for Web servers on the Internet that are down. Ifthe remote site is down or inaccessible, it's often up to the administrator to

    break the bad news to end users.

    You can quickly eliminate the proxy server from this picture by asking a

    user to go to another Web site. Note that although the site appears, it might

    be coming from the cache. To ensure that the proxy server is loading a

    fresh copy from the Web server, ask the user to hold down Ctrl+Shift and

    click Refresh (if the client is using IE).

    One common problem during setup is the presence of multiple default

    gateways. This problem generates a 10060 error (Connection Timed Out)

    to any request sent to the Web Proxy service. Though this error is often

    associated with slow external links to the Internet, if it occurs right after

    setup, more than one default gateway is probably present.

  • 8/3/2019 Project report on proxy server

    4/80

    4

    Proxy server administrators often see event ID 120 in the proxy server's

    event log. The event's description is The Proxy Service could not create a

    packet filter. This message is typical on busy proxy servers with packet

    filtering enabled. The purpose of the message is to alert the administrator

    that the packet filter dropped more than 20 packets.

    Possible issues with caching:

    Caching rightnow Service URLs on your proxy server may result in the

    issues below:

    1.Users get time out errors when performing tasks.2.Users get partial page loads.3.Staff Users can open answers and incidents for editing, but when the

    session times out or they leave the page, they can no longer get in.

    User must clear the temporary Internet files in order to get in again.

    4.Issues are intermittent and cannot be reproduced on demand.

    Troubleshooting Tips:

    Caching issues with your browser may cause intermittent results as well.

    Try clearing the cache in your browser. In Internet Explorer, use the steps

    below:

    1.Select Tools -> Internet Options2.Under Temporary Internet Files, select Delete Files.3.Click OK.

  • 8/3/2019 Project report on proxy server

    5/80

    5

    You may also change the browser to always request a new page. In

    Internet Explorer, use the following steps:

    1.Select Tools -> Internet Options2.Under Temporary Internet Files, select Settings.3.Under Check for new versions of stored pages, select Every visit to

    the page.

    4.Click OK.

    1.2) PROBLEM DEFINITION

    NETWORKING:

    A computer network, often simply referred to as a network, is a

    collection ofcomputers and devices interconnected by communicationschannels that facilitate communications and allows sharing of resources

    and information among interconnected devices. Networks may be

    classified according to a wide variety of characteristics such as topology,

    connection method and scale.

    PROS:You have undoubtedly heard the the whole is greater than the sum

    of its parts. This phrase describesnetworking very well, and explains why

    it has become so popular. A network isn't just a bunch ofcomputers with

    wires running between them. Properly implemented, a network is a system

    that provides its users with unique capabilities, above and beyond what the

    individual machines and their software applications can provide.

    http://en.wikipedia.org/wiki/Computershttp://en.wikipedia.org/wiki/Network_topologyhttp://www.tcpipguide.com/free/t_TheAdvantagesBenefitsofNetworking.htmhttp://www.tcpipguide.com/free/t_TheAdvantagesBenefitsofNetworking.htmhttp://www.tcpipguide.com/free/t_TheAdvantagesBenefitsofNetworking.htmhttp://www.tcpipguide.com/free/t_TheAdvantagesBenefitsofNetworking.htmhttp://www.tcpipguide.com/free/t_TheAdvantagesBenefitsofNetworking.htmhttp://en.wikipedia.org/wiki/Network_topologyhttp://en.wikipedia.org/wiki/Computers
  • 8/3/2019 Project report on proxy server

    6/80

    6

    Most of the benefits of networking can be divided into two generic

    categories: connectivity and sharing. Networks allow computers, and

    hence their users, to be connected together. They also allow for the easy

    sharing of information and resources, and cooperation between the devicesin other ways. Since modern business depends so much on the intelligent

    flow and management of information, this tells you a lot about why

    networking is so valuable

    CONS

    But, networking has a few drawbacks that balance against its manypositive aspects. Setting up a network has costs in hardware, software,

    maintenance and administration. It is also necessary to manage a network

    to keep it running smoothly, and to address possible misuse or abuse. Data

    security also becomes a much bigger concern when computers are

    connected together.

    In such a large network, our system becomes exposed. Hence, there

    are chances of some of the problems such as, unauthorized access, virus

    attack, speed etc. Such disadvantages define our problem domain.

  • 8/3/2019 Project report on proxy server

    7/80

    7

    1.3) SOLUTION DOMAIN

    PROXY SERVER

    In order to reduce the risks associated with networking, of which

    security is the main, many techniques have been in use. One of the

    methods used is setting of a proxy server. Now, let us see what this proxy

    server is.

    In computer networks, a proxy server is a server (a computer system

    or an application program) that acts as an intermediary for requests from

    clients seeking resources from other servers. A proxy is a stand-in for you

    - someone who does something on your behalf. Asthe name proxy, it

    means a server which fills up or acts and provides functionalities of some

    other server. In an enterprise that uses the Internet, a proxy server is a

    server that acts as an intermediary betweena workstation user and the

    Internet.

    TYPES OF PROXY SERVER

    1. FTP Proxy Server:

    Relays and caches FTP Traffic.

    2. HTTP Proxy Server:

    A one way request to retrieve Web Pages.

  • 8/3/2019 Project report on proxy server

    8/80

    8

    3. Socks Proxy Server:

    A newer protocol to allow relaying of far more different types of data,

    whether TCP or UDP.

    4. NAT Proxy Server:

    This one works a little different, it allows the redirection of all packets

    without a Program having to support a Proxy Server.

    5. SSL Proxy Server:

    An extension was created to the HTTP Proxy Server which allows relaying

    of TCP data similar to a Socks Proxy Server. This one done mainly to

    allow encryption of Web Page requests.

    Furthermore, a Proxy Server can be split into another two Categories:

    6.Anonymous:

    An Anonymous Proxy Server blocks the remote Computer from knowing

    the identity of the Computer using the Proxy Server to make

    7. Transparent:

    A Transparent Proxy Server tells the remote Computer the IP Address ofyour Computer. This provides no privacy.

    Anonymous Proxy Servers can further be broken down into two more

    categories, Elite and Disguised. An Elite Proxy Server is not identifiable to

    the remote computer as a Proxy in any way. A Disguised Proxy Server

    gives the remote computer enough information to let it know that it is a

    Proxy, however it still does not give away the IP of the Computer it is

    relaying information for.

  • 8/3/2019 Project report on proxy server

    9/80

    9

    2. PROJECT DESCRIPTION

    2.1) FEATURES

    Proxy Server provides a secure gateway to the Internet. It acts as thecontrol point between the private network and the Internet. Only a

    single secure gateway or control point needs to be managed, and you

    can also control the flow of traffic at the Proxy Server.

    Numerous users can utilize the single Internet connection providedby Proxy Server. This leads to cost savings with regard to modems,

    telephone lines, and so forth.

    The IP addresses utilized on the private network are not revealed onthe Internet. When users on the private network request content on

    the Internet, the public IP address of the Proxy Server is used, and

    not the private IP addresses. In this way, private IP addresses are

    never visible on the Internet or used on the Internet

    Because of the Proxy Server has two network interface cards, theLAN is secured from unauthorized users attempting to access theprivate network. Only one point of contact exists between the private

    network and the Internet.

    Proxy Server 2.0 provides a dynamic packet filtering feature thatenables you to block specific packet types through ports.

  • 8/3/2019 Project report on proxy server

    10/80

    10

    Proxy Server can locally cache Internet sites and files which arefrequently requested. Subsequent requests for these Internet sites are

    then serviced from the local cache. Cached information is accessed

    by users from a location on the Local Area Network (LAN). Thismeans that bandwidth utilization to the Internet ends up being

    lowered because cached information does not need to be

    downloaded from the Internet. All of this leads to an improvement in

    the service experienced by users.

    Proxy Server, by default, provides network address translationbetween the private network and the Internet. This basically meansthat Proxy Server supports private IP addressing schemes and public

    addressing.

    Proxy Server also provides a feature called proxy arrays. A proxyarray is a solution whereby one or multiple proxy servers operate as

    a single cache for client requests. Benefits provided by the proxy

    array feature include scalable performance, and fault tolerance.

    Clients running WinSock and SOCKS applications can use TCP/IPor IPX/SPX to access the Internet via Proxy Server.

    Proxy Server also includes Web publishing support. You can utilizethe reverse proxy feature to provide Internet users with the ability toaccess Web servers hosted on the network through the Proxy Server.

    Reverse hosting takes place when multiple Web servers are able to

    publish to the Internet.

    http://www.tech-faq.com/tcp.htmlhttp://www.tech-faq.com/tcp.html
  • 8/3/2019 Project report on proxy server

    11/80

    11

    Access to the Internet can be based on users, or groups of users.Proxy Server can provide different types of access to the Internet,

    based on each group of users.

    You can limit the Web sites that users can access.

    Internet usage for each user can be tracked and logged.

    2.2 IMPLEMENTATION

    Implementations of proxies:

    Web proxy:

    A proxy that focuses on World Wide Web traffic is called a "web proxy".The most common use of a web proxy is to serve as a web cache. Most

    proxy programs provide a means to deny access to URLs specified in a

    blacklist, thus providing content filtering. This is often used in a corporate,

    educational, or library environment, and anywhere else where content

    filtering is desired. Some web proxies reformat web pages for a specific

    purpose or audience, such as for cell phones and PDAs.

    Suffix proxies:A suffix proxy server allows a user to access web content by appending

    the name of the proxy server to the URL of the requested content (e.g.

    "en.wikipedia.org.example.com"). Suffix proxy servers are easier to use

    than regular proxy servers.

    Transparent proxies:

    http://wiki/World_Wide_Webhttp://wiki/Web_cachehttp://wiki/Blacklist_(computing)http://wiki/Blacklist_(computing)http://wiki/Web_cachehttp://wiki/World_Wide_Web
  • 8/3/2019 Project report on proxy server

    12/80

    12

    An intercepting proxy (also forced proxy or transparent proxy) combines a

    proxy server with a gateway or router (commonly with NAT capabilities).

    Connections made by client browsers through the gateway are diverted to

    the proxy without client-side configuration (or often knowledge).

    Connections may also be diverted from a SOCKS server or other circuit-

    level proxies.

    A security flaw in the way that transparent proxies operate was published

    by Robert Auger in 2009 and advisory by the Computer Emergency

    Response Team was issued listing dozens of affected transparent, and

    intercepting proxy servers.

    Implementation Methods:

    Interception can be performed using Cisco's WCCP (Web Cache Control

    Protocol). This proprietary protocol resides on the router and is configured

    from the cache, allowing the cache to determine what ports and traffic is

    sent to it via transparent redirection from the router. This redirection can

    occur in one of two ways: GRE Tunneling (OSI Layer 3) or MAC rewrites

    (OSI Layer 2).

    Once traffic reaches the proxy machine itself interception is commonly

    performed with NAT (Network Address Translation). Such setups are

    invisible to the client browser, but leave the proxy visible to the web

    server and other devices on the Internet side of the proxy. Recent releases

    of Linux and some BSD provide TPROXY (Transparent Proxy) which

    performs IP-level (OSI Layer 3) transparent interception and Spoofing of

    outbound traffic. Hiding the proxy IP address from other network devices.

    http://wiki/Gateway_(computer_networking)http://wiki/Routerhttp://wiki/Network_address_translationhttp://wiki/SOCKShttp://wiki/Web_Cache_Communication_Protocolhttp://wiki/Web_Cache_Communication_Protocolhttp://wiki/SOCKShttp://wiki/Network_address_translationhttp://wiki/Routerhttp://wiki/Gateway_(computer_networking)
  • 8/3/2019 Project report on proxy server

    13/80

    13

    Implementation:

    Start by defining our Proxy class with the required imports, indicating

    to other classes that it may throw an IOException:

    import java.net.* ;

    import java.io.* ;

    import java.lang.* ;

    import java.util.* ;

    class Proxy {

    public static void main(String args[]) throws IOException{

    }

    }

    Read the local port, remote machine name and remote port as

    command line arguments (in that order):

    This is done by by parsing the commands entered by the user when theProxy Server is initailly started, picking off each peice. The local port

    number is parsed first, followed by the remote host name, and finaly the

    remote port address. Each of these were checked for legality, and passed to

    the rest of the program if acceptable. If any were invalid, the program

    would exit and report the appropriate error.

  • 8/3/2019 Project report on proxy server

    14/80

    14

    Check the parameters for validity:

    Each of these were checked for legality, and passed to the rest of the

    program if acceptable. If any were invalid, the program would exit and

    report the appropriate error.

    Create a socket and accept TCP requests on the local port:

    This is accomplished by creating a new Server Socket Server, from the

    ServerSocket Class. The port which it listens on is the one passed by the

    user on the command line. An Accepting socket is created by using theAccept() method of the Server Socket Class. This port is now ready to

    begin accepting TCP requests.

    Create two threads:

    This is done by implementing a new Class, ProxyThread which extends

    the Thread Class, and creating 2 new proxyThreads, which accept Sockets

    as their parameters. The Sockets that are passed are the Incoming and

    Outgoing Sockets, in that order. The Run() method of the Thread Class is

    overwritten, and does the actual data stream transferring, by the use of the

    OutputStream object, and the IpnutStream object of the Socket Class. The

    Proxy accepts data on the InputStream with the use of the Read() method,

    and stores it in a buffer. It then sends this buffer on the OutputStream with

    the use of the Write() methods of that sream.

    One to handle each of the following:

    Read an unknown amount data from the local port and forwardit to the remote port:

    This is done by passing the incoming and outgoing port (in that

    order) to the proxyThread constructor. This creates a Listening

    Socket on the Proxy Server, listening on the local port, and a

    Sending Socket, directed to the Server who is serving the requests.

  • 8/3/2019 Project report on proxy server

    15/80

    15

    The amount of data read at each instant is printed to the screen

    where the proxy is running.

    Read an unknown amount of data from the remote port andforward it to the local port:

    In this case, the proxyThread class is sent the Socket parameters inthe reverse order. The Listening Socket (first parameter) is the

    socket connected to the Server, and the Sending Socket (second

    parameter) is connected to the local port of the Client. The amount

    of data read at each instant is printed to the screen where the proxy is

    running.

    Close the sockets if either closes or an exception occurs:

    If any type of error is detected while the server is either started or running,

    it will immediately close all sockets, and terminate itself. If either the

    Client or the Server close their connections to the other, the Proxy Server

    will also close all sockets and terminate itseslf. It knows if either the Client

    or Server has disconnected because a -1 is sent. The Proxy Server listens,

    waiting for this to be sent, and when it is encountered, all sockets are

    closed.

    Correctly terminate the threads:

    Again, if any type of error is detected while the server is either started or

    running, it will immediately end all threads, and terminate itself. If either

    the Client or the Server close their connections to the other, the Proxy

    Server will also end all threads and terminate itseslf. It knows if either the

    Client or Server has disconnected because a -1 is sent. The Proxy Serverlistens, waiting for this to be sent, and when it is encountered, all threads

    are closed.

    After the sockets are closed, connect more clients without re-starting

    the proxy:

    Once the server is started it will continualy listen for new connections on

    the port it is listening to. Therefore, if one connection is ended, thereby

    closing the sockets and terminating the threads, the Proxy Server will still

  • 8/3/2019 Project report on proxy server

    16/80

    16

    be active, listening for more users to connect. It does not need to be

    restarted in order to be connected to by more clients, because it runs

    independently, with or without users currently using it.

    Complete each of these tasks for multiple concurrent users:

    Because the server creates a new pair of threads for each client which

    attempts to connect to it, it can support multiple concurrent users

    simultaneously without any problem.

    2.3 WORKING LAYOUTS

    How Proxy Servers Works :

    1. When a computer on the intranet makes a request out to the Internet-

    such as to retrieve a Web page from a Web server-the internal computer

    actually contacts the proxy server, which in turn contacts the Internet

    server. The Internet server sends the Web page to the proxy server, whichthen forwards the page to the computer on the intranet.

    2.Whenever a user connects to the Internet using a client application

    configured to use a proxy server, the application will first connect to the

    proxy server and give it its request. The proxy server then connects to the

    server which the client application wants to connect to and sends that

    server the request. Next, the server gives its reply to the proxy, which then

    finally sends it to the application client.

    3. Proxy servers log all traffic between the Internet and the intranet. For

    example, a Telnet proxy server could track every single keystroke hit in

    every Telnet session on the intranet-and could also track how the external

    server on the Internet reacts to those keystrokes. Proxy servers can log

    every IP address, date and time of access, URL, number of bytes

    downloaded, and so on. This information can be used to analyze any

  • 8/3/2019 Project report on proxy server

    17/80

    17

    attacks launched against the network. It can also help intranet

    administrators build better access and services for employees.

    4. Some proxy servers must work with special proxy clients. A more

    popular approach is to use off-the-shelf clients such as Netscape with

    proxy servers. When such an off-the-shelf package is used, it must bespecially configured to work with proxy servers from a configuration

    menu. Then the intranet employee uses the client software as usual. The

    client software knows to go out to a proxy server to get the data, instead of

    to the Internet.

    Diagram depicting what is a proxy Server

  • 8/3/2019 Project report on proxy server

    18/80

    18

    4.ANALYSIS3.1) SYSTEM STUDY

    IDENTIFICATION OF NEED

    In a LAN, it is needed that there should be some security provided by

    the administrator and that some unauthorized sites should not be shown tothat client in LAN. It was needed to decrease the web page access time so

    that those web pages that have been accessed earlier should not be asked

    from the web directly.

    FEASIBILITY STUDY

    Following points are to be considered in feasibility study:

    TECHNOLOGY

    Mechanism for Client Server communication

    Browser

    Connection to server

    Cache management

  • 8/3/2019 Project report on proxy server

    19/80

    19

    COST AND BENEFIT ANALYSIS

    Building proxy server for LAN does not require any financial investment.

    Cost is only in form of time and effort of the developer. Proxy servers are

    application gateways originally created as part of firewall systems toimprove security. Internal systems connect to the outside world through

    the proxy server, and external systems respond to the proxy server. The

    external systems do not see a network of internal systems. They see only

    one system - the proxy server. Proxy server reduces the response time for

    any request from the client.

    REQUIREMENT SPECIFICATION

    To develop a system according to the need of the end user and compatible

    to the most frequently used and easily available software and hardware, a

    detailed requirement specification is needed to be performed. The various

    requirement specifications are as follows:

  • 8/3/2019 Project report on proxy server

    20/80

    20

    USER REQUIREMENT1) A major requirement is to develop an application which reduces

    network and server load and provides increased client performance for

    most frequently used web pages by caching.

    2) The application should act as a firewall between the LAN and the

    Internet. The firewall has to make sure that it denies the requests for

    any blocked site.

    3) It should block those clients in LAN which are restricted for Internet

    access.

    4) It should have a user friendly interface so that even a layman can use it

    and understand it with ease.

    5) The software should be easily upgradeable in which new modules and

    features can easily be added. It needs to be specified that in case of a

    proxy server the user will be proxy server administrator.

    REQUIREMENT ANALYSIS

    The firewall of proxy has to block the HTTP request emanating from an

    invalid IP address.It also has to not to service the request for any link

    which is blocked by the proxy administrator. The proxy has to have cache

    to store the web pages locally to reduce latency and network load. A user

    friendly Graphical User Interface also needed to be supplied for proxy

    administrator.

  • 8/3/2019 Project report on proxy server

    21/80

    21

    MODELING

    Now what will follow is a series of modeling tasks that lead to a complete

    specification of requirement and a comprehensive design representation.

    We will follow the structured analysis model in which we create and

    partition data, functional and behavioral models.

    DATA MODELING

    Data modeling method make use of the entity relationship diagram. The

    entity relationship diagram is used to depict between data objects. The

    ERD defines all data that are entered, stored, transformed and produced

    with in an application. First of all by having a glance again at the

    requirement specification we pick up a list of things or objects (here it

    does not mean object of OOP) that the application is going to address.

    Following are the things that evolve into input/output objects:

    1) User

    2) Firewall

    3) User Interface

    4) Proxy Administrator

    5) Cache Manager

    6) Internet (abstract entity which generates HTTP response)

  • 8/3/2019 Project report on proxy server

    22/80

    22

    3.2 FUNCTINAL AND MODELLING INFORMATION

    FLOW:

    As information moves through software, it is modified by a series

    of transformations. Data Flow Diagrams is a graphical representation that

    depicts information flow and transformations that are applied as data

    moves from input to output. Here while depicting DFD we have assumed

    that the user views proxy and Internet as the system.

    DATA FLOW DIAGRAM

    0 level DFD:

  • 8/3/2019 Project report on proxy server

    23/80

  • 8/3/2019 Project report on proxy server

    24/80

    24

    2Level DFD:

  • 8/3/2019 Project report on proxy server

    25/80

    25

    4. SYSTEM DESIGN

    4.1) MODEL USED

    WATERFALL MODEL

    1.)The requirement analysis shows that the logic flow is straight andlinear.

    2.)All the requirements are available beforehand.3.)The project is stable.4.)The requirements are fixed throughout the project.

  • 8/3/2019 Project report on proxy server

    26/80

    26

    4.2) MODEL DESCRIPTION

    The life cycle approach is derived from the waterfall model of system

    development described by ROYCE in 1970, is simplified version of which is

    given below: -

  • 8/3/2019 Project report on proxy server

    27/80

    27

    The stages of "The Waterfall Model" are:

    Requirement Analysis & Definition: All possible requirements of the

    system to be developed are captured in this phase. Requirements are set of

    functionalities and constraints that the end-user (who will be using the

    system) expects from the system. The requirements are gathered from the

    end-user by consultation, these requirements are analyzed for their validity

    and the possibility of incorporating the requirements in the system to be

    development is also studied. Finally, a Requirement Specification

    document is created which serves the purpose of guideline for the next

    phase of the model.

    System & Software Design: Before a starting for actual coding, it is

    highly important to understand what we are going to create and what it

    should look like? The requirement specifications from first phase are

    studied in this phase and system design is prepared. System Design helps

    in specifying hardware and system requirements and also helps in definingoverall system architecture. The system design specifications serve as

    input for the next phase of the model.

    Implementation & Unit Testing: On receiving system design documents,

    the work is divided in modules/units and actual coding is started. The

    system is first developed in small programs called units, which are

    integrated in the next phase. Each unit is developed and tested for its

    functionality; this is referred to as Unit Testing. Unit testing mainly

    verifies if the modules/units meet their specifications.

    Integration & System Testing: As specified above, the system is first

    divided in units which are developed and tested for their functionalities.

    These units are integrated into a complete system during Integration phase

    and tested to check if all modules/units coordinate between each other and

    the system as a whole behaves as per the specifications. After successfullytesting the software, it is delivered to the customer.

  • 8/3/2019 Project report on proxy server

    28/80

    28

    Operations & Maintenance: This phase of "The Waterfall Model" is

    virtually never ending phase (Very long). Generally, problems with the

    system developed (which are not found during the development life cycle)

    come up after its practical use starts, so the issues related to the system are

    solved after deployment of the system. Not all the problems come in

    picture directly but they arise time to time and needs to be solved; hence

    this process is referred as Maintenance.

    WATERFALL APPROACH CHARCTERISTIC:-

    Although there are many variations on the theme of the life cycle, each

    approach has its own characteristics: -

    Specific activities, techniques and outcomes are associated with eachstage.

    Progression between stages is orderly and proceeds in a linearfashion .

    View to be a process by technicians Monitoring and control takes place at the end of each stage . Involvement of end users is typically passive and principally in the

    analysis stage.

  • 8/3/2019 Project report on proxy server

    29/80

    29

    5.TOOLS USED

    5.1AT FRONT END:

    At front end we have used Core java (J2SE1.6)

    Introduction to Java:

    Java (with a capital J) is a high-level, third generation programming

    language, like C, FORTRAN, Smalltalk, Perl, and many others. You can

    use Java to write computer applications that crunch numbers, process

    words, play games, store data or do any of the thousands of other things

    computer software can do.

    Compared to other programming languages, Java is most similar to C.

    However although Java shares much of C's syntax, it is not C. Knowinghow to program in C or, better yet, C++, will certainly help you to learn

    Java more quickly, but you don't need to know C to learn Java. Unlike

    C++ Java is not a superset of C. A Java compiler won't compile C code,

    and most large C programs need to be changed substantially before they

    can become Java programs.

    What's most special about Java in relation to other programming languages

    is that it lets you write special programs called applets that can be

    downloaded from the Internet and played safely within a web browser

  • 8/3/2019 Project report on proxy server

    30/80

    30

    The Java Platform

    Aplatform is the hardware or software environment in which a program

    runs. We've already mentioned some of the most popular platforms like

    Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can

    be described as a combination of the operating system and underlying

    hardware. The Java platform differs from most other platforms in that it's a

    software-only platform that runs on top of other hardware-based platforms.

    The Java platform has two components:

    TheJava Virtual Machine TheJava Application Programming Interface (API)

    You've already been introduced to the Java Virtual Machine; it's the base

    for the Java platform and is ported onto various hardware-based platforms.

    The API is a large collection of ready-made software components that

    provide many useful capabilities. It is grouped into libraries of relatedclasses and interfaces; these libraries are known aspackages. The next

    section, What Can Java Technology Do? highlights some of the

    functionality provided by the API.

    The API and Java Virtual Machine insulate the

    program from the underlying hardware.

    As a platform-independent environment, the Java platform can be a bit

    slower than native code. However, advances in compiler and virtual

    machine technologies are bringing performance close to that of native

    code without threatening portability.

    http://download.oracle.com/javase/tutorial/getStarted/intro/cando.htmlhttp://download.oracle.com/javase/tutorial/getStarted/intro/cando.html
  • 8/3/2019 Project report on proxy server

    31/80

    31

    In fact, its versatility, efficiency, platform portability, and security have

    made it the ideal technology for network computing, so that today, Java

    powers more than 4.5 billion devices:

    over 800 million PCs

    over 1.5 billion mobile phones and other handheld devices (source:Ovum)

    2.2 billion smart cards plus set-top boxes, printers, web cams, games, car navigation

    systems, lottery terminals, medical devices, parking payment

    stations, etc.

    Today, you can find Java technology in networks and devices that range

    from the Internet and scientific supercomputers to laptops and cell phones,

    from Wall Street market simulators to home game players and credit cards-- just about everywhere.

    The best way to preview these applications is to explore java.com, the

    ultimate marketplace, showcase, and central information resource for

    businesses, consumers, and software developers who use Java technology.

  • 8/3/2019 Project report on proxy server

    32/80

    32

    Features of Java:

    1. Platform independent:

    The concept of Write-once-run-anywhere (known as the Platform

    independent) is one of the important key feature of java language that

    makes java as the most powerful language. Not even a single language is

    idle to this feature but java is closer to this feature. The programs written

    on one platform can run on any platform provided the platform must have

    the JVM.

    2. Simple:

    There are various features that makes the java as a simple language.

    Programs are easy to write and debug because java does not use the

    pointers explicitly. It is much harder to write the java programs that can

    crash the system but we cannot say about the other programming

    languages. Java provides the bug free system due to the strong memory

    management. It also has the automatic memory allocation and deallocation

    system.

    3. Object Oriented:

    To be an Object Oriented language, any language must follow at least the

    four characteristics.

    Inheritance: It is the process of creating the new classes and usingthe behavior of the existing classes by extending them just

    to reuse the existing code and adding the additional features as

    needed. Encapsulation: It is the mechanism of combining the information

    and providing the abstraction.

    Polymorphism: As the name suggest one name multiple form,Polymorphism is the way of providing the different functionality by

    the functions having the same name based on the signatures of the

    methods.

    Dynamic binding: Sometimes we don't have the knowledge ofobjects about their specific types while writing our code. It is the

  • 8/3/2019 Project report on proxy server

    33/80

    33

    way of providing the maximum functionality to a program about the

    specific type at runtime.

    As the languages like Objective C, C++ fulfills the above four

    characteristics yet they are not fully object oriented languages because

    they are structured as well as object oriented languages. But in case ofjava, it is a fully Object Oriented language because object is at the outer

    most level of data structure in java. No stand alone methods, constants,

    and variables are there in java. Everything in java is object even the

    primitive data types can also be converted into object by using the wrapper

    class.

    4. Robust:

    Java has the strong memory allocation and automatic garbage collection

    mechanism. It provides the powerful exception handling and type

    checking mechanism as compare to other programming languages.

    Compiler checks the program whether there any error and interpreter

    checks any run time error and makes the system secure from crash. All of

    the above features makes the java language robust.

    5. Distributed:

    The widely used protocols like HTTP and FTP are developed in java.

    Internet programmers can call functions on these protocols and can getaccess the files from any remote machine on the internet rather than

    writing codes on their local system.

    6. Portable:

    The feature Write-once-run-anywhere makes the java language portable

    provided that the system must have interpreter for the JVM. Java also has

    the standard data size irrespective of operating system or the processor.

    These features make the java as a portable language.

    7. Dynamic:

    while executing the java program the user can get the required files

    dynamically from a local drive or from a computer thousands of miles

    away from the user just by connecting with the Internet.

    8. Secure:

    Java does not use memory pointers explicitly. All the programs in java are

    run under an area known as the sand box. Security manager determines theaccessibility options of a class like reading and writing a file to the local

  • 8/3/2019 Project report on proxy server

    34/80

    34

    disk. Java uses the public key encryption system to allow the java

    applications to transmit over the internet in the secure encrypted form. The

    byte code Verifier checks the classes after loading.

    9. Performance:

    Java uses native code usage, and lightweight process called threads. In thebeginning interpretation of byte code resulted the performance slow but

    the advance version of JVM uses the adaptive and just in time compilation

    technique that improves the performance.

    10. Multithreaded:

    As we all know several features of Java like Secure, Robust, Portable,

    dynamic etc; you will be more delighted to know another feature of Java

    which is Multithreaded.

    Java is also a multithreaded programming language. Multithreading means

    a single program having different threads executing independently at the

    same time. Multiple threads execute instructions according to the program

    code in a process or a program. Multithreading works the similar way as

    multiple processes run on one computer.

    Multithreading programming is a very interesting concept in Java. In

    multithreaded programs not even a single thread disturbs the execution of

    other thread. Threads are obtained from the pool of available ready to run

    threads and they run on the system CPUs. This is how Multithreadingworks in Java which you will soon come to know in details in later

    chapters.

    11. Interpreted:

    we all know that Java is an interpreted language as well. With an

    interpreted language such as Java, programs run directly from the source

    code.

    The interpreter program reads the source code and translates it on the flyinto computations. Thus, Java as an interpreted language depends on an

    interpreter program.

    The versatility of being platform independent makes Java to outshine

    from other languages. The source code to be written and distributed is

    platform independent.

    Another advantage of Java as an interpreted language is its error

    debugging quality. Due to this any error occurring in the program gets

    traced. This is how it is different to work with Java.

  • 8/3/2019 Project report on proxy server

    35/80

    35

    5.2 AT BACK END:

    We are using MySQL Database System. It documents MySQL up to

    Version 5.0.9-beta, but is also applicable for older versions of the MySQL

    software (such as 3.23 or 4.0-production) because functional changes are

    indicated with reference to a version number.

    History of MySQL:

    We started out with the intention of using mSQL to connect to our tables

    using our own fast low-level (ISAM) routines. However, after some

    testing, we came to the conclusion that mSQL was not fast enough or

    flexible enough for our needs. This resulted in a new SQL interface to our

    database but with almost the same API interface as mSQL. This API wasdesigned to allow third-party code that was written for use with mSQL to

    be ported easily for use with MySQL.

    The derivation of the name MySQL is not clear. Our base directory and alarge number of our libraries and tools have had the prefix my for well

    over 10 years. However, co-founder Monty Widenius's daughter is also

    named My. Which of the two gave its name to MySQL is still a mystery,

    even for us.

    The name of the MySQL Dolphin (our logo) is Sakila, which was

    chosen by the founders of MySQL AB from a huge list of names

    suggested by users in our Name the Dolphin contest. The winning name

    was submitted by Ambrose Twebaze, an Open Source software developer

    from Swaziland, Africa. According to Ambrose, the feminine name Sakila

    has its roots in SiSwati, the local language of Swaziland. Sakila is also the

    name of a town in Arusha, Tanzania, near Ambrose's country of origin,

    Uganda.

  • 8/3/2019 Project report on proxy server

    36/80

    36

    1.4.2. The Main Features of MySQL

    The following list describes some of the important characteristics of the

    MySQL Database Software.

    Internals and Portabilityo Written in C and C++.o Tested with a broad range of different compilers.o Works on many different platforms..o Uses GNU Automake, Autoconf, and Libtool for portability.o APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and

    Tcl are available.

    o Fully multi-threaded using kernel threads. It can easily usemultiple CPUs if they are available.

    o Provides transactional and non-transactional storage engines.o Uses very fast B-tree disk tables (MyISAM) with index

    compression.

    o Relatively easy to add another storage engine. This is useful ifyou want to add an SQL interface to an in-house database.

    o A very fast thread-based memory allocation system.o Very fast joins using an optimized one-sweep multi-join.o In-memory hash tables, which are used as temporary tables.o

    SQL functions are implemented using a highly optimized classlibrary and should be as fast as possible. Usually there is no

    memory allocation at all after query initialization.

    o The MySQL code is tested with Purify (a commercial memoryleakage detector) as well as with Valgrind, a GPL tool

    (http://developer.kde.org/~sewardj/).

    o The server is available as a separate program for use in aclient/server networked environment. It is also available as a

    library that can be embedded (linked) into standalone

    applications. Such applications can be used in isolation or inenvironments where no network is available.

    Column Typeso Many column types: signed/unsigned integers 1, 2, 3, 4, and 8

    bytes long, FLOAT, DOUBLE, CHAR, VARCHAR, TEXT,

    BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR,

    SET, ENUM, and OpenGIS spatial types.o Fixed-length and variable-length records.

    http://developer.kde.org/~sewardj/http://developer.kde.org/~sewardj/
  • 8/3/2019 Project report on proxy server

    37/80

    37

    Statements and Functionso Full operator and function support in the SELECT and

    WHERE clauses of queries. For example:

    o mysql> SELECT CONCAT(first_name, ' ', last_name)o -> FROM citizeno -> WHERE income/dependents > 10000 AND age > 30;o Full support for SQL GROUP BY and ORDER BY clauses.

    Support for group functions (COUNT(), COUNT(DISTINCT

    ...), AVG(), STD(), SUM(), MAX(), MIN(), and

    GROUP_CONCAT()).

    o Support for LEFT OUTER JOIN and RIGHT OUTER JOINwith both standard SQL and ODBC syntax.

    o Support for aliases on tables and columns as required bystandard SQL.

    o DELETE, INSERT, REPLACE, and UPDATE return thenumber of rows that were changed (affected). It is possible to

    return the number of rows matched instead by setting a flag

    when connecting to the server.

    o The MySQL-specific SHOW command can be used to retrieveinformation about databases, database engines, tables, and

    indexes. The EXPLAIN command can be used to determine

    how the optimizer resolves a query.

    oFunction names do not clash with table or column names. Forexample, ABS is a valid column name. The only restriction is

    that for a function call, no spaces are allowed between thefunction name and the ( that follows it. )

    o You can mix tables from different databases in the same query

    Securityo

    A privilege and password system that is very flexible andsecure, and that allows host-based verification. Passwords are

    secure because all password traffic is encrypted when you

    connect to a server.

  • 8/3/2019 Project report on proxy server

    38/80

    38

    Scalability and Limitso Handles large databases. We use MySQL Server with

    databases that contain 50 million records. We also know of

    users who use MySQL Server with 60,000 tables and about

    5,000,000,000 rows.

    o Up to 64 indexes per table are allowed (32 before MySQL4.1.2). Each index may consist of 1 to 16 columns or parts of

    columns. The maximum index width is 1000 bytes (500 before

    MySQL 4.1.2). An index may use a prefix of a column for

    CHAR, VARCHAR, BLOB, or TEXT column types.

    Connectivityo Clients can connect to the MySQL server using TCP/IP

    sockets on any platform. On Windows systems in the NT

    family (NT, 2000, XP, or 2003), clients can connect using

    named pipes. On Unix systems, clients can connect using Unix

    domain socket files.

    o In MySQL versions 4.1 and higher, Windows servers alsosupport shared-memory connections if started with the --

    shared-memory option. Clients can connect through shared

    memory by using the --protocol=memory option.

    o The Connector/ODBC (MyODBC) interface provides MySQLsupport for client programs that use ODBC (Open Database

    Connectivity) connections. For example, you can use MS

    Access to connect to your MySQL server. Clients can be run

    on Windows or Unix. MyODBC source is available. All

    ODBC 2.5 functions are supported, as are many others. Seeo The Connector/J interface provides MySQL support for Java

    client programs that use JDBC connections. Clients can be run

    on Windows or Unix. Connector/J source is available.

  • 8/3/2019 Project report on proxy server

    39/80

  • 8/3/2019 Project report on proxy server

    40/80

    40

    6. SYSTEM REQUIREMENTS:

    Hardware Requirements

    Processor : Pentium IV 2GHz or above

    RAM : 2GB RAM or above

    Monitor : 15 Color Monitor

    Keyboard

    Mouse

    Software Requirements

    Operating System : Windows XP

    Front End :

    Language used : Java (Edition : J2SE)

    - Jdk : Java Development kit 1.6

    - Compiler : javac

    - Interpreter : java

    - Debugger : jdb

    - Developing Tool/IDE : NetBeans IDE 6.5

  • 8/3/2019 Project report on proxy server

    41/80

    41

    BackEnd :

    Database System : MySQL5.0.9-beta

    Other Requirements:

    Internet Connectivity.

  • 8/3/2019 Project report on proxy server

    42/80

    42

    7. ADVANTAGES

    Advantages of this proxy server are as follows:

    1. Caching:

    If it happens that the remote server/web server from where you are

    requesting any data has filtered out your IpAddress in that scenario you

    cannot access that particular data but if you had accessed that data before

    through a proxy then there are chances that the proxy server must havestored that data in it which is called cache, it can be accessed now if you

    connect through the proxy server.

    2. Filtering Requests:

    -

    A proxy server is a benefit for administration, because the networkadministrator can filter and a manage Internet usage from one

    machine. All users access the Internet from the proxy server, so

    network administrators can block certain pages and limit the amount

    of accessible websites. This type of filtering is usually done by large

    businesses that need to limit websites either individually or through

    categories. For instance, some proxy server software blocks whole

    categories such as entertainment, social networking or gaming sites.

    - Proxies are also used for bypassing blocked sites in schools, officeand also access parental blocked data.

  • 8/3/2019 Project report on proxy server

    43/80

  • 8/3/2019 Project report on proxy server

    44/80

    44

    8. FUTURE ENHANCEMENT

    Scope of future improvement in this project is :

    Caching part can be further improved as speed becomes slower onopening of subsequent pages.

    Complex images can be retrirved.

    It can be improved to block selected users.

    Request log part can be added to it.

  • 8/3/2019 Project report on proxy server

    45/80

    45

    9. SYSTEM REQUIREMENT

    SPECIFICATION

    9.1 PURPOSEA network is any collection of independent computers that

    communicate with one another over a shared network medium. A

    computer network is a collection of two or more connected computers.

    When these computers are joined in a network, people can share files and

    peripherals such as modems, printers, tape backup drives, or CD-ROMdrives. When networks at multiple locations are connected using services

    available from phone companies, people can send e-mail, share links to the

    global Internet, or conduct video conferences in real time with other

    remote users. As companies rely on applications like electronic mail and

    database management for core business operations, computer networking

    becomes increasingly more important.

    But, as said a coin has two sides. Network has may disadvantages

    with security and speed being the primary concerns. Using a proxy servercan reduce many problems. Now let us see what proxy server is.

    A proxy server is a computer that offers a computer network service to

    allow clients to make indirect network connections to other network

    services. A client connects to the proxy server, then requests a connection,

    file, or other resource available on a different server. The proxy providesthe resource either by connecting to the specified server or by serving it

    from a cache. In some cases, the proxy may alter the client's request or the

    server's response for various purposes.

  • 8/3/2019 Project report on proxy server

    46/80

    46

    HTTP Proxy Server:

    Middlemen" between clients and servers Proxies which process http and (not always) ftp requests are

    known as http proxy servers

    Key features of HTTP Proxy servers:

    It Provides Anonymity and Security.

    It is a Caching Proxy server. Serves as content filter. Multithreading.

    9.2 SCOPE We designed and implemented a caching proxy server that handles

    HTTP traffic. It can be included into many programs: browsers,

    download managers etc. However, its support is not realized at a

    level of an operating systemin order to use it, you should

    configure all programs, which should use proxies, in an appropriate

    way. It can carry out caching of information downloaded from theInternet.

    The application is implemented in Java, and as such it benefits fromcross-platform portability.

  • 8/3/2019 Project report on proxy server

    47/80

    47

    9.3 DEFINITION, ACRONYMS & ABREVIATIONS

    JDesktopPane:A container used to create a multiple-document interface or a virtual

    desktop. You create JInternalFrame objects and add them to the

    JDesktopPane.

    Virtual desktop:-Virtual desktop can be created using JDesktopPane and JInternalFrame.

    -JDesktopPane works as parent and JInternalFrame works as child.

    JPanel: It acts as a cover to the container. Reusability highlyincreases if we use Panel as a base.

    CardLayout:- Multiple cards(JPanel) can be added to Card Layout.

    - Each card added to the Card Layout should be JPanel or its

    derived class

    - Only one card is visible at a time.

    -Navigation options like first,next,previous and last can be

    added.

    -CardLayout is used to create wizards.

  • 8/3/2019 Project report on proxy server

    48/80

    48

    JWindow:-It is very similar to JFrame but it does not have min ,max or

    close buttons.

    -It does not have borders,titlebar amn menubar.

    -It is used to create SplashScreen

    JInternalFrame :A lightweight object that provides many of the features of a native

    frame, including dragging, closing, becoming an icon, resizing, title

    display, and support for a menu bar

  • 8/3/2019 Project report on proxy server

    49/80

    49

    9.4 OVERALL DESCRIPTION

    PRODUCT PERSPECTIVE

    Our project is designed to implement the basic functionalities of a

    proxy server. Though our product i.e. proxy server may not address all the

    functions, it simply provides a clear picture of how a proxy is working.

    This project stresses on caching. Caching has a lot of benefits. Caching is

    analogous to the mechanism used by a cache memory in memory

    hierarchy. When we talk of cache memory, it stores all the instructions

    which may be immediately needed by the processor. Hence, the processor

    first searches the instruction in the cache memory. It helps in improving

    the speed. Caching, in proxy server is similar to the above mechanism.

    PRODUCT FUNCTIONS

    The project performs the following functions:

    a) It acts as an intermediary between a network and a client. Thisfeature is very important for security purpose. It hides the clients IP

    address in the vast network. Hence, the system becomes secure.

    b)It performs the caching of websites. If the requested URL is stored inthe cache, then the response is delivered via cache otherwise from

    the main server.

    c) It performs the basic URL blocking. But, it is not capable ofperforming this functionality selectively. It blocks the URL for all

    clients using the proxy.

  • 8/3/2019 Project report on proxy server

    50/80

    50

    USER CHARACTERISTICSSOFTWARE DEVELOPERS: The developers are expected to have a

    thorough knowledge of:

    a) The language in which the application is to be designed.b)Concepts of computer networking.c) Network programming in java.d)Data flow in the system

    CLIENTS: Clients just need to be able to use the product

    9.5 GENERAL CONSTRAINTS

    The functionalities which our project does not provide are:

    1)It does not provide efficient caching.2)It is not able to perform selective client blocking.3)It cannot track the Internet usage for each user.4)It does not provide specific packet filtering through ports

  • 8/3/2019 Project report on proxy server

    51/80

    51

    9.6FUNCTIONAL REQUIREMENTS

    The functional requirements of this project include

    (1) GET, HEAD commands. The GET is the mostly used command in

    HTTP, carrying out the actual fetching of the content. Your program

    will need to parse a command line like, GET http://www.test.com/test.html

    HTTP/1.1, from clients and then make a TCP connection to the target web

    server to get the requested page. The HEAD is similar to the GET except

    that only

    meta information, rather than a complete message-body (ex: the page), is

    returned.

    (2) Support of theIf-Modified-Since conditional request. This header field

    in an HTTP request is typically used to examine whether the content

    stored in the proxy server is still valid. If not, the server fetches again the

    content from the origin site, forwards it to the client, and replaces the

    existing expired one.

    9.7NON FUNCTIONAL REQUIREMENTS

    EXECUTION QUALITIES:

    1)This project performs the caching of web sites which improves thespeed .

    2)This project performs the basic URL blocking procedure.3)It act as an intermediary between a network and a client.

    http://www.test.com/test.html%20HTTP/1.1http://www.test.com/test.html%20HTTP/1.1http://www.test.com/test.html%20HTTP/1.1http://www.test.com/test.html%20HTTP/1.1
  • 8/3/2019 Project report on proxy server

    52/80

    52

    EVOLUTION QUALITIES:

    This project has been designed with the help of Net Beans hence it is

    scalable and flexible. It can easily handle all future changes like

    addition of extra functionality. It is also easy to maintain, with all the

    source code and class file in one folder implicitly. this is in contrast to

    notepad programming, where we have to explicitly store all source

    code.

  • 8/3/2019 Project report on proxy server

    53/80

    53

    9.8 USER INTERFACE

    Our project uses virtual desktop concept in java.

    What is a virtual desktop?

    Virtual desktop can be created using JDesktopPane and JInternalFrame.

    JDesktopPane works as parent and JInternalFrame works as child.

    Steps to create Virtual Desktop:

    1)Create JFrame.2)Create JDesktopPane and add it to JFrame.3)Create multiple instances of JIntaernalFrame and add it to

    JDesktopPane.

    4)Each JInternalFrame can be covered by a separate JPanel.

    The benefits ofdesktop virtualization include:

    Cost savings because resources can be shared and allocated on an as-needed basis.

    More efficient use of resources and energy. Improved data integrity because backup is centralized. Centralized administration. Fewer compatibility issues.

    http://searchvirtualdesktop.techtarget.com/sDefinition/0,,sid194_gci1315929,00.htmlhttp://searchvirtualdesktop.techtarget.com/sDefinition/0,,sid194_gci1315929,00.html
  • 8/3/2019 Project report on proxy server

    54/80

    54

    GUI Listing:

    SplashPanel1.java

    It opens a splash screen which displays the name of the project. A splash

    screen is an image that appears while a game or program is loading. It may

    also be used to describe an introduction page on a website. Splash screens

    sometimes do not cover the entire screen, but only a rectangle near the

    center. The splash screens ofoperating systems and some applications that

    expect to be run full-screen usually cover the entire screen.

    VirtualDesktop.java

    It opens a virtual desktop including a log-in page which allow only

    authenticated user to have access to the server. If user name and password

    is wrong, it shows an error message otherwise it opens a settings form.

    And it also includes settings for changing username and password

    JPanel3.java

    It opens up a form which allows to change the username

    JPanel4.java

    It opens up a form which allows to change the password

    http://en.wikipedia.org/wiki/Imagehttp://en.wikipedia.org/wiki/Websitehttp://en.wikipedia.org/wiki/Computer_screenhttp://en.wikipedia.org/wiki/Rectanglehttp://en.wikipedia.org/wiki/Operating_systemshttp://en.wikipedia.org/wiki/Operating_systemshttp://en.wikipedia.org/wiki/Rectanglehttp://en.wikipedia.org/wiki/Computer_screenhttp://en.wikipedia.org/wiki/Websitehttp://en.wikipedia.org/wiki/Image
  • 8/3/2019 Project report on proxy server

    55/80

    55

    JPanel5.java

    It consists of following elements:

    List: It displays the sites to be blocked Text Field: user can enter a site of his own choice to be blocked. Add Button: this adds the site given by the user to the list. Remove Button: user can select one or more sites in the list and

    clicking on this button removes the selected sites from the list.

    Continue Button: this is a confirmation button. After clicking thisbutton, List, Add and Remove button gets disabled. After this user

    cannot enter any sites. Finish Button: Starts the Mainclass.java (processing of software).

  • 8/3/2019 Project report on proxy server

    56/80

    56

    SplashPanel1.java

  • 8/3/2019 Project report on proxy server

    57/80

    57

    VirtualDesktop.java

  • 8/3/2019 Project report on proxy server

    58/80

    58

    JPanel5.java

  • 8/3/2019 Project report on proxy server

    59/80

    59

    JPanel4.java

  • 8/3/2019 Project report on proxy server

    60/80

    60

    JPanel3.java

  • 8/3/2019 Project report on proxy server

    61/80

    61

    10. PROGRAM LISTING

    Our project comprises of five classes. They are:

    1) MainClass.java

    2) Talker.java

    3) ProxyURLConnection.java

    4) SiteBlocker.java

    5) URLCache.java

    DESCRIPTION OF THE MODULES:

    MainClass.java

    The project is run through this class. Server Socket, Socket and

    SERVER_PORT are initialized. Connection is established through

    serverSocket.accept(). It also starts the Talker thread.

    Talker.java

    This class listens to the multiple clients connecting to the server. It takes

    the input from the browsers address barthrough BufferedReader and

    prints the request and various headers associated with the request. It also

    checks to see if the request contains the URL which we intend to block. If

    it contains the blocked URL, it calls the method siteBlocker() from the

  • 8/3/2019 Project report on proxy server

    62/80

    62

    SiteBlocker class otherwise it calls method getConnection() from the

    ProxyURLConnection class.

    ProxyURLConnection.java

    This class creates the constructor of URL class. It fetches the data

    associated with the URL given in the address bar. It calls the get() method

    from the URLCache class with parameters as url and browsers output

    stream.

    SiteBlocker.java

    This class contains the method siteBlocker() which gives the desired

    action to take if the clients request for a blocked site.

    URLCache.java

    This class defines a simple caching mechanism used by the proxy server.

    If it happens that the remote server/web server from where you are

    requesting any data has filtered out your IP Address in that scenario you

    cannot access that particular data but if you had accessed that data before

    through a proxy then there are chances that the proxy server must have

    stored that data in it which is called cache, it can be accessed now if you

    connect through the proxy server.

    Our project does not effectively implement caching. It uses a HashMap to

    store pairs of URL and content accessed by the clients. After every request

    made, this class first checks if the URL is present in the HashMap, if it is

    then it delivers the response from the cache. If not then, it delivers the

    response from the server.

  • 8/3/2019 Project report on proxy server

    63/80

    63

    11. CODING

    1. MainClass.java

    package myproxy;

    import java.net.ServerSocket;

    import java.net.Socket;

    import java.util.Set;

    public class MainClass {

    public void startMain() {

    ServerSocket serverSocket = null;

    Socket socket = null;

    final int SERVER_PORT = 9867;

    try {

    serverSocket = new ServerSocket(SERVER_PORT);

    while (true) {

    socket = serverSocket.accept();

    Talker tk = new Talker(socket);

    tk.start();

    }

  • 8/3/2019 Project report on proxy server

    64/80

    64

    } catch (Exception e1) {

    e1.printStackTrace();

    }

    }

    }

  • 8/3/2019 Project report on proxy server

    65/80

    65

    2. Talker.java

    package myproxy;

    import java.io.BufferedReader;

    import java.io.InputStreamReader;

    import java.io.PrintWriter;

    import java.net.Socket;

    public class Talker extends Thread {

    BufferedReader input = null;

    PrintWriter output = null;

    String bSites;

    public Talker() {

    }

    public Talker(Socket socket, String str3) {

    try {

  • 8/3/2019 Project report on proxy server

    66/80

    66

    input = new BufferedReader(new

    InputStreamReader(socket.getInputStream()));

    output = new PrintWriter(socket.getOutputStream(), true);

    bSites = str3;

    } catch (Exception e1) {

    e1.printStackTrace();

    }

    }

    @Override

    public void run() {

    String file = new String();

    ProxyURLClassConnection p = new ProxyURLClassConnection();

    while (true) {

    try {

    String str = input.readLine();

    if (str.indexOf("GET") != -1) {

    file = new String();

    int x = str.indexOf(" ");

    int y = str.lastIndexOf(" ");

    file = str.substring(x + 1, y);

    }

    System.out.println(str);

    System.out.println("FILE : " + file);

  • 8/3/2019 Project report on proxy server

    67/80

    67

    int x1 = file.indexOf(".");

    int y1 = file.lastIndexOf(".");

    String site = file.substring(x1 + 1, y1);

    if (bSites.indexOf(site) != -1) {

    SiteBlocker.siteBlocker(output);

    } else {

    p.getConnection(file, output);

    }

    } catch (Exception e2) {

    e2.printStackTrace();

    System.out.println("Problem with Talker");

    }

    output.close();

    }

    }

    }

  • 8/3/2019 Project report on proxy server

    68/80

    68

    3. SiteBlocker.java

    package myproxy;

    import java.io.PrintWriter;

    public class SiteBlocker {

    public static void siteBlocker( PrintWriter output,String file) {

    {

    output.checkError();

    output.write("Cannot Display........");

    }

    output.close();

    }

    }

  • 8/3/2019 Project report on proxy server

    69/80

    69

    4. ProxyURLClassConnection.java

    package myproxy;

    import java.io.*;

    import java.io.InputStream;

    import java.io.IOException;

    import java.io.InputStream;

    import java.net.MalformedURLException;

    import java.net.URL;

    import java.net.URLConnection;

    import java.io.PrintWriter;

    public class ProxyURLClassConnection {

    public void getConnection(String s,PrintWriter output) throws

    MalformedURLException, IOException {

    URL url = new URL(s);

    URLConnection urlConnection = url.openConnection();

    InputStream input = urlConnection.getInputStream();

    URLCache u=new URLCache();

    u.get(url,output);

  • 8/3/2019 Project report on proxy server

    70/80

    70

    }

    output.close();

    input.close();

    }

    }

  • 8/3/2019 Project report on proxy server

    71/80

    71

    5. Splash1.java

    import javax.swing.*;

    import java.awt.*;

    public class Splash1 {

    public static void main(String[] args) {

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

    int x = (screen.width-400)/2;

    int y = (screen.height-300)/2;

    JWindow win = new JWindow();

    SplashPanel1 s = new SplashPanel1();

    win.setContentPane(s);

    win.setBounds(x,y,400,300);

    win.setVisible(true);

    try {

    for(int i=1;i

  • 8/3/2019 Project report on proxy server

    72/80

    72

    }

    } catch(Exception e) {}

    win.setVisible(false);

    VirtualDesktop m = new VirtualDesktop();

    m.setBounds(0,0,screen.width,screen.height);

    m.setVisible(true);

    }

    }

  • 8/3/2019 Project report on proxy server

    73/80

    73

    6. SplashPanel1.java

    public class SplashPanel1 extends javax.swing.JPanel {

    public SplashPanel1() {

    initComponents();

    }

    public void abc(int a) {

    jProgressBar1.setValue(a);

    }

    private void initComponents() {

    jProgressBar1 = new javax.swing.JProgressBar();

    jLabel1 = new javax.swing.JLabel();

    setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(255, 153, 0), null,

    null));

    setLayout(new java.awt.BorderLayout());

    jProgressBar1.setBackground(new java.awt.Color(255, 153, 0));

    jProgressBar1.setForeground(new java.awt.Color(255, 255, 255));

  • 8/3/2019 Project report on proxy server

    74/80

    74

    add(jProgressBar1, java.awt.BorderLayout.PAGE_END);

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

    jLabel1.setIcon(new

    javax.swing.ImageIcon(getClass().getResource("/images/myproxy.jpg")));

    jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER

    );

    add(jLabel1, java.awt.BorderLayout.CENTER);

    }

    private javax.swing.JLabel jLabel1;

    private javax.swing.JProgressBar jProgressBar1;

  • 8/3/2019 Project report on proxy server

    75/80

  • 8/3/2019 Project report on proxy server

    76/80

    76

    13. LIMITATIONS

    One of the limitations is that you may have some issues withspeed. Caching becomes a bit slower in case of opening of

    subsequent pages.

    It is not being able to retrieve complex images.

  • 8/3/2019 Project report on proxy server

    77/80

    77

    14. CONCLUSION

    This project is designed to act as a http proxy server. It includes the

    following:

    A robust caching mechanism, that is optimized to minimize the timethat end users wait for documents to load by giving preference to

    documents that must be loaded over the slowest Internet links, that

    are from servers that take long time to connect to, that have been

    referenced more frequently, and that are small.

    Multithreading, to allow concurrent handling of several HTTPrequests. Great care has been given to concurrency control, to ensure

    mutual exclusion between threads where needed and to avoid

    deadlocks.

    Customization of the proxy is done via the graphical interface.

    This project include feature of filtering of sites.

  • 8/3/2019 Project report on proxy server

    78/80

    78

    15. USER MANUAL

    Proxy Settings in Internet Explorer 5.X 8.x :

    1. Open Internet Explorer.2. In Menu Bar go to ToolInternet Options.3. In Internet Options Window- go to Connections Menu within LAN Settings

    - click on LAN Settings button.

    4. In LAN Settings Window- Within Proxy Server checkmark the checkbox in front

    of Use a Proxy Server for your LAN

    -Specify your Systems IPAddress, it will behave as

    proxy server

    -Specify port number as 9867

    -Click on OK

    Starting Proxy Server Software:

    1. Run the Proxy.jar which starts Proxy server software

    2. For login page default username and password is aks .

  • 8/3/2019 Project report on proxy server

    79/80

    79

    16. BIBLIOGRAPHY

    Complete reference java(J2SE)Herbert Schildt Thinking in java- Bruce Eckel computer networking by Behrouz Forouzan Proxy Server by Kurt Hudson www.wikipedia .com www.FreeProxy.ru http://www.freeproxy.info www.amazon.co.uk

    http://www.amazon.co.uk/exec/obidos/ASIN/1583040382/ref=nosim/forlagetadlandiahttp://www.freeproxy.ru/http://www.amazon.co.uk/http://www.amazon.co.uk/http://www.freeproxy.ru/http://www.amazon.co.uk/exec/obidos/ASIN/1583040382/ref=nosim/forlagetadlandia
  • 8/3/2019 Project report on proxy server

    80/80