Class Downloader

java.lang.Object
   |
   +----Downloader

public class Downloader
extends Object

NetRand Project

Software Engineering - CS536

University of Wisconsin - Milwaukee

Authors:


File: Downloader.java

Downloader calls the BinaryLinkExtractor to extract all the links to binary files in a given HTML document. After a list of binary file links is obtained, it places them on a stack. Each file on the stack is downloaded eight consecutive times. The time it takes to download the file is examined. If it is an even number, a 0 bit is recorded, otherwise a 1 bit is recorded. One byte of entropy is obtained from each binary file link.

Variable Index

 o binaryFileLinks
a stack to hold the binary file links

Constructor Index

 o Downloader()

Method Index

 o collectBinaryFileLinks(String)
collects all the binary file links for a HTML referenced by a given URL
 o doDownload(String)
calls getBinaryFile to perform the downloading of the binary file; downloads the binary file eight consecutive times; from these times it records a 0 bit if the download time was even, otherwise a 1 bit is recorded.
 o getBinaryFile(URL)
performs the actual downloading of the binary file
 o getEntropy(String)
calls the appropriate functions to extract the binary file links from the HTML file referenced by the given URL, perform the downloading and sending of the random bytes.

Variables

 o binaryFileLinks
 private Stack binaryFileLinks
a stack to hold the binary file links

Constructors

 o Downloader
 public Downloader()

Methods

 o getEntropy
 public void getEntropy(String urlString)
calls the appropriate functions to extract the binary file links from the HTML file referenced by the given URL, perform the downloading and sending of the random bytes.

Parameters:
urlString - - the URL to reference the target HTML file
 o collectBinaryFileLinks
 private void collectBinaryFileLinks(String urlString) throws Exception
collects all the binary file links for a HTML referenced by a given URL

Parameters:
urlString - - the target URL
Throws: Exception
is thrown if the given URL cannot be accessed
 o doDownload
 private void doDownload(String urlString)
calls getBinaryFile to perform the downloading of the binary file; downloads the binary file eight consecutive times; from these times it records a 0 bit if the download time was even, otherwise a 1 bit is recorded. It uses the BitSender class to send the random byte to the server

Parameters:
urlString - - the target binary file
 o getBinaryFile
 public long getBinaryFile(URL target)
performs the actual downloading of the binary file

Parameters:
target - - the target URL to download
Returns:
the download time is milliseconds