Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                int value;
                while (true)
                {
                    Console.WriteLine("\nSpecify Zone: ");
                    Console.WriteLine("\t1. " + SecurityZone.Internet);
                    Console.WriteLine("\t2. " + SecurityZone.Intranet);
                    Console.WriteLine("\t3. " + SecurityZone.MyComputer);
                    Console.WriteLine("\t4. " + SecurityZone.Trusted);
                    Console.WriteLine("\t5. " + SecurityZone.Untrusted);
                    Console.WriteLine("\tType q to exit");

                    Console.Write("\nEnter a selection: ");
                    string input = Console.ReadKey().KeyChar.ToString();

                    if (input.ToLowerInvariant().Equals("q"))
                        return;

                    bool parsed = Int32.TryParse(input, out value);
                    if (parsed)
                    {
                        if (value > 0 && value <= 5)
                            break;
                    }
                    Console.WriteLine("Please enter a valid value.");
                }

                SecurityZone zone = SecurityZone.Internet;
                switch (value)
                {
                    case (1): zone = SecurityZone.Internet; break;
                    case (2): zone = SecurityZone.Intranet; break;
                    case (3): zone = SecurityZone.MyComputer; break;
                    case (4): zone = SecurityZone.Trusted; break;
                    case (5): zone = SecurityZone.Untrusted; break;
                }

                object[] hostEvidence = { new Zone(zone) };
                Evidence e = new Evidence(hostEvidence, null);
                AppDomain appDomain = AppDomain.CreateDomain("Malware Domain", e);
                appDomain.ExecuteAssembly("Malware.exe");
                Console.WriteLine("\nAssembly executed successfully.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.ToString());
            }
        }