Recent content by kosmosec

  1. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    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...
  2. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    I've copy-paste the entire StreamWriter class and changed Flush(bool, bool) method like that. [code...] if (count > 0) { byte[] xoredBytes = new byte[byteBuffer.Length]; for (int i = 0; i < byteBuffer.Length; i++) {...
  3. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    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.
  4. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    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...
  5. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    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"); cryptic.IV =...
  6. K

    Encrypt text which comes to StreamWriter from Console.SetOut

    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: FileStream streamer; StreamWriter writer; TextWriter oldOut =...
  7. K

    Question Customize output in hosted CLR (.NET)

    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...
  8. K

    Question Customize output in hosted CLR (.NET)

    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 =...
  9. K

    Question Customize output in hosted CLR (.NET)

    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?
  10. K

    Question Customize output in hosted CLR (.NET)

    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...
  11. K

    Question Customize output in hosted CLR (.NET)

    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...
  12. K

    Question Customize output in hosted CLR (.NET)

    @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?
  13. K

    Question Customize output in hosted CLR (.NET)

    Oo, interesting. I don't know the C# well but sounds like it could works. Hmm, I will look at this and figure out how to implement it in Golang.
  14. K

    Question Customize output in hosted CLR (.NET)

    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.
  15. K

    Question Customize output in hosted CLR (.NET)

    "I would assume that when you implement the hosting interfaces that one of the interfaces you would implement covers I/O" indeed, I thought the same but I can't find the proper interface :D
Top Bottom