<p>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?</p>
<p>Any tips on how to accomplish something like this? Thanks a ton! </p>
<hr/>**评论:**<br/><br/>pdffs: <pre><p>You can set vars at build time like so:</p>
<pre><code>package main
var buildTimeVar string
</code></pre>
<p>.</p>
<pre><code>go build -ldflags "-X main.buildTimeVar='value'"
</code></pre></pre>DevFolks: <pre><p>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? </p>
<p>An example would be Quasar RAT’s “build” button. </p></pre>outroot: <pre><p>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:</p>
<pre><code>"---===--===START===--===---
port:12345
key1:value1
key2:value2
\0\0\0\0\0\0
---===--===END===--===---
"
</code></pre>
<p>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.</p>
<p>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: <a href="https://github.com/golang/go/wiki/GcToolchainTricks#bundle-data-into-go-binary" rel="nofollow">https://github.com/golang/go/wiki/GcToolchainTricks#bundle-data-into-go-binary</a></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传