Yes, of course, you're right about the encoding and XOR'ed result. So basically, write data as binary - xor each byte and then pass the byte's array to the stream.Write() and using Encoding.UTF8 should work? Then read data as binary (byte array), xor using the same key then convert to string...
I've copy-paste the entire StreamWriter class and changed Flush(bool, bool) method like that.
if (count > 0)
byte xoredBytes = new byte[byteBuffer.Length];
for (int i = 0; i < byteBuffer.Length; i++)
Yes, I will have to create Stream which has AutoFlush but tbh I don't know how to do it. I was thinking about custom Encoder which will XOR (yeah.. it is not encoding :D) beacuse I can pass Encoder to StreamWriter constructor.
The StreamWriter has the AutoFlush. I use it as I show in the first snippet. Without this the buffer will be flushed at the end of the operation. The AutoFlush flushes its buffer after every call to StreamWriter.Write() so I have the output in file in real time and I also need it using crypto...
I've done something like this and it works but not in "real time". The CryptoStream doesn't have a property AutoFlush.
DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
cryptic.Key = ASCIIEncoding.ASCII.GetBytes("ABCDEFGH");
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:
TextWriter oldOut =...
Thanks Skydiver. Yes, I know about exceptions I will have to print what went wrong.
In case of StringToByteArray() - the first argument is hex string of .exe's bytes. I just need it because I load this wrapper from Golang and the golang program has bytes array of target .net assembly. So...
Ok, I don't know how to do it without a wrapper program. I've created something like this and looks like it works. Do you have something to add or doubt? Srr for shity C# coding from my side :D
public static void Main(string args)
Byte targetdotnet =...
Ok, so I should create a wrapper that creates app domain and a second app domain in the callback. The wrapper .NET program has an args which will be bytes of the target .NET assembly which I want to run. From Golang, I load CLR, run wrapper program with args - bytes of the target .NET. Looks good?
Cool, but I assume I will have to make changes in the source code which I want to run from hosted CLR. Am I right? I would like to treat this .net source code as black-box and I would like to modify the behavior of CLR, because it is the only thing I can do from Golang (that's my assumption - I...
I create default app domain using ICorRuntimeHost -> GetDefaultDomain(), on default app domain I run Load_3 (then find entrypoint) and finally on MethodInfo I run Invoke_3.
So, I should create appdomain in callback (not default app domain) and in the callback run Invoke_3. In the default...
@JohnH I don't get it how to connect those AppDomains. I found this example AppDomain.DoCallBack(CrossAppDomainDelegate) Method (System) . Should I create one AppDomain and the second AppDomain is created in the callback and in this callback I run my target .NET application?
Wow thanks, this article is really interesting and it potentially solves my problem but I have no idea how to tell the CLR to run or share the newly created console ;/ It works when I run something from the command line using CrateProcess() but I can't because I initialize the CLR directly in Go.