forked from byt3bl33d3r/OffensiveNim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anti_analysis_isdebuggerpresent.nim
38 lines (29 loc) · 1.21 KB
/
anti_analysis_isdebuggerpresent.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[
Author: HuskyHacks
License: BSD 3-Clause
Compile:
nim c -d:mingw --cpu=amd64 --app=console anti_analysis_isdebuggerpresent.nim
]#
import winim
# If you want to see the console out with an --app=console build, uncomment this import
# import strformat
# Uncomment for convinience breakpoint function that hangs the program until you hit enter in the console window
# proc breakpoint(): void =
# discard(readLine(stdin))
# Using winim's library to perform the check and convert the WINBOOL result into a simple bool for ease of access
proc checkForDebugger(): bool =
winimConverterBOOLToBoolean(IsDebuggerPresent())
proc main(): void =
let debuggerIsDetected = checkForDebugger()
# Uncomment to see the console output in an --app=console build
# echo fmt"[*] Debugger Detected: {debuggerIsDetected}"
if debuggerIsDetected:
MessageBox(0, "Oh, you think you're slick, huh? I see your debugger over there. No soup for you!", "MEGASUSBRO", 0)
quit(1)
else:
MessageBox(0, "No debugger detected! Cowabunga, dudes!", "COAST IS CLEAR", 0)
MessageBox(0, "Boom!", "PAYLOAD", 0)
# Breakpoint for convinience
# breakpoint()
when isMainModule:
main()