Class SimpleContentFilter

java.lang.Object
  |
  +--SimpleContentFilter
All Implemented Interfaces:
ContentFilter

class SimpleContentFilter
extends java.lang.Object
implements ContentFilter

This class is a simple implementation of the ContentFilter interface. It looks for a set of strings in HTML pages sent from websites back to the user's browser. If any of those strings is found, it is substituted by another string that is drawn randomly from a set of "substitution strings" for that particular string.


Constructor Summary
protected SimpleContentFilter(java.lang.String filename)
          The constructor needs to know the filename of the file that contains the set of strings that should be substituted as well as the substitution strings themselves.
 
Method Summary
 java.lang.String filterHTTPHeaders(java.lang.String headers)
          The Impostor daemon calls this method in order to remove sensitive information from HTTP headers sent from websites to the user's browser.
 java.lang.String filterWebPageLine(java.lang.String string)
          The Impostor daemon calls this method in order to remove sensitive information from HTML pages sent from websites to the user's browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleContentFilter

protected SimpleContentFilter(java.lang.String filename)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
The constructor needs to know the filename of the file that contains the set of strings that should be substituted as well as the substitution strings themselves. A sample of the expected file format (ascii) is shown below.

John Smith:Donald Duck:Eric Cartman:Mickey Mouse
Dream Avenue 44:Wonderstreet 1:Honeypot Lane 68
882312858879:[number not shown]:00000000000:101010101010

The above example will cause this class to substitute the string John Smith with one of Donald Duck, Eric Cartman or Mickey Mouse, at random. Likewise for the strings Dream Avenue 44 and 882312858879.

Method Detail

filterWebPageLine

public java.lang.String filterWebPageLine(java.lang.String string)
Description copied from interface: ContentFilter
The Impostor daemon calls this method in order to remove sensitive information from HTML pages sent from websites to the user's browser. The method is called on a line-by-line basis.

Specified by:
filterWebPageLine in interface ContentFilter

filterHTTPHeaders

public java.lang.String filterHTTPHeaders(java.lang.String headers)
Description copied from interface: ContentFilter
The Impostor daemon calls this method in order to remove sensitive information from HTTP headers sent from websites to the user's browser.

Specified by:
filterHTTPHeaders in interface ContentFilter