Esempio n. 1
0
        public ActionResult WriteValueOfX(object args)
        {
            ResultBuilder builder = new ResultBuilder();

            Injection.WriteForm(string.Format("The value of X is {0}", Injection.X));
            builder.WriteLine("Sent to target client.");

            return builder.CreateResult(null);
        }
Esempio n. 2
0
        public ActionResult About(object args)
        {
            ResultBuilder builder = new ResultBuilder();

            builder.WriteLine("RedSpect 1.0 Copyright (c) Navitaire 2010");
            builder.WriteLine("Marc Vitalis (c) 2011");

            return builder.CreateResult(null);
        }
Esempio n. 3
0
        public ActionResult ExecuteScript(string command)
        {
            var engine = Ruby.CreateEngine();

            MemoryStream stream = new MemoryStream();
            engine.Runtime.IO.SetOutput(stream, new UTF8Encoding());

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (!(assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder))
                {
                    engine.Runtime.LoadAssembly(assembly);
                }
            }

            var results = engine.Execute(command);

            stream.Position = 0;
            StreamReader reader = new StreamReader(stream);

            ResultBuilder builder = new ResultBuilder();

            while (!reader.EndOfStream)
            {
                builder.WriteLine(reader.ReadLine());
            }

            reader.Close();
            stream.Close();

            return builder.CreateResult(results);
        }
Esempio n. 4
0
 public ActionResult GetValueOfX(object args)
 {
     ResultBuilder builder = new ResultBuilder();
     return builder.CreateResult(Injection.X);
 }