Exfiltration/LogonUser/LogonUser/LogonUser/LogonUser.cpp
//size will be set to the size of the structure created
size will be set to the size of the structure created
size will be set to the size of the structure created
PVOID CreateNtlmLogonStructure(wstring domain, wstring username, wstring password, DWORD* size)
{
	size_t wcharSize = sizeof(wchar_t);
	size_t totalSize = sizeof(MSV1_0_INTERACTIVE_LOGON) + ((domain.length() + username.length() + password.length()) * wcharSize);
	MSV1_0_INTERACTIVE_LOGON* ntlmLogon = (PMSV1_0_INTERACTIVE_LOGON)(new BYTE[totalSize]);
	size_t offset = sizeof(MSV1_0_INTERACTIVE_LOGON);
	ntlmLogon->MessageType = MsV1_0InteractiveLogon;
	offset += WriteUnicodeString(domain, &(ntlmLogon->LogonDomainName), ntlmLogon, offset);
	offset += WriteUnicodeString(username, &(ntlmLogon->UserName), ntlmLogon, offset);
	offset += WriteUnicodeString(password, &(ntlmLogon->Password), ntlmLogon, offset);
	*size = (DWORD)totalSize; 
	return ntlmLogon;
}
PVOID CreateNtlmLogonStructure ( wstring domain , wstring username , wstring password , DWORD * size ) { size_t wcharSize = sizeof ( wchar_t ) ; size_t totalSize = sizeof ( MSV1_0_INTERACTIVE_LOGON ) + ( ( domain . length ( ) + username . length ( ) + password . length ( ) ) * wcharSize ) ; MSV1_0_INTERACTIVE_LOGON * ntlmLogon = ( PMSV1_0_INTERACTIVE_LOGON ) ( new BYTE [ totalSize ] ) ; size_t offset = sizeof ( MSV1_0_INTERACTIVE_LOGON ) ; ntlmLogon -> MessageType = MsV1_0InteractiveLogon ; offset += WriteUnicodeString ( domain , & ( ntlmLogon -> LogonDomainName ) , ntlmLogon , offset ) ; offset += WriteUnicodeString ( username , & ( ntlmLogon -> UserName ) , ntlmLogon , offset ) ; offset += WriteUnicodeString ( password , & ( ntlmLogon -> Password ) , ntlmLogon , offset ) ; * size = ( DWORD ) totalSize ; return ntlmLogon ; }
size will be set to the size of the structure created
size will be set to the size of the structure created
//If the size is bigger than a DWORD, there is a gigantic bug somewhere.