コード例 #1
0
ファイル: Program.cs プロジェクト: ntedgi/AES
        private static void runIt(string[] args)
        {
            AES aes = new AES();

            if (args[2] == "-e")
            {
                aes.Encrypte(args[6], args[8], args[4], args[2]);
            }
            else if (args[2] == "-d")
            {
                aes.Encrypte(args[6], args[8], args[4], args[2]);
            }
            else if (args[2] == "-b")
            {
                HackTool hakingTool = new HackTool();

                if (args[1] == "AES1")
                {
                    hakingTool.HackProcAes1(args[6], args[8], args[4]);
                }
                else
                {
                    hakingTool.HackProcAes3(args[6], args[8], args[4]);
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ntedgi/AES
        //Hacking TOOL Tests
        private static int testUnit9()
        {
            AES      a = new AES();
            HackTool h = new HackTool();

            string Key      = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\key_AES_3";
            string fileName = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\1.jpg";
            string outpot   = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\NewChiper";



            string outpot2   = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\message2.jpg";
            string chiper    = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\NewChiper";
            string outpotKey = @"C:\Users\naor\Desktop\outputs\AES_3longMessage\outpotKey";


            a.Encrypte(fileName, outpot, Key, "AES3");

            h.HackProcAes3(fileName, chiper, outpotKey);

            a.Decrypte(outpot, outpot2, outpotKey, "AES3");


            List <stateBlock> surce  = createDataState(createByteArr(fileName));
            List <stateBlock> relese = createDataState(createByteArr(outpot2));


            int counter = 0;

            for (int i = 0; i < surce.Count; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    for (int z = 0; z < 4; z++)
                    {
                        if (surce[i]._data[j, z] != relese[i]._data[j, z])
                        {
                            Console.WriteLine("Faild");
                            counter++;
                        }
                    }
                }
            }


            Console.WriteLine("AES_3longMessage Encrypte + Decrypte +hACKING TOOL");
            return(counter);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: ntedgi/AES
        private static void eunIt(string[] args)
        {
            AES      _aes     = new AES();
            HackTool hackTool = new HackTool();

            try
            {
                string commends = "";
                foreach (string item in args)
                {
                    commends += item + " ";
                }

                if (args[0] == "-t")
                {
                    TestCompare(args[1], args[2]);
                }
                else
                {
                    Match r_algo        = Regex.Match(commends, @"a\s(AES1\s|AES3\s)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_action_fleg = Regex.Match(commends, @"(-e|-d|-b)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_key         = Regex.Match(commends, @"-k\s(\S)+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_input       = Regex.Match(commends, @"-i\s(\S)+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_output      = Regex.Match(commends, @"-o\s(\S)+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_messege     = Regex.Match(commends, @"-m\s(\S)+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    Match r_cipher      = Regex.Match(commends, @"-c\s(\S)+", RegexOptions.Compiled | RegexOptions.IgnoreCase);

                    string algo = Regex.Replace(r_algo.ToString(), @"a\s", "");
                    algo = Regex.Replace(algo.ToString(), @" ", "");
                    string action_fleg = Regex.Replace(r_action_fleg.ToString(), @"\s", "");
                    string key         = Regex.Replace(r_key.ToString(), @"-k\s", "");
                    string input       = Regex.Replace(r_input.ToString(), @"-i\s", "");
                    string output      = Regex.Replace(r_output.ToString(), @"-o\s", "");
                    string messege     = Regex.Replace(r_messege.ToString(), @"-m\s", "");
                    string cipher      = Regex.Replace(r_cipher.ToString(), @"-c\s", "");

                    key     = Directory.GetCurrentDirectory() + "\\" + key;
                    input   = Directory.GetCurrentDirectory() + "\\" + input;
                    output  = Directory.GetCurrentDirectory() + "\\" + output;
                    messege = Directory.GetCurrentDirectory() + "\\" + messege;
                    cipher  = Directory.GetCurrentDirectory() + "\\" + cipher;


                    if (r_action_fleg.ToString() == "-e")
                    {
                        _aes.Encrypte(input, output, key, algo);
                    }
                    else if (r_action_fleg.ToString() == "-d")
                    {
                        _aes.Decrypte(input, output, key, algo);
                    }
                    else if (r_action_fleg.ToString() == "-b")
                    {
                        if (algo == "AES1")
                        {
                            hackTool.HackProcAes1(messege, cipher, output);
                        }
                        else
                        {
                            hackTool.HackProcAes3(messege, cipher, output);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine();

                Console.WriteLine("Illegal Argument Exception  : Command Dosent enter in correct Sequance");

                Console.WriteLine();
            }
        }