/*!
 * @brief Initialize the server extension
 */
DWORD __declspec(dllexport) InitServerExtension(Remote *remote)
{
	hMetSrv = remote->hMetSrv;

	command_register_all(customCommands);

	return ERROR_SUCCESS;
}
예제 #2
0
/*!
 * @brief Initialize the server extension
 */
DWORD __declspec(dllexport) InitServerExtension(Remote *remote)
{
	hMetSrv = remote->met_srv;
	dprintf("[PEINJECTOR] Initializing peinjector...");

	command_register_all(customCommands);

	return ERROR_SUCCESS;
}
예제 #3
0
DWORD InitServerExtension(Remote *remote)
#endif
{
#ifdef _WIN32
	hMetSrv = remote->hMetSrv;
#endif
	command_register_all(customCommands);

	return ERROR_SUCCESS;
}
예제 #4
0
파일: extapi.c 프로젝트: BrzTit/meterpreter
/*!
 * @brief Initialize the server extension.
 * @param remote Pointer to the remote instance.
 * @return Indication of success or failure.
 */
DWORD __declspec(dllexport) InitServerExtension(Remote *remote)
{
	hMetSrv = remote->met_srv;

	command_register_all(customCommands);

	initialise_clipboard();
	initialise_service();

	return ERROR_SUCCESS;
}
예제 #5
0
/*!
 * @brief Initialize the server extension.
 * @param remote Pointer to the remote instance.
 * @return Indication of success or failure.
 */
DWORD __declspec(dllexport) InitServerExtension(Remote *remote)
{
	hMetSrv = remote->met_srv;

	dprintf("[KIWI] Init server extension - initorclean");
	mimikatz_initOrClean(TRUE);

	dprintf("[KIWI] Init server extension - register");
	command_register_all(customCommands);

	dprintf("[KIWI] Init server extension - done");

	return ERROR_SUCCESS;
}
/*
 * Initialize the server extension
 */
DWORD __declspec(dllexport) InitServerExtension(Remote *remote) {
	hMetSrv = remote->hMetSrv;

	command_register_all( customCommands );

	dhcpserver = createDHCPServer();
	tftpserver = createTFTPServer();

	if (tftpserver) {
		return ERROR_SUCCESS;
	}

	return ERROR_NOT_ENOUGH_MEMORY;
}
예제 #7
0
/*
 * Deinitialize the server extension
 */
DWORD __declspec(dllexport) DeinitServerExtension(Remote *remote)
{
    command_register_all( customCommands );

#ifdef _WIN32
    MgrDestroy(hMgr);
#else
    if(packet_filter) {
        free(packet_filter);
        packet_filter = NULL;
    }
#endif

    lock_destroy(snifferm);
    return ERROR_SUCCESS;
}
예제 #8
0
DWORD InitServerExtension(Remote *remote)
#endif
{
#ifdef _WIN32
	// This handle has to be set before calls to command_register
	// otherwise we get obscure crashes!
	hMetSrv = remote->met_srv;
#endif

	dprintf("[SERVER] Registering command handlers...");
	command_register_all( customCommands );

	dprintf("[SERVER] Memory reset of open_captures...");
	memset(open_captures, 0, sizeof(open_captures));

#ifdef _WIN32
	// initialize structures for the packet sniffer sdk
	hMgr = NULL;
	hErr = 0;

	dprintf("[SERVER] Memory reset of include/exclude port lists...");
	// wipe the include/exclude ports empty
	memset(sniffer_includeports, 0, sizeof(sniffer_includeports));
	memset(sniffer_excludeports, 0, sizeof(sniffer_excludeports));
	sniffer_includeports[0] = -1;
	sniffer_excludeports[0] = -1;
#endif

	dprintf("[SERVER] Getting the peer name of our socket...");
	// get the address/port of the connected control socket
	peername4 = NULL;
	peername6 = NULL;
	peername_len = sizeof(peername);
	if (remote->transport->get_socket) {
		getpeername(remote->transport->get_socket(remote->transport), &peername, &peername_len);
		if(peername.sa_family == PF_INET)  peername4 = (struct sockaddr_in *)&peername;

		dprintf("[SERVER] Getting the IPv6 peer name of our socket...");
		if(peername.sa_family == PF_INET6) peername6 = (struct sockaddr_in6 *)&peername;
	}
	else {
	 // TODO: not sure what to do here
	}

	dprintf("[SERVER] Creating a lock...");
	snifferm = lock_create();

#ifdef _WIN32
	return hErr;
#else
	if(peername4 || peername6) {
		int port;
		char buf[256];		// future proof :-)

		memset(buf, 0, sizeof(buf));

		if(peername4) {
			inet_ntop(AF_INET, &peername4->sin_addr, buf, sizeof(buf)-1);
			port = ntohs(peername4->sin_port);
		} else {
			inet_ntop(AF_INET6, &peername6->sin6_addr, buf, sizeof(buf)-1);
			port = ntohs(peername6->sin6_port);
		}

		asprintf(&packet_filter, "not (ip%s host %s and tcp port %d)", peername4 ? "" : "6", buf, port);
		dprintf("so our filter is '%s'", packet_filter);
	} else {
		dprintf("hold on to your seats. no filter applied :~(");
	}

	return ERROR_SUCCESS;
#endif

}
/*
 * Registers custom command handlers
 */
VOID register_dispatch_routines()
{
	gExtensionList = list_create();

	command_register_all(customCommands);
}