Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- """Validate key for kisslicer, but in reverse."""
- import os
- import sys
- def __init__(self):
- self.stats = {}
- def rol(input, count):
- input = input << count
- input |= input >> 32
- input &= 0xFFFFFFFF
- return input
- def ror(input, count):
- input &= 0xFFFFFFFF
- input |= input << 32
- input = input >> count
- input &= 0xFFFFFFFF
- return input
- def sar(input, count):
- input &= 0xFF
- if (input & 0x8000):
- for x in range (0, count):
- input = input >> 1
- input = input | 0x8000
- else:
- input = input >> count
- return input
- def finalMask(mask, mask2):
- mask -= mask2
- if mask < 0:
- mask = mask + 2**32
- #print "Sub: " + hex(mask)
- mask = rol(mask,0xF);
- return mask
- #Start main
- edx = 0
- r9 = 0
- rdx = 0x1245ABDE
- name = raw_input('What\'s your name? ')
- rcx = 0x3C
- print "Input: " + name
- name = name.lower()
- ##########################
- #DEAFBEAD portion / third step
- mask = 0xDEAFBEAD
- mask2 = 0x7F7F7F80
- cycles = 0x61
- #print "Mask: " + hex(mask)
- for x in range (0, cycles):
- mask = finalMask(mask, mask2)
- #print "Cycle: " + hex(cycles - x) + ". Mask: " + hex(mask)
- #print "Mask: " + hex(mask)
- #############################
- #These are final values that we want - mask lower 4 bits don't care
- rcx = 0
- rdx = mask
- ##############################
- #Second step - backwards
- for x in range (0, len(name)):
- rax = ord(name[(len(name) - 1) - x])
- rcx = rcx ^ rax
- rcx = (rcx << 5) | (rcx >> 3)
- rcx = rcx & 0xFF
- rdx = rax ^ rdx
- #print "1 RDX: " + hex(rdx)
- rdx = ror(rdx,0x11)
- #print "2 RDX: " + hex(rdx)
- #rax = name[x]
- #print "RAX: " + hex(rax) + " - RDX: " + hex(rdx) + " - RCX: " + hex(rcx)
- #print "FINAL RAX: " + hex(rax) + " - RDX: " + hex(rdx) + " - RCX: " + hex(rcx)
- ##############################
- #First step - backwards
- compare = mask ^ rdx
- compare = compare >> 4
- if compare == 0:
- print "Panic! Panic in the disco!"
- print "Final Key: {:2x}{:1x}{:2x}-{}-{:2x}{:1x}{:2x}".format(rdx >> 24,rcx >> 4,(rdx >> 16) & 0xFF,name,(rdx >> 8) & 0xFF,rcx & 0xF,rdx & 0xFF)
- wait = raw_input("PRESS ENTER TO CONTINUE.")
- print "Quitting..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement