first commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
EXEC = exploit
|
||||
|
||||
$(EXEC): exploit.o
|
||||
gcc -o $(EXEC) exploit.o
|
||||
|
||||
exploit.o: exploit.c
|
||||
gcc -c exploit.c
|
||||
@@ -0,0 +1,31 @@
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char** argv){
|
||||
if (argc != 2){
|
||||
printf("u must specifie IP addr\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("target = %s\n", argv[1]);
|
||||
int domain = AF_INET;
|
||||
int type = SOCK_STREAM;
|
||||
int fd = socket(domain, type, 0);
|
||||
printf("fd = %d\n", fd);
|
||||
|
||||
struct sockaddr_in dest_addr;
|
||||
memset(&dest_addr, 0, sizeof(dest_addr));
|
||||
dest_addr.sin_family = AF_INET;
|
||||
dest_addr.sin_port = htons(80);
|
||||
dest_addr.sin_addr.s_addr = inet_addr(argv[1]);
|
||||
|
||||
socklen_t len = 0;
|
||||
int ret = getsockname(fd,(struct sockaddr*)&dest_addr, &len);
|
||||
printf("ret_getsockname = %d\n", ret);
|
||||
|
||||
ret = connect(fd,(struct sockaddr*)&dest_addr, len);
|
||||
printf("ret_connect = %d\n", ret);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user