403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.238
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/net/socketbind/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/net/socketbind/files/socketbind.c
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <dlfcn.h>

static void *socket_p, *dl_handle;

static struct sockaddr_in bind_addr;
static int	   do_bind;

int socket(int domain, int type, int protocol) {
	auto int res;
	if (dl_handle == NULL) {
		char *str;
		dl_handle = dlopen("/usr/lib/libc.so", RTLD_LAZY);
		if (dl_handle == NULL) 
			return -1;
		socket_p = dlsym(dl_handle, "socket");
		if (!socket_p)
			return -1;
#ifdef DEBUG
		printf("Loaded socket %x\n", socket_p);
#endif

		if ((str = getenv("BINDTO")) != NULL) {
#ifdef DEBUG
			printf("Thinking about bind\n");
#endif
			if (ascii2addr(AF_INET, str, &bind_addr.sin_addr)) {
				do_bind = 1;
				bind_addr.sin_len = INET_ADDRSTRLEN;
				bind_addr.sin_family = AF_INET;
#ifdef DEBUG
				printf("WILL DO BIND %s, %x\n", str, bind_addr.sin_addr.s_addr);
#endif
			}
		}
	}
	res = ((int(*)(int a, int b, int c))socket_p)(domain, type, protocol); 
	if (do_bind) {
		bind(res, (struct sockaddr*)&bind_addr, INET_ADDRSTRLEN);
	}
	return res;
};


Youez - 2016 - github.com/yon3zu
LinuXploit