Exemplo n.º 1
0
        private Assembly LoadPE(string filePath)
        {
            var fileStr          = File.ReadAllText(filePath);
            var xKey             = Encoding.ASCII.GetBytes(_p);
            var hexadecimal      = Zipper.Decompress(fileStr);
            var contentEncrypted = StringHexToByteArray.Convert(hexadecimal);
            var contentDecrypted = Rc4.Decrypt(xKey, contentEncrypted);

            var pe = Assembly.Load(contentDecrypted);

            return(pe);
        }
Exemplo n.º 2
0
        private void addNoOfKeywordsFromText(string link, string compressedText, string searchQueue)
        {
            using (var context = new SearchEngineContext())
            {
                var linkId = context.LinkDetails.Where(p => p.Link.Equals(link)).Select(p => p.Id).FirstOrDefault();

                string unzippedText = Zipper.Decompress(compressedText);
                unzippedText = unzippedText.Replace(",", "");
                unzippedText = unzippedText.Replace(".", "");
                unzippedText = unzippedText.Replace("!", "");
                unzippedText = unzippedText.Replace("?", "");
                string[] splitText = unzippedText.Split(" ");

                string[] separateKeyword = searchQueue.Split(" ");

                for (int i = 0; i < separateKeyword.Length; i++)
                {
                    var matchQuery = from word in splitText
                                     where word.ToLowerInvariant() == separateKeyword[i].ToLowerInvariant()
                                     select word;
                    int keywordCount = matchQuery.Count();

                    Console.WriteLine($"{separateKeyword[i]} count: {keywordCount}");

                    int noInMetaTags = getNoOfKeywordsFromMetaTags(metaTags, separateKeyword[i]);

                    context.KeywordsInText.Add(new KeywordsInMeaningfulText
                    {
                        Id                 = linkId,
                        keyword            = separateKeyword[i],
                        keywordsInText     = keywordCount,
                        keywordsInMetaTags = noInMetaTags,
                        date               = DateTime.Now
                    });

                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
        private Content GetEncryptedFileContent(string filePath, out byte[] decrypted)
        {
            var fileStr          = File.ReadAllText(filePath);
            var xKey             = Encoding.ASCII.GetBytes(_p);
            var hexadecimal      = Zipper.Decompress(fileStr);
            var contentEncrypted = StringHexToByteArray.Convert(hexadecimal);
            var contentDecrypted = Rc4.Decrypt(xKey, contentEncrypted);

            decrypted = contentDecrypted;

            var contentEncoded = Encoding.UTF8.GetString(contentDecrypted);

            try
            {
                var final = JsonConvert.DeserializeObject <Content>(contentEncoded);
                return(final);
            }
            catch
            {
                return(null);
            }
        }