Skip to content

Commit 9891d29

Browse files
committed
mambda was picky about inline asm lol
1 parent b0c38ab commit 9891d29

8 files changed

+116
-19
lines changed

.vs/anti-debugging/v16/.suo

5 KB
Binary file not shown.

Methods/MethodNtGlobalFlag.h

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33

44
// only works on 32bit applications. Will add 64bit support later. See https://anti-reversing.com/Downloads/Anti-Reversing/The_Ultimate_Anti-Reversing_Reference.pdf page 5
55
bool MethodNtGlobalFlag() {
6-
int tmp = NULL;
7-
__asm
8-
{
9-
mov eax, fs:[0x30]
10-
mov eax, [eax+0x68]
11-
and al, 0x70
12-
mov tmp, eax
13-
}
14-
15-
return tmp == 0x70;
6+
auto peb = (char*) __readfsdword(0x30);
7+
auto ntGlobalFlag = *(peb + 0x68);
8+
return ( (ntGlobalFlag & 0x70) == 0x70);
169
}

Methods/MethodPEBBeingDebugged.h

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@
66
PPEB getPeb(void);
77

88
bool MethodPEBBeingDebugged() {
9-
// define our vars
10-
PPEB pPeb = NULL;
11-
bool dBug;
12-
13-
pPeb = getPeb();
14-
std::cout << "ALALOELE PEB->>> " << pPeb << std::endl;
15-
16-
dBug = pPeb->BeingDebugged;
17-
return dBug;
9+
auto peb = (char*) __readfsdword(0x30);
10+
return *(peb+0x2);
1811
}
1912

2013
PPEB getPeb() {

anti-debugging.rc

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
#define APSTUDIO_READONLY_SYMBOLS
6+
/////////////////////////////////////////////////////////////////////////////
7+
//
8+
// Generated from the TEXTINCLUDE 2 resource.
9+
//
10+
#include "winres.h"
11+
12+
/////////////////////////////////////////////////////////////////////////////
13+
#undef APSTUDIO_READONLY_SYMBOLS
14+
15+
/////////////////////////////////////////////////////////////////////////////
16+
// English (United States) resources
17+
18+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19+
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
20+
#pragma code_page(1252)
21+
22+
#ifdef APSTUDIO_INVOKED
23+
/////////////////////////////////////////////////////////////////////////////
24+
//
25+
// TEXTINCLUDE
26+
//
27+
28+
1 TEXTINCLUDE
29+
BEGIN
30+
"resource.h\0"
31+
END
32+
33+
2 TEXTINCLUDE
34+
BEGIN
35+
"#include ""winres.h""\r\n"
36+
"\0"
37+
END
38+
39+
3 TEXTINCLUDE
40+
BEGIN
41+
"\r\n"
42+
"\0"
43+
END
44+
45+
#endif // APSTUDIO_INVOKED
46+
47+
48+
/////////////////////////////////////////////////////////////////////////////
49+
//
50+
// Icon
51+
//
52+
53+
// Icon with lowest ID value placed first to ensure application icon
54+
// remains consistent on all systems.
55+
IDI_ICON1 ICON "gh.ico"
56+
57+
#endif // English (United States) resources
58+
/////////////////////////////////////////////////////////////////////////////
59+
60+
61+
62+
#ifndef APSTUDIO_INVOKED
63+
/////////////////////////////////////////////////////////////////////////////
64+
//
65+
// Generated from the TEXTINCLUDE 3 resource.
66+
//
67+
68+
69+
/////////////////////////////////////////////////////////////////////////////
70+
#endif // not APSTUDIO_INVOKED
71+

anti-debugging.vcxproj

+8
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@
153153
<ItemGroup>
154154
<ClInclude Include="AntiDebugMethod.h" />
155155
<ClInclude Include="MethodFunctions.h" />
156+
<ClInclude Include="resource.h" />
157+
</ItemGroup>
158+
<ItemGroup>
159+
<ResourceCompile Include="anti-debugging.rc" />
160+
</ItemGroup>
161+
<ItemGroup>
162+
<Image Include="gh.ico" />
163+
<Image Include="icon1.ico" />
156164
</ItemGroup>
157165
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
158166
<ImportGroup Label="ExtensionTargets">

anti-debugging.vcxproj.filters

+16
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,21 @@
2929
<ClInclude Include="MethodFunctions.h">
3030
<Filter>Header Files</Filter>
3131
</ClInclude>
32+
<ClInclude Include="resource.h">
33+
<Filter>Header Files</Filter>
34+
</ClInclude>
35+
</ItemGroup>
36+
<ItemGroup>
37+
<ResourceCompile Include="anti-debugging.rc">
38+
<Filter>Resource Files</Filter>
39+
</ResourceCompile>
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Image Include="icon1.ico">
43+
<Filter>Resource Files</Filter>
44+
</Image>
45+
<Image Include="gh.ico">
46+
<Filter>Resource Files</Filter>
47+
</Image>
3248
</ItemGroup>
3349
</Project>

icon1.ico

44.4 KB
Binary file not shown.

resource.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by anti-debugging.rc
4+
//
5+
#define IDI_ICON1 102
6+
7+
// Next default values for new objects
8+
//
9+
#ifdef APSTUDIO_INVOKED
10+
#ifndef APSTUDIO_READONLY_SYMBOLS
11+
#define _APS_NEXT_RESOURCE_VALUE 103
12+
#define _APS_NEXT_COMMAND_VALUE 40001
13+
#define _APS_NEXT_CONTROL_VALUE 1001
14+
#define _APS_NEXT_SYMED_VALUE 101
15+
#endif
16+
#endif

0 commit comments

Comments
 (0)