vendredi 11 mai 2018

We are not able to set customized passwordFilter in windows 10.

I created my own password filter.dll. But i am not able to set into windows system.

I append under LSA->Notificationpackage as well, and i copied into c:\Window\System32 as well.

In my password filter, in start only i created Log file. But it not creating.

Please let us know is there any more steps i need to perform to set my password filter in windows 10.

Please find snippet of my password filter.

#include <regex>
#include <fstream>
#include "Ntsecapi.h"
#define MAX_SIZE 4028

using namespace std;
using namespace std::tr1;

fstream writeLog;

BOOLEAN __stdcall InitializeChangeNotify(void)
{
wchar_t *pLogFile = L"c:\AmitPasswordFilter.log";
wchar_t aLogFileExp[64];
ExpandEnvironmentStrings(pLogFile, aLogFileExp, sizeof(aLogFileExp)/sizeof(wchar_t));

writeLog.open(aLogFileExp, ios::out|ios::app);
writeLog<<"InitializeChangeNotify"<<endl;

return TRUE;
}

BOOLEAN __stdcall PasswordFilter(PUNICODE_STRING AccountName, PUNICODE_STRING FullName, PUNICODE_STRING Password, BOOLEAN SetOperation)
{
writeLog<<"BabaPasswordFilter"<<endl;
writeLog<< "PasswordFilterAmit"<<endl;

wcmatch mr;
BOOL match = FALSE;
std::wstring seperator(L")(?=");
std::wstring regExp(L"(?=");
const int cathegories=4;
  unsigned int aRegCondition[cathegories]={2,2,2,2};
  
  for(int i=0;i<cathegories;i++)
  {


for(int i=0;i<aRegCondition[0];i++)
regExp+=L".*\\d";
regExp+=seperator;
for(int i=0;i<aRegCondition[1];i++)
regExp+=L".*\\W";
regExp+=seperator;
for(int i=0;i<aRegCondition[2];i++)
regExp+=L".*[A-Z]";
regExp+=seperator;
for(int i=0;i<aRegCondition[3];i++)
regExp+=L".*[a-z]";
regExp+=L")(?![.\\n]).*$";// check for newline characters and end
wregex rx(regExp);

if (Password)
{
match = regex_search(Password->Buffer, mr, rx);

if (match)
{
match = TRUE;
writeLog<<"SumitPassword matches the complexity"<<endl;
}
else
{
match = FALSE;
writeLog<<"SumitPassword does not matche the complexity"<<endl;
}
}
else
{
writeLog<<"SumitPassword is NULL"<<endl;
}

return match;
}

Aucun commentaire:

Enregistrer un commentaire