static void Main(string[] args) { var notAdminUsername = new StartProcess("calc.exe"); notAdminUsername.Start(); var json = UnsecureSerializer <StartProcess> .Serialize(notAdminUsername); var tamperedJson = json.Replace("calc.exe", "Virus.exe"); var adminUsername = UnsecureSerializer <StartProcess> .Deserialize(tamperedJson); adminUsername.Start(); }
static void Main(string[] args) { var notAdminUsername = new StartProcessBad("calc.exe"); Console.WriteLine(notAdminUsername.Cmd); var json = UnsecureSerializer <StartProcessBad> .Serialize(notAdminUsername); var tamperedJson = json.Replace("calc.exe", "Virus.exe"); var adminUsername = UnsecureSerializer <StartProcessBad> .Deserialize(tamperedJson); Console.WriteLine(adminUsername.Cmd); Console.ReadLine(); }
private static void Main(string[] args) { var owner = new Owner { Name = "Tim Apple", Businesses = new List<Business> { new Business { Name = "ProgramingExtreme", Address = "ProgramingLane", Employees = new List<Employee> { new Employee {Name = "Harry"}, new Employee {Name = "Sally"} } } } }; var ownerJson = UnsecureSerializer<Owner>.Serialize(owner); var EmployeeJson = UnsecureSerializer<DbEmployee>.Serialize(new DbEmployee("2")); var OwnerFromEmployer = UnsecureSerializer<Owner>.DeserializeToObject(EmployeeJson); Console.WriteLine("Hello World!"); }