Exemplo n.º 1
0
        public async Task Decrypt()
        {
            var keyQueueTask = Task.Run(() => KeepKeyQueueData());

            while (
                keyQueueTask.Status != TaskStatus.RanToCompletion ||
                PendingKeysCount != 0)
            {
                for (int i = 0; i < tasks.Length; i++)
                {
                    if (PendingKeysCount <= 0)
                    {
                        await Task.Delay(1);

                        break;
                    }
                    if (tasks[i] == null || tasks[i].Status == TaskStatus.RanToCompletion)
                    {
                        tasks[i] = Task.Run(() => ProccessNextKeyTask(i));
                    }
                }
            }

            keyQueueTask.Wait();
            MyFileManager.WriteBuilderToFile();
            MyFileManagerSuccesses.WriteBuilderToFile();
            MyFileManagerBad.WriteBuilderToFile();
        }
Exemplo n.º 2
0
        private void ProcessAscii(DecryptedObject decryptedObject)
        {
            bool foundSomething = false;

            string sDecryptOrig = decryptedObject.GetDecodedString(Encoding.UTF8);

            var sDecyptPrintable = new StringBuilder(sDecryptOrig).RemoveAsciiControllChars().RemoveNewLines().RemoveChar(';').GetString();

            if (new StringBuilder(sDecryptOrig).CountChar("[½|¿]") > 100)
            {
                string ln = $";{decryptedObject.GetBytesKeyHex()};;;;;;;;;;;;;{sDecyptPrintable}";
                MyFileManagerBad.ConcatNewLine(ln);
                return;
            }
            string sProcessed = new StringBuilder(sDecryptOrig).RemoveNoneAlphanumericChars().GetString();


            int cDChars  = new StringBuilder(sDecryptOrig).CountChars(); //Numero de Caracteres en String Decriptada
            int cPChars  = new StringBuilder(sProcessed).CountChars();   //Numero de Caracteres en String Procesada
            int cCharDif = cDChars - cPChars;                            // Diferencia Numercia de Caracteres entre original y procesada



            if (Regex.Match(sDecryptOrig, regex, RegexOptions.IgnoreCase).Success)
            {
                foundSomething = true;
            }


            //var sDecyptPrintable = new StringBuilder(sDecryptOrig).RemoveNewLines()
            //    .RemoveChar(';').RemoveChar('\n').RemoveChar('?').RemoveAsciiControllChars().GetString();

            int cDIsAlpha = new StringBuilder(sDecryptOrig).CountAlphanumericChars();   //Numero de Caracteres Alphanumericos
            int cDNoAlpha = new StringBuilder(sDecryptOrig).CountNoAlphanumericChars(); //Numero de Caracteres No Alphanumericos

            int cDIsHex = new StringBuilder(sDecryptOrig).CountHexadecimalChars();      //Numero de Caracteres Hexadecimales
            int cDNoHex = new StringBuilder(sDecryptOrig).CountNoHexadecimalChars();    //Numero de Caracteres No Hexadecimales


            //int cPIsAlpha = new StringBuilder(sProcessed).CountAlphanumericChars(); //Numero de Caracteres Alphanumericos
            int cPNoAlpha = new StringBuilder(sProcessed).CountNoAlphanumericChars(); //Numero de Caracteres No Alphanumericos

            //int cPIsHex = new StringBuilder(sProcessed).CountHexadecimalChars(); //Numero de Caracteres Hexadecimales
            int cPNoHex = new StringBuilder(sProcessed).CountNoHexadecimalChars(); //Numero de Caracteres No Hexadecimales


            string line = $"{foundSomething}";

            line += $";{decryptedObject.GetBytesKeyHex()}"; //Llave utilizada
            line += $";{cDChars};{cPChars}";                //Numero de Caracteres en la String
            line += $";{cCharDif}";                         // Diferencia Numercia de Caracteres entre original y procesada

            //cPIsAlpha
            line += $";{cDIsAlpha};";            //Numero de Caracteres Alphanumericos original y procesada

            line += $";{cDNoAlpha};{cPNoAlpha}"; //Numero de Caracteres No Alphanumericos original y procesada

            //cPIsHex
            line += $";{cDIsHex};";          //Numero de Caracteres Hexadecimales original y procesada

            line += $";{cDNoHex};{cPNoHex}"; //Numero de Caracteres No Hexadecimales original y procesada

            line += $";{sProcessed}";        // String Procesada
            line += $";{sDecyptPrintable}";  // String original sin saltos de linea ni ';'

            if (foundSomething == true)
            {
                MyFileManagerSuccesses.ConcatNewLine(line);
            }

            MyFileManager.ConcatNewLine(line);
        }