Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Souhail (Itsecurity.ma)
- ; CHECK HOW I DID IT BELOW THIS CODE :)
- ; Greetings to Lord Noteworthy
- .386
- .model flat,stdcall
- option casemap:none
- include windows.inc
- include kernel32.inc
- includelib kernel32.lib
- include user32.inc
- includelib user32.lib
- include masm32.inc
- includelib masm32.lib
- .data
- text db "Saisir un nom :) :",00
- SerialIs db "Le Serial pour ce nom est : ",00,0Ah
- Quit db 0Ah,"**Appuyer sur Entrer pour quitter**",00
- .data?
- name1 db 200 dup(?)
- serial db 400 dup(?)
- exit db 10 dup(?)
- .code
- start :
- invoke StdOut,addr text
- invoke StdIn,addr name1,200
- lea esi,name1
- lea edi,serial
- myloop :
- cmp byte ptr ds:[esi],00h
- je term
- movzx eax,byte ptr ds:[esi]
- ROR al,3 ; Rotate right 3 times
- xor al,43h
- mov ebx,10h
- xor edx,edx
- div ebx ; EAX / 10
- ;EAX has the division result (used to retrieve the 1st letter)
- ;EDX has the modulo (used to retrieve the 2nd letter)
- add al,41h
- add dl,41h
- mov byte ptr ds:[edi],al
- inc edi
- mov byte ptr ds:[edi],dl
- inc edi
- inc esi
- jmp myloop
- term :
- mov byte ptr ds:[edi],00h
- invoke StdOut,addr SerialIs
- invoke StdOut,addr serial
- invoke StdOut,addr Quit
- invoke StdIn,addr exit,01
- invoke ExitProcess,0
- end start
- ; Name : IJKL
- ; Serial : EFGH
- ; Ptr to name in : ESI
- ; Ptr to serial in : EDI
- ; Steps :
- ; Get the 1st character from the serial in "AL". = 45h
- ; Subsract 41h from AL. = 04h
- ; Shift left AL by 4 which means (AL * 10h) = 40h
- ; Get The 2nd character from the serial and store it in AL = 46h
- ; Then move it to CL. The result of the shift operation is poped
- ; back to AL.
- ; Substract 41h from CL (2nd character of the serial) CL == 05
- ; Add CL to AL (AL == 45h)
- ; XOR AL with 43h (AL == 06)
- ; Rotate Left AL 3 times ; AL = 30h
- ; Compare AL with the 1st character of the Name.
- ; Redo the same steps for the other chars.
- ; Conclusion : Each 2 letters of the serial gives us 1 letter from the name. len(serial) = len(name)*2
- ; ===============================
- ; The Serial Must be the name*2.
- ; ===============================
- ==========================
- ; THE REVERSING PART :
- =========================
- ; Getting a serial from the Name :
- ; Each 2 characters of the serial give us 1 letter of the name , so we must extract 2 letters from one.
- ; Rotate Right 3 times the letter of the name.
- ; xor the letter with 43h.
- ; Divide the result by 10 (The MOD will be used to retrieve the 2nd letter) and the division result will be used to retrieve the 1st letter.
- ; MOD (2nd letter) : add 41h to the MOD
- ; RESULT (1st letter) : Add 41h to the Result
- ; Do it again with all the other letters and it'd be pwned.
Add Comment
Please, Sign In to add comment