- detectdriverbin.zip
- DetectDriverBin
- DetectDriverBin
- DetectDriver.sys
- DetectDriverGUI.exe
- HideDriver.sys
- HideDriverGUI.exe
- detectdriversrc.zip
- DetectDriverSrc
- DetectDriver
- src
- Common
- ddk_build.bat
- DetectDriver
- DetectDriver_vs9.sln
- DetectDriverGUI
- drvCppLib
- build.bat
- cxx.h
- drvCppLib_vs8.vcproj
- drvCppLib_vs9.vcproj
- except.c
- lib_copy
- _memicmp.obj
- _stricmp.obj
- _strnicm.obj
- atlssup.obj
- chkesp.obj
- chkstk.obj
- conv.lib
- eh.lib
- eh3valid.obj
- enable.obj
- exsup.obj
- exsup2.obj
- exsup3.obj
- info.txt
- inp.obj
- lldiv.obj
- lldvrm.obj
- llmul.obj
- llrem.obj
- llshl.obj
- llshr.obj
- longjmp.obj
- matherr.obj
- memccpy.obj
- memchr.obj
- memcmp.obj
- memcpy.obj
- memmove.obj
- memset.obj
- outp.obj
- rtc.lib
- sehprolg.obj
- sehsupp.obj
- setjmp.obj
- setjmp3.obj
- setjmpex.obj
- strcat.obj
- strchr.obj
- strcmp.obj
- strcspn.obj
- strdup.obj
- strlen.obj
- strncat.obj
- strncmp.obj
- strncpy.obj
- strnset.obj
- strpbrk.obj
- strrchr.obj
- strrev.obj
- strset.obj
- strspn.obj
- strstr.obj
- tlssup.obj
- tran.lib
- ulldiv.obj
- ulldvrm.obj
- ullrem.obj
- ullshr.obj
- libcpp.cpp
- libcpp.h
- MAKEFILE
- new.h
- rtti.cpp
- Sources
- drvCppLibTest
- drvSingleModeTest
- drvUtils
- HideDriver
- HideDriverGUI
- info.txt
- STLPort
- Utils
- UtilsPortable
- UtilsPortableUnitTest
|
#include "drvCommon.h"
#include "ProcessListWork.h"
#include "ListUtils.h"
#include <algorithm>
#include <boost/bind.hpp>
namespace DetectDriver
{
void GetListSimilarity(ProcessInfoListPtr hookedList,
ProcessInfoListPtr originalList,
ProcInfoShortList* commonList)
{
utils::NtList* originalListNt = (utils::NtList*)originalList;
// Enumerating originalList
while( true )
{
ProcessInfoListPtr originalRecord = (ProcessInfoListPtr)originalListNt;
utils::NtList* hookedListNt = (utils::NtList*)hookedList;
// Enumerating hookedList
while( true )
{
ProcessInfoListPtr hookedRecord = (ProcessInfoListPtr)hookedListNt;
if(RtlEqualUnicodeString(&hookedRecord->ProcessName,
&originalRecord->ProcessName, TRUE))
{
std::wstring name(originalRecord->ProcessName.Buffer,
originalRecord->ProcessName.Length/2);
ProcessInfoShort shortInfo={originalRecord->ProcessId,name};
commonList->push_back(shortInfo);
break;
}
if( utils::IsEntryLast(hookedListNt) )
break;
hookedListNt = utils::GetNextEntryPointer(hookedListNt);
}
if( utils::IsEntryLast(originalListNt))
break;
originalListNt = utils::GetNextEntryPointer(originalListNt);
}
}
void GetListDifference(ProcessInfoListPtr originalListIn,
const ProcInfoShortList& commonList,
ProcInfoShortList* hiddenList)
{
utils::NtList* originalListNt = (utils::NtList*)originalListIn;
// Enumerating hookedList
while( true )
{
ProcessInfoListPtr hookedRecord = (ProcessInfoListPtr)originalListNt;
std::wstring name(hookedRecord->ProcessName.Buffer,
hookedRecord->ProcessName.Length/2);
ProcInfoShortList::const_iterator it =
std::find_if(commonList.begin(),commonList.end(),
boost::bind(&ProcessInfoShort::name,_1) == name);
if( it == commonList.end() )
{
ProcessInfoShort shortInfo={hookedRecord->ProcessId,name};
hiddenList->push_back(shortInfo);
}
if( utils::IsEntryLast(originalListNt) )
break;
originalListNt = utils::GetNextEntryPointer(originalListNt);
}
}
void ExamineList(ProcessInfoListPtr hookedListIn,
ProcessInfoListPtr originalListIn,
ProcInfoShortList* hiddenList)
{
size_t hookedListCount = utils::GetListEntryCount((utils::NtList*)hookedListIn);
size_t originalListCount = utils::GetListEntryCount((utils::NtList*)originalListIn);
if( hookedListCount > originalListCount )
throw std::exception("Hooked list has more records then original.");
ProcInfoShortList commonList;
GetListSimilarity(hookedListIn,originalListIn,&commonList);
if( commonList.size() != originalListCount )
{
GetListDifference(originalListIn,commonList,hiddenList);
}
}
bool IsListsEqual(ProcessInfoListPtr hookedList,
ProcessInfoListPtr originalList)
{
utils::NtList *ntHookedList = (utils::NtList*)hookedList;
utils::NtList *ntOriginalList = (utils::NtList*)originalList;
// Step 1
size_t hookedListCount = utils::GetListEntryCount(ntHookedList);
size_t originalListCount = utils::GetListEntryCount(ntOriginalList);
if(hookedListCount != originalListCount)
return false;
// Step 2
size_t hookedListSize = utils::GetListSize(ntHookedList);
size_t originalListSize = utils::GetListSize(ntOriginalList);
if(hookedListSize != originalListSize)
return false;
// Step 3
if(memcmp(hookedList,originalList,hookedListSize) != 0)
return false;
return true;
}
}//namespace DetectDriver
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
ApriorIT is a software research and development company specializing in cybersecurity and data management technology engineering. We work for a broad range of clients from Fortune 500 technology leaders to small innovative startups building unique solutions.
As Apriorit offers integrated research&development services for the software projects in such areas as endpoint security, network security, data security, embedded Systems, and virtualization, we have strong kernel and driver development skills, huge system programming expertise, and are reals fans of research projects.
Our specialty is reverse engineering, we apply it for security testing and security-related projects.
A separate department of Apriorit works on large-scale business SaaS solutions, handling tasks from business analysis, data architecture design, and web development to performance optimization and DevOps.
Official site: https://www.apriorit.com
Clutch profile: https://clutch.co/profile/apriorit
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.