Skip to content

Commit

Permalink
#2 : Fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
winocreative committed Nov 14, 2023
1 parent fdce5bd commit 9a8f0f7
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 197 deletions.
11 changes: 10 additions & 1 deletion Protector/AntiDebug.cpp → Protector/AntiDebug.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#include <Windows.h>

#include "AntiLibrary.hpp"
inline bool BasicDebugTriggered()
{
if (IsDebuggerPresent())
return true;
//get peb
#ifdef _WIN64
PPEB peb = (PPEB)__readgsqword(0x60);
#else
PPEB peb = (PPEB)__readfsdword(0x30);
#endif
auto NtGlobalFlag = peb->NtGlobalFlag;
if (NtGlobalFlag & 0x70)
return true;

return false;
}
Expand Down
14 changes: 7 additions & 7 deletions Protector/AntiLibrary.cpp → Protector/AntiLibrary.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#pragma once
#include <Windows.h>
#include <stdio.h>
#include <string>
#include "Utils.hpp"
#ifdef _WIN64
#pragma comment(linker, "/INCLUDE:_tls_used") //Use TLS

#else
#pragma comment(linker, "/INCLUDE:__tls_used") //Use TLS
#endif
typedef struct _PEB_LDR_DATA
{
ULONG Length;
Expand Down Expand Up @@ -150,9 +154,6 @@ void NTAPI TlsCallback(PVOID DllHandle, DWORD dwReason, PVOID Reserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
//Check if debugger is present
if (IsDebuggerPresent())
ExitProcess(0);
printf("Checking library %p\n", DllHandle);
}
}
Expand Down Expand Up @@ -191,8 +192,7 @@ __forceinline void CheckLibrary()
printf("Failed to check digital signature of %ws\n", path);
continue;
}
printf("file: %ws\n", path);
PrintSignatureInfo(signType, catalogFile, SignChain);
//printf("file: %ws\n", path);
//PrintSignatureInfo(signType, catalogFile, SignChain);
}
system("pause");
}
156 changes: 0 additions & 156 deletions Protector/AntiProcess.cpp

This file was deleted.

Loading

0 comments on commit 9a8f0f7

Please sign in to comment.