--- /dev/null
+// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
+// Jad home page: http://www.kpdus.com/jad.html
+// Decompiler options: packimports(3) fieldsfirst nonlb space
+
+package mcsClient;
+
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
+import java.awt.*;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.StringTokenizer;
+import javax.swing.*;
+
+// Referenced classes of package mcsClient:
+// McsTargetSize, McsVersion, LockingKeyStateManager, McsTcpConnection,
+// LiveVideoPanel, McsKeyAdapter, McsMouseAdapter, McsMouseMotionAdapter,
+// DatagramReader, McsToolBar, MessageReader, KeepAlive
+
+public class McsClient extends JApplet {
+
+ private static final int FIXED_SIZE = 1;
+ private static final int FULL_SCREEN = 2;
+ private static final int SCROLL_SCREEN = 3;
+ private static final int DEFAULT_REMOTE_PORT = 2000;
+ private static final Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
+ private static final Dimension maxTargetSize = new Dimension(1024, 768);
+ private static int screenWidth;
+ private static int screenHeight;
+ private McsTargetSize mcsTargetSize;
+ private LinkedList datagramList;
+ private McsVersion mcsVersion;
+ private LockingKeyStateManager lockingKeyStateManager;
+ private McsTcpConnection mcsTcpConnection;
+ private McsKeyAdapter mcsKeyAdapter;
+ private LiveVideoPanel liveVideoPanel;
+ private McsMouseAdapter mcsMouseAdapter;
+ private McsMouseMotionAdapter mcsMouseMotionAdapter;
+ private DatagramReader datagramReader;
+ private MessageReader messageReader;
+ private KeepAlive keepAlive;
+ private boolean isStandalone;
+ private ThreadGroup threadGroup;
+ private static final String START = "Show Remote Console";
+ private static final String STOP = "Hide Remote Console";
+ private JButton button;
+ private static final boolean TCP = false;
+ private boolean blueScreenDump;
+ private boolean encryptVideo;
+
+ public McsClient() {
+ mcsTargetSize = new McsTargetSize(1024, 768);
+ datagramList = new LinkedList();
+ mcsVersion = new McsVersion();
+ lockingKeyStateManager = new LockingKeyStateManager();
+ isStandalone = true;
+ blueScreenDump = false;
+ encryptVideo = false;
+ }
+
+ public void init() {
+ try {
+ UIManager.setLookAndFeel(new WindowsLookAndFeel());
+ }
+ catch (Exception exception) { }
+ System.out.println("MCS v.3.6 initialized");
+ isStandalone = false;
+ String s = getParameter("host");
+ if (s == null)
+ s = getCodeBase().getHost();
+ String s1 = s;
+ String s2 = getParameter("bluescreen");
+ if (s2 != null && s2.equalsIgnoreCase("true"))
+ blueScreenDump = true;
+ String s3 = getParameter("userid");
+ if (s3 == null)
+ s3 = "";
+ String s4 = s3;
+ String s5 = getParameter("enc");
+ if (s5 != null && s5.equalsIgnoreCase("on"))
+ encryptVideo = true;
+ String s6 = getParameter("ac");
+ if (s6 == null)
+ s6 = "";
+ String s7 = s6;
+ getContentPane().setBackground(Color.WHITE);
+ begin(s1, s4, s7, false);
+ }
+
+ public void stop() {
+ System.out.println("Stopping applet");
+ if (threadGroup != null)
+ threadGroup.interrupt();
+ if (mcsTcpConnection != null) {
+ mcsTcpConnection.close();
+ mcsTcpConnection = null;
+ }
+ }
+
+ public void begin(String s, String s1, String s2, boolean flag) {
+ int i = 2000;
+ StringTokenizer stringtokenizer = new StringTokenizer(s, ":");
+ String s3 = stringtokenizer.nextToken();
+ if (stringtokenizer.hasMoreTokens())
+ try {
+ i = Integer.parseInt(stringtokenizer.nextToken());
+ }
+ catch (NumberFormatException numberformatexception) {
+ i = 2000;
+ }
+ mcsTcpConnection = new McsTcpConnection(s3, i, encryptVideo, s2);
+ if (!mcsTcpConnection.connected()) {
+ if (isStandalone)
+ System.exit(0);
+ stop();
+ return;
+ }
+ sendUsernameToServer(s1, s2);
+ liveVideoPanel = new LiveVideoPanel(mcsTcpConnection, datagramList, mcsTargetSize, lockingKeyStateManager);
+ mcsKeyAdapter = new McsKeyAdapter(mcsTcpConnection, lockingKeyStateManager);
+ mcsMouseAdapter = new McsMouseAdapter(mcsTcpConnection, liveVideoPanel);
+ mcsMouseMotionAdapter = new McsMouseMotionAdapter(mcsTcpConnection, mcsKeyAdapter);
+ if (!blueScreenDump) {
+ liveVideoPanel.addMouseListener(mcsMouseAdapter);
+ liveVideoPanel.addMouseMotionListener(mcsMouseMotionAdapter);
+ liveVideoPanel.addKeyListener(mcsKeyAdapter);
+ liveVideoPanel.addMouseWheelListener(mcsMouseAdapter);
+ }
+ liveVideoPanel.setPreferredSize(maxTargetSize);
+ liveVideoPanel.setFocusTraversalKeysEnabled(false);
+ datagramReader = new DatagramReader(mcsTcpConnection, liveVideoPanel, datagramList, s3, i, flag);
+ if (!blueScreenDump) {
+ McsToolBar mcstoolbar = new McsToolBar(mcsKeyAdapter, liveVideoPanel);
+ mcstoolbar.setFloatable(false);
+ mcstoolbar.setVisible(false);
+ McsToolBar mcstoolbar1 = new McsToolBar(s3, mcsKeyAdapter, liveVideoPanel, datagramReader, mcstoolbar);
+ getContentPane().add(mcstoolbar1, "North");
+ getContentPane().add(mcstoolbar, "West");
+ }
+ getContentPane().add(liveVideoPanel);
+ liveVideoPanel.requestFocusInWindow();
+ if (!datagramReader.initialized()) {
+ if (isStandalone)
+ System.exit(0);
+ stop();
+ return;
+ }
+ messageReader = new MessageReader(mcsTcpConnection, mcsVersion, lockingKeyStateManager);
+ keepAlive = new KeepAlive(mcsTcpConnection, blueScreenDump);
+ threadGroup = new ThreadGroup("MCS Threads");
+ threadGroup.setDaemon(true);
+ (new Thread(threadGroup, liveVideoPanel, "liveVideoPanel thread")).start();
+ Thread thread = new Thread(threadGroup, datagramReader, "datagramReader thread");
+ thread.setPriority(thread.getPriority() + 2);
+ thread.start();
+ Thread thread1 = new Thread(threadGroup, messageReader, "messageReader thread");
+ if (flag)
+ thread1.setPriority(thread1.getPriority() + 2);
+ thread1.start();
+ Thread thread2 = new Thread(threadGroup, keepAlive, "keepAlive thread");
+ thread2.setPriority(thread2.getPriority() + 2);
+ thread2.start();
+ sendVersionToServer();
+ System.out.println("Command KVM Server to start sending images");
+ sendStartSendingToServer(mcsTcpConnection.getDetectedPPP());
+ }
+
+ private void sendUsernameToServer(String s, String s1) {
+ if (s1 == null)
+ s1 = "";
+ char ac[] = (s + ":" + s1).toCharArray();
+ int ai[] = new int[2 + ac.length];
+ ai[0] = ai.length * 4;
+ ai[1] = 11;
+ for (int i = 0; i < ac.length; i++)
+ ai[2 + i] = ac[i];
+
+ try {
+ mcsTcpConnection.sendMessage(ai);
+ }
+ catch (IOException ioexception) {
+ System.err.println("Could not send user name.");
+ stop();
+ }
+ }
+
+ private void sendVersionToServer() {
+ int ai[] = new int[4];
+ ai[0] = ai.length * 4;
+ ai[1] = 13;
+ ai[2] = mcsVersion.getClientMajorRev();
+ ai[3] = mcsVersion.getClientMinorRev();
+ try {
+ mcsTcpConnection.sendMessage(ai);
+ }
+ catch (IOException ioexception) {
+ System.err.println("Could not send version.");
+ stop();
+ }
+ }
+
+ private void sendStartSendingToServer(boolean flag) {
+ int ai[] = new int[3];
+ ai[0] = ai.length * 4;
+ if (blueScreenDump)
+ ai[1] = 24;
+ else
+ if (!flag)
+ ai[1] = 0;
+ else
+ ai[1] = 1;
+ ai[2] = 0;
+ try {
+ mcsTcpConnection.sendMessage(ai);
+ }
+ catch (IOException ioexception) {
+ System.err.println("Could not send start sending to server.");
+ stop();
+ }
+ }
+
+ public boolean isVideoEncrypted() {
+ return encryptVideo;
+ }
+
+}