Skip to content

Commit 983297f

Browse files
committed
Added embed_rsrc_bin.nim
1 parent 4cc86b7 commit 983297f

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ My experiments in weaponizing [Nim](https://nim-lang.org/) for implant developme
5353
| [blockdlls_acg_ppid_spoof_bin.nim](../master/src/blockdlls_acg_ppid_spoof_bin.nim) | Creates a suspended process that spoofs its PPID to explorer.exe, also enables BlockDLLs and ACG |
5454
| [named_pipe_client_bin.nim](../master/src/named_pipe_client_bin.nim) | Named Pipe Client |
5555
| [named_pipe_server_bin.nim](../master/src/named_pipe_server_bin.nim) | Named Pipe Server |
56+
| [embed_rsrc_bin.nim](../master/src/embed_rsrc_bin.nim) | Embeds a resource (zip file) at compile time and extracts contents at runtime |
5657
| [self_delete_bin.nim](../master/src/self_delete_bin.nim) | A way to delete a locked or current running executable on disk. Method discovered by [@jonasLyk](https://twitter.com/jonasLyk/status/1350401461985955840) |
5758
| [encrypt_decrypt_bin.nim](../master/src/encrypt_decrypt_bin.nim) | Encryption/Decryption using AES256 (CTR Mode) using the [Nimcrypto](https://github.com/cheatfate/nimcrypto) library |
5859
| [amsi_patch_bin.nim](../master/src/amsi_patch_bin.nim) | Patches AMSI out of the current process |

rsrc/super_secret_stuff.zip

238 Bytes
Binary file not shown.

src/embed_rsrc_bin.nim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#[
2+
Author: Marcello Salvati, Twitter: @byt3bl33d3r
3+
License: BSD 3-Clause
4+
]#
5+
6+
import zippy/ziparchives
7+
import strformat
8+
import streams
9+
import os
10+
11+
const MY_RESOURCE = slurp("../rsrc/super_secret_stuff.zip")
12+
13+
let path: string = getEnv("LOCALAPPDATA") / "Temp"
14+
15+
proc extractStuff(): bool =
16+
var archive = ZipArchive()
17+
let dataStream = newStringStream(MY_RESOURCE)
18+
19+
archive.open(dataStream)
20+
archive.extractAll(path)
21+
archive.clear()
22+
23+
return true
24+
25+
echo fmt"[*] Path to extract to: {path}"
26+
if extractStuff():
27+
echo fmt"[*] extracted"

0 commit comments

Comments
 (0)