Pentester's Promiscuous Notebook
search
Ctrlk
TwitterGitHubBlog
  • README
  • ⚒️Pentest
    • C2chevron-right
    • Infrastructurechevron-right
    • OSINTchevron-right
    • Password Brute Forcechevron-right
    • Perimeterchevron-right
    • Shellschevron-right
    • Webchevron-right
    • Wi-Fichevron-right
  • ⚔️Red Team
    • Basics
    • Infrastructure
    • Developmentchevron-right
      • API Hashing
      • API Hooking
      • BOF / COFF
      • CFG
      • Code Injectionchevron-right
      • DLL Hijacking
      • Golang
      • Kernel Mode
      • PIC / Shellcode
      • Nim
      • Sandbox Evasion
      • Syscalls
      • Windows API
  • 🐞Exploit Dev
    • BOFchevron-right
    • RE
    • WinDbg
  • ⚙️Admin
    • Git
    • Linuxchevron-right
    • Networkingchevron-right
    • Virtualizationchevron-right
    • Windows
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
  1. ⚔️Red Teamchevron-right
  2. Development

Nim

  • https://github.com/byt3bl33d3r/OffensiveNimarrow-up-right

  • https://s3cur3th1ssh1t.github.io/Playing-with-OffensiveNim/arrow-up-right

  • https://github.com/S3cur3Th1sSh1t/Creds/tree/master/nimarrow-up-right

  • https://github.com/ajpc500/NimExamplesarrow-up-right

  • https://huskyhacks.dev/2021/07/17/nim-exploit-dev/arrow-up-right

  • https://casvancooten.com/posts/2021/08/building-a-c2-implant-in-nim-considerations-and-lessons-learned/arrow-up-right

hashtag
Install

Windows:

  • https://nim-lang.org/install_windows.htmlarrow-up-right

  • https://git-scm.com/download/winarrow-up-right

Linux:

$ sudo apt install mingw-w64 -y
$ sudo apt install nim -y
Or
$ curl https://nim-lang.org/choosenim/init.sh -sSf | sh

Dependencies:

Nim > nimble install winim nimcrypto zippy

hashtag
Compilation

Basic:

To not popup the console window:

For the best size:

For Windows on Linux:

Add the needed relocation section to the resulting executable (from Windows):

hashtag
Tools & Packers

  • https://github.com/S3cur3Th1sSh1t/Nim-RunPEarrow-up-right

  • https://github.com/S3cur3Th1sSh1t/NimGetSyscallStubarrow-up-right

  • https://github.com/chvancooten/NimPackt-v1arrow-up-right

  • https://github.com/icyguider/Nimcrypt2arrow-up-right

  • https://github.com/adamsvoboda/nim-loaderarrow-up-right

Last updated 3 months ago

  • Install
  • Compilation
  • Tools & Packers
Nim > nim c program.nim
Nim > nim c --app:gui program.nim
Nim > nim c -d:danger -d:strip --opt:size --passC=-flto --passL=-flto program.nim
$ nim c --cpu:amd64 --os:windows --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc program.nim
Nim > nim c --passL:-Wl,--dynamicbase,--export-all-symbols program.nim