Hi, I run the other assembly from my program and I've redirected the output to the file. I would like to encrypt (at least the simple XOR) output from the other assembly in "real time". I will show this on snippet:
I'm wondering if I can instrument somehow the StreamWriter to encrypt what it comes.
output:
FileStream streamer;
StreamWriter writer;
TextWriter oldOut = Console.Out;
TextWriter oldErr = Console.Error;
try
{
streamer = new FileStream(fileName, FileMode.OpenOrCreate | FileMode.Append, FileAccess.Write);
writer = new StreamWriter(streamer);
writer.AutoFlush = true;
}
catch (Exception e)
{
return;
}
Console.SetOut(writer);
Console.SetError(writer);
try
{
Assembly assembly = Assembly.Load(targetdotnet);
MethodInfo method = assembly.EntryPoint;
object[] pp = new[] { parameters };
object execute = method.Invoke(null, pp);
I'm wondering if I can instrument somehow the StreamWriter to encrypt what it comes.