Skip to content

Instantly share code, notes, and snippets.

@PotatoPwn
Last active April 28, 2024 09:21
Show Gist options
  • Save PotatoPwn/7197a02839db3fb6b4a1e3db43d9623c to your computer and use it in GitHub Desktop.
Save PotatoPwn/7197a02839db3fb6b4a1e3db43d9623c to your computer and use it in GitHub Desktop.
#include <iostream>
#include <Windows.h>
#include <SubAuth.h>
using _FilterPassword = BOOLEAN(*)(PUNICODE_STRING AccountName, PUNICODE_STRING FullName, PUNICODE_STRING Password, BOOLEAN IsSet);
PUNICODE_STRING ConvertToPuni(char* Character)
{
int Len = MultiByteToWideChar(CP_UTF8, 0, Character, -1, NULL, 0);
PWSTR StringAlloc = static_cast<PWSTR>(LocalAlloc(LMEM_ZEROINIT, Len * sizeof(WCHAR)));
MultiByteToWideChar(CP_UTF8, 0, Character, -1, StringAlloc, Len);
PUNICODE_STRING Value = static_cast<PUNICODE_STRING>(LocalAlloc(LMEM_ZEROINIT, sizeof(UNICODE_STRING)));
Value->Buffer = StringAlloc;
Value->Length = Len;
Value->MaximumLength = Len;
return Value;
}
int main()
{
// Passfilt.dll
// Build Project in 32bit if using 32bit Passfilt.dll & ViseVersa
_FilterPassword FilterPassword =
reinterpret_cast<_FilterPassword>(GetProcAddress(LoadLibrary("Passfilt.dll"), "PasswordFilter"));
PUNICODE_STRING AccountName, Fullname, Password;
AccountName = ConvertToPuni("Fuck");
Fullname = ConvertToPuni("You");
Password = ConvertToPuni("Cunt");
bool Result = FilterPassword(AccountName, Fullname, Password, 0);
printf("Password Strong > %s\n", Result ? "True" : "False");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment