	protected void processCommand(Command c) {
		Map response = null, read = null;
		long start;
		long maxwait = 10000;
		try {
			emptyRead();
			response = (Map)connection.execute("session.meterpreter_write", new Object[] { session, Base64.encode(c.text) });
			if (c.text.startsWith("cd "))
				return;
			if (c.text.startsWith("rm "))
				return;
			if (c.text.equals("shell\n") || c.text.equals("exit\n"))
				return;
			read = readResponse();
			start = System.currentTimeMillis();
			while ("".equals(read.get("data")) || read.get("data").toString().startsWith("[-] Error running command read")) {
				if ((System.currentTimeMillis() - start) > maxwait) {
					return;
				}
				Thread.sleep(100);
				read = readResponse();
			}
			fireEvent(c, read);
			Thread.sleep(50);
			read = readResponse();
			while (!"".equals(read.get("data"))) {
				fireEvent(c, read);
				read = readResponse();
			}
		}
		catch (Exception ex) {
			System.err.println(session + " -> " + c.text + " ( " + response + ")");
			ex.printStackTrace();
		}
	}

	protected void processCommand(Command c) {
		Map response = null, read = null;
		long start;
		long maxwait = 12000;
		try {
			emptyRead();
			response = (Map)connection.execute("session.meterpreter_write", new Object[] { session, Base64.encode(c.text) });
			if (c.text.startsWith("cd "))
				return;
			if (c.text.startsWith("rm "))
				return;
			if (c.text.equals("shell\n") || c.text.equals("exit\n"))
				return;
			read = readResponse();
			start = System.currentTimeMillis();
			while ("".equals(read.get("data")) || read.get("data").toString().startsWith("[-] Error running command read")) {
				if ((System.currentTimeMillis() - start) > maxwait) {
					System.err.println("(" + session + ") - '" + c.text + "' - timed out");
					return;
				}
				Thread.sleep(100);
				read = readResponse();
			}
			fireEvent(c, read);
			Thread.sleep(50);
			read = readResponse();
			while (!"".equals(read.get("data"))) {
				fireEvent(c, read);
				read = readResponse();
			}
		}
		catch (Exception ex) {
			System.err.println(session + " -> " + c.text + " ( " + response + ")");
			ex.printStackTrace();
		}
	}
