// Path: src/nb/barmie/exceptions/BaRMIeIllegalArgumentException.java
// public class BaRMIeIllegalArgumentException extends BaRMIeException {
// 	public BaRMIeIllegalArgumentException(String message) {
// 		super(message);
// 	}
// 	
// 	public BaRMIeIllegalArgumentException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: src/nb/barmie/exceptions/BaRMIeInvalidPortException.java
// public class BaRMIeInvalidPortException extends BaRMIeException {
// 	public BaRMIeInvalidPortException(int portNumber) {
// 		super("The given port number (" + portNumber + ") is not a valid TCP port number.");
// 	}
// }
// 
// Path: src/nb/barmie/net/TCPEndpoint.java
// public class TCPEndpoint {
// 	/*******************
// 	 * Properties
// 	 ******************/
// 	private final String _host;
// 	private final int _port;
// 	
// 	/*******************
// 	 * Construct the TCP endpoint object with a given host and port.
// 	 * 
// 	 * @param host The host/IP to use.
// 	 * @param port The port to use.
// 	 * @throws nb.barmie.exceptions.BaRMIeInvalidPortException If the given port number is not a valid TCP port number.
// 	 ******************/
// 	public TCPEndpoint(String host, int port) throws BaRMIeInvalidPortException {
// 		//Store the properties
// 		this._host = host;
// 		this._port = port;
// 		
// 		//Validate the port number
// 		if(this._port < 1 || this._port > 65535) {
// 			throw new BaRMIeInvalidPortException(this._port);
// 		}
// 	}
// 	
// 	/*******************
// 	 * Return a string representation of this endpoint.
// 	 * 
// 	 * @return A host:port string.
// 	 ******************/
// 	public String toString() {
// 		return this._host + ":" + this._port;
// 	}
// 	
// 	/*******************
// 	 * Getters
// 	 ******************/
// 	public String getHost() { return this._host; }
// 	public int getPort() { return this._port; }
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import nb.barmie.exceptions.BaRMIeIllegalArgumentException;
import nb.barmie.exceptions.BaRMIeInvalidPortException;
import nb.barmie.net.TCPEndpoint;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
		this._socketTimeout = this.DEFAULT_SOCKTIMEOUT;
	}
	
	/*******************
	 * Parse the command line arguments, validating along the way.
	 * 
	 * @param args The strings passed to the program on the command line.
	 ******************/
	private void parseCommandLineArgs(String[] args) throws BaRMIeIllegalArgumentException, BaRMIeInvalidPortException {
		LinkedList<String> argQueue = new LinkedList<String>(Arrays.asList(args));
		String targetHost;
		String opt;
		String val;
		int targetPort;
		
		//If the first parameter is "-enum" or "-attack" then set the mode
		if(argQueue.peekFirst().toLowerCase().equals("-enum") || argQueue.peekFirst().toLowerCase().equals("-attack")) {
			this._mode = argQueue.pop().toLowerCase();
		}
		
		//Handle options (all begin with '--')
		while(argQueue.size() > 0 && argQueue.peekFirst().startsWith("--")) {
			//Pop the option and value off of the argument queue
			opt = argQueue.pop().toLowerCase();
			val = argQueue.pop();
			
			//Handle the option
			switch(opt) {
				case "--threads":
					//Unsupported in attack mode
// Path: src/nb/barmie/exceptions/BaRMIeIllegalArgumentException.java
// public class BaRMIeIllegalArgumentException extends BaRMIeException {
// 	public BaRMIeIllegalArgumentException(String message) {
// 		super(message);
// 	}
// 	
// 	public BaRMIeIllegalArgumentException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: src/nb/barmie/exceptions/BaRMIeInvalidPortException.java
// public class BaRMIeInvalidPortException extends BaRMIeException {
// 	public BaRMIeInvalidPortException(int portNumber) {
// 		super("The given port number (" + portNumber + ") is not a valid TCP port number.");
// 	}
// }
// 
// Path: src/nb/barmie/net/TCPEndpoint.java
// public class TCPEndpoint {
// 	/*******************
// 	 * Properties
// 	 ******************/
// 	private final String _host;
// 	private final int _port;
// 	
// 	/*******************
// 	 * Construct the TCP endpoint object with a given host and port.
// 	 * 
// 	 * @param host The host/IP to use.
// 	 * @param port The port to use.
// 	 * @throws nb.barmie.exceptions.BaRMIeInvalidPortException If the given port number is not a valid TCP port number.
// 	 ******************/
// 	public TCPEndpoint(String host, int port) throws BaRMIeInvalidPortException {
// 		//Store the properties
// 		this._host = host;
// 		this._port = port;
// 		
// 		//Validate the port number
// 		if(this._port < 1 || this._port > 65535) {
// 			throw new BaRMIeInvalidPortException(this._port);
// 		}
// 	}
// 	
// 	/*******************
// 	 * Return a string representation of this endpoint.
// 	 * 
// 	 * @return A host:port string.
// 	 ******************/
// 	public String toString() {
// 		return this._host + ":" + this._port;
// 	}
// 	
// 	/*******************
// 	 * Getters
// 	 ******************/
// 	public String getHost() { return this._host; }
// 	public int getPort() { return this._port; }
// }


// Path: src/nb/barmie/util/ProgramOptions.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import nb.barmie.exceptions.BaRMIeIllegalArgumentException;
import nb.barmie.exceptions.BaRMIeInvalidPortException;
import nb.barmie.net.TCPEndpoint;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

		this._socketTimeout = this.DEFAULT_SOCKTIMEOUT;
	}
	
	/*******************
	 * Parse the command line arguments, validating along the way.
	 * 
	 * @param args The strings passed to the program on the command line.
	 ******************/
	private void parseCommandLineArgs(String[] args) throws BaRMIeIllegalArgumentException, BaRMIeInvalidPortException {
		LinkedList<String> argQueue = new LinkedList<String>(Arrays.asList(args));
		String targetHost;
		String opt;
		String val;
		int targetPort;
		
		//If the first parameter is "-enum" or "-attack" then set the mode
		if(argQueue.peekFirst().toLowerCase().equals("-enum") || argQueue.peekFirst().toLowerCase().equals("-attack")) {
			this._mode = argQueue.pop().toLowerCase();
		}
		
		//Handle options (all begin with '--')
		while(argQueue.size() > 0 && argQueue.peekFirst().startsWith("--")) {
			//Pop the option and value off of the argument queue
			opt = argQueue.pop().toLowerCase();
			val = argQueue.pop();
			
			//Handle the option
			switch(opt) {
				case "--threads":
					//Unsupported in attack mode
					if(this._mode.equals("-attack")) {