Exemple #1
0
        public static void decryptFile(string encryptedFilePath)
        {
            string str = Program.MakePath(encryptedFilePath, "");

            try
            {
                string      s1              = "";
                string      s2              = "";
                long        lOrgFileSize    = 0;
                string      stringFromBytes = Encipher.GetStringFromBytes(Encipher.GetHeaderBytesFromFile(encryptedFilePath));
                XmlDocument xmlDocument     = new XmlDocument();
                xmlDocument.LoadXml(stringFromBytes);
                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAA"))
                {
                    s1 = xmlNode.InnerText;
                }
                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AA"))
                {
                    s2 = xmlNode.InnerText;
                }
                foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAAAAAAAAAAAAAAAAA"))
                {
                    lOrgFileSize = Convert.ToInt64(xmlNode.InnerText);
                }
                byte[] key = Encipher.RSADescryptBytes(Convert.FromBase64String(s1), Program.privkey);
                byte[] iv  = Encipher.RSADescryptBytes(Convert.FromBase64String(s2), Program.privkey);
                Encipher.DecryptFile(encryptedFilePath, str, key, iv, lOrgFileSize);
            }
            catch (FormatException ex)
            {
                Console.WriteLine("\r\n[-] Decryption key is not correct -> " + encryptedFilePath + ex.Message);
                if (!File.Exists(str))
                {
                    return;
                }
                File.Delete(str);
            }
            catch (XmlException ex)
            {
                Console.WriteLine("\r\n[-] Encrypted data is not correct -> " + encryptedFilePath + ex.Message);
                if (!File.Exists(str))
                {
                    return;
                }
                File.Delete(str);
            }
        }
Exemple #2
0
 private static void Main(string[] args)
 {
     if (args.Length < 1)
     {
         Console.WriteLine("\r\n[+] Usage:\r\n\t" + Program.selfname + " private.keyxml\r\n");
     }
     else
     {
         if (args.Length == 1)
         {
             Console.WriteLine("\r\n====================================================================");
             Console.WriteLine("\r\n[+] Please be Patient, It May Take Several Minutes or Hours");
             Console.WriteLine("[+] Searching For Affected Files.\r\n[+] Please Wait.");
             Thread.Sleep(3000);
             try
             {
                 Program.privkey = File.ReadAllText(args[0]);
                 Program.go_to_dec();
                 Console.WriteLine("\r\n====================================================================\r\nTry");
                 Program.dec2(Program.bad_dec);
                 Program.mylist.Clear();
                 Program.delete_desktop_helps();
                 Console.WriteLine("\r\n[+] All File Decrypted.");
                 Thread.Sleep(3000);
             }
             catch
             {
             }
         }
         if (args.Length != 3)
         {
             return;
         }
         if (args[0] == "-f")
         {
             Program.privkey = File.ReadAllText(args[1]);
             Program.recursivegetfiles(args[2]);
             if (Program.mylist.Count > 0)
             {
                 try
                 {
                     Program.dec(Program.mylist);
                     // Program.dec(Program.mylist);
                     // Program.dec(Program.mylist);
                     Program.mylist.Clear();
                     Console.WriteLine("\r\n[+] All File Decrypted.");
                     Thread.Sleep(3000);
                 }
                 catch
                 {
                 }
             }
         }
         if (!(args[0] == "-k"))
         {
             return;
         }
         foreach (string file in Directory.GetFiles(args[2]))
         {
             Program.privkey = File.ReadAllText(file);
             try
             {
                 string      s1 = "";
                 string      s2 = "";
                 string      stringFromBytes = Encipher.GetStringFromBytes(Encipher.GetHeaderBytesFromFile(args[1]));
                 XmlDocument xmlDocument     = new XmlDocument();
                 xmlDocument.LoadXml(stringFromBytes);
                 foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAA"))
                 {
                     s1 = xmlNode.InnerText;
                 }
                 foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AA"))
                 {
                     s2 = xmlNode.InnerText;
                 }
                 foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAAAAAAAAAAAAAAAAA"))
                 {
                     Convert.ToInt64(xmlNode.InnerText);
                 }
                 byte[] numArray = Encipher.RSADescryptBytes(Convert.FromBase64String(s1), Program.privkey);
                 Encipher.RSADescryptBytes(Convert.FromBase64String(s2), Program.privkey);
                 if (numArray.Length != 0)
                 {
                     Console.WriteLine("\r\nCORRECT KEY IS:" + file);
                 }
             }
             catch
             {
             }
         }
     }
 }
Exemple #3
0
        //private static List<string> bad_dec = new List<string>();

        private static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("\r\n[+] Usage:\r\n\t" + Program.selfname + " private.keyxml\r\n");
            }
            else
            {
                if (args.Length == 1)
                {
                    Thread.Sleep(3000);
                    try {
                        Program.privkey = File.ReadAllText(args[0]);
                        foreach (DriveInfo drive in DriveInfo.GetDrives())
                        {
                            try {
                                if (drive.IsReady)
                                {
                                    Program.recursivegetfiles(drive.Name);
                                }
                            } catch { }
                        }
                        Console.WriteLine("\r\n[+] All File Decrypted.");
                        Thread.Sleep(3000);
                    } catch { }
                }
                if (args.Length != 3)
                {
                    return;
                }
                if (args[0] == "-f")
                {
                    Program.privkey = File.ReadAllText(args[1]);
                    Program.recursivegetfiles(args[2]);

                    Console.WriteLine("\r\n[+] All File Decrypted.");
                    Thread.Sleep(3000);
                }
                if (!(args[0] == "-k"))
                {
                    return;
                }
                foreach (string file in Directory.GetFiles(args[2]))
                {
                    Program.privkey = File.ReadAllText(file);
                    try {
                        string      s1 = "";
                        string      s2 = "";
                        string      stringFromBytes = Encipher.GetStringFromBytes(Encipher.GetHeaderBytesFromFile(args[1]));
                        XmlDocument xmlDocument     = new XmlDocument();
                        xmlDocument.LoadXml(stringFromBytes);
                        foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAA"))
                        {
                            s1 = xmlNode.InnerText;
                        }
                        foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AA"))
                        {
                            s2 = xmlNode.InnerText;
                        }
                        foreach (XmlNode xmlNode in xmlDocument.GetElementsByTagName("AAAAAAAAAAAAAAAAAA"))
                        {
                            Convert.ToInt64(xmlNode.InnerText);
                        }
                        byte[] numArray = Encipher.RSADescryptBytes(Convert.FromBase64String(s1), Program.privkey);
                        Encipher.RSADescryptBytes(Convert.FromBase64String(s2), Program.privkey);
                        if (numArray.Length != 0)
                        {
                            Console.WriteLine("\r\nCORRECT KEY IS:" + file);
                        }
                    } catch { }
                }
            }
        }