First off for some context, I am a sophomore in college looking to take a security track in computer science and I thought it would be a fun project to create a RAT in go. Taking inspiration from other RAT’s I noticed when you “build” the client executable you can add your own settings and what-not. How do they accomplish this? Are they compiling an executable from within their program or are they adding some sort of config file to an already compiled one?
Any tips on how to accomplish something like this? Thanks a ton!
评论:
pdffs:
DevFolks:You can set vars at build time like so:
package main var buildTimeVar string
.
go build -ldflags "-X main.buildTimeVar='value'"
outroot:I may have worded it poorly, but I mean I already have my “main” executable compiled but when I want to create the stub with custom settings from within my main executable, how would I go about adding those settings to the stub?
An example would be Quasar RAT’s “build” button.
How I did this back in the day in C, is the server would have a global static char* variable that would have data like:
"---===--===START===--===--- port:12345 key1:value1 key2:value2 \0\0\0\0\0\0 ---===--===END===--===--- "
Then in your server editor, it would open the binary, find that section, parse the values, and be able to save it to the same location. I had padding at the end to make sure it could hold larger values if the user put them in there. This was a basic way to do it and it's not very stealth.
In go, you can do something similar with a const byte slice, or maybe even appending a zip to the server that contains the configuration data in a file. The method is described here: https://github.com/golang/go/wiki/GcToolchainTricks#bundle-data-into-go-binary
