mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 22:00:18 +00:00
c5303272d9
- r_cons_user_fgets() is a configurable function pointer - Simplify build * Initial import of r_sysproxy - Directly copied from r1 (no api or anything working yet) * R_APIze r_vm and r_print * Make r_core_seek more consistent * Move r_cons_progressbar() to r_print * Rename visual 'x' -> 'w' (oops) - 'a' and 'w' are now compatible with cursor mode * Implement r_sys_usleep() on w32 and fix r_sys_sleep()
68 lines
1.1 KiB
C
68 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <netinet/in.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define SRV_PORT 8181
|
|
|
|
/* test with getsockname() shellcode */
|
|
|
|
extern void process_syscall();
|
|
|
|
void init_srv_sp()
|
|
{
|
|
struct sockaddr_in in, l;
|
|
int srv;
|
|
int con;
|
|
int len;
|
|
int opt;
|
|
int t;
|
|
|
|
memset(&in, 0, sizeof(in));
|
|
in.sin_port = htons(SRV_PORT);
|
|
in.sin_family = AF_INET;
|
|
|
|
srv = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
if(srv < 0) {
|
|
perror("socket");
|
|
exit(1);
|
|
}
|
|
|
|
opt = 1;
|
|
if(setsockopt(srv, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
|
|
perror("setsockopt");
|
|
exit(1);
|
|
}
|
|
|
|
|
|
len = sizeof(in);
|
|
if(bind(srv, (struct sockaddr *)&in, sizeof(in)) < 0) {
|
|
perror("bind");
|
|
exit(1);
|
|
}
|
|
|
|
listen(srv, 5);
|
|
while((con = accept(srv, (struct sockaddr *)&in,
|
|
&len)) > 0) {
|
|
int pid;
|
|
|
|
pid = fork();
|
|
if(pid == 0) {
|
|
close(srv);
|
|
printf("con: %i\n", con);
|
|
process_syscall();
|
|
} else {
|
|
close(con);
|
|
}
|
|
}
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
printf("Esperant conexions rpc al port 8181\n");
|
|
init_srv_sp();
|
|
return 0;
|
|
}
|