Advertisement
YourMain12

Basic Anticheat (ASM)

Jan 7th, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Set a flag to determine if the user is cheating
  2. isCheating db 0
  3.  
  4. ; Define a function to check if the user is cheating
  5. checkForCheats:
  6.     ; Set a list of cheats
  7.     cheats db 'cheat1', 0, 'cheat2', 0, 'cheat3', 0, 0
  8.     cheatsLen equ $ - cheats
  9.  
  10.     ; Initialize pointers to the beginning of the input and cheat strings
  11.     mov si, [bp + 4] ; Input string pointer
  12.     mov di, offset cheats ; Cheat string pointer
  13.  
  14.     .checkLoop:
  15.         ; Check if the input string matches the current cheat string
  16.         cld ; Clear direction flag
  17.         lodsb ; Load character from string
  18.         scasb ; Compare character with cheat string
  19.         jne .nextCheat ; If not equal, go to next cheat
  20.         or al, al ; Check if we've reached the end of the input string
  21.         jz .foundCheat ; If input string is empty, we've found a cheat
  22.  
  23.     .nextCheat:
  24.         ; Increment cheat string pointer to next cheat
  25.         mov di, offset cheats ; Reset cheat string pointer
  26.         add di, cheatsLen ; Increment cheat string pointer to next cheat
  27.         cmp di, offset cheats + cheatsLen ; Check if we've reached the end of the cheat list
  28.         jb .checkLoop ; If not, go back to the beginning of the loop
  29.  
  30.     ; If we've reached this point, the user is not cheating
  31.     xor al, al
  32.     mov [isCheating], al
  33.     ret
  34.  
  35. .foundCheat:
  36.     ; If we've found a cheat, set the flag to true
  37.     mov al, 1
  38.     mov [isCheating], al
  39.     ret
  40.  
  41. ; Prompt the user for input
  42. ; (This code assumes the
  43.  
Tags: asm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement