Skip to content

Notes and source code for Nim offensive security excercises

Notifications You must be signed in to change notification settings

victoni/offensive-security-Nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Notes for Nim and offensive security Nim

Nim for offensive security.

Dockerfile for Windows compilation environment

# Use the nimlang/nim image as the base image
FROM nimlang/nim

# Update the package lists and install mingw-w64
RUN apt-get update && apt-get install -y mingw-w64

# Clean up APT when done
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Define the working directory
WORKDIR /usr/src/app

# Copy the current directory contents into the container at /usr/src/app
#COPY . .

# Install winim package
RUN nimble install winim

# Define the command to run the Nim compiler by default
CMD ["nim", "--version"]

then

docker build -t nim-mingw .

Compile for Linux:

docker run --rm -v /dir/path/to/program:/usr/src/app -w /usr/src/app nimlang/nim nim c -r program.nim

or

docker run --rm -v /dir/path/to/program:/usr/src/app -w /usr/src/app nim-mingw:latest nim c -r program.nim

Hint: if you want extra stealth-ness, compile with --app:gui

Compile for Windows:

docker run --rm -v /dir/path/to/program:/usr/src/app -w /usr/src/app nim-mingw:latest nim c -d:mingw program.nim

Documentation

To cross-compile for Windows from Linux or macOS using the MinGW-w64 toolchain:

nim c -d:mingw myproject.nim
# nim r also works, running the binary via `wine` or `wine64`:
nim r -d:mingw --eval:'import os; echo "a" / "b"'

Use --cpu:i386 or --cpu:amd64 to switch the CPU architecture.

The MinGW-w64 toolchain can be installed as follows:

apt install mingw-w64   # Ubuntu
yum install mingw32-gcc
yum install mingw64-gcc # CentOS - requires EPEL
brew install mingw-w64  # OSX

Pracical learning

Docker

Offensive security

About

Notes and source code for Nim offensive security excercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages