Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. """Validate key for kisslicer, but in reverse."""
  4.  
  5.  
  6. import os
  7. import sys
  8.  
  9.  
  10. def __init__(self):
  11. self.stats = {}
  12.  
  13. def rol(input, count):
  14. input = input << count
  15. input |= input >> 32
  16. input &= 0xFFFFFFFF
  17. return input
  18.  
  19. def ror(input, count):
  20. input &= 0xFFFFFFFF
  21. input |= input << 32
  22. input = input >> count
  23. input &= 0xFFFFFFFF
  24. return input
  25.  
  26. def sar(input, count):
  27. input &= 0xFF
  28. if (input & 0x8000):
  29. for x in range (0, count):
  30. input = input >> 1
  31. input = input | 0x8000
  32. else:
  33. input = input >> count
  34. return input
  35.  
  36. def finalMask(mask, mask2):
  37. mask -= mask2
  38. if mask < 0:
  39. mask = mask + 2**32
  40. #print "Sub: " + hex(mask)
  41. mask = rol(mask,0xF);
  42. return mask
  43.  
  44. #Start main
  45.  
  46. edx = 0
  47. r9 = 0
  48.  
  49.  
  50. rdx = 0x1245ABDE
  51. name = raw_input('What\'s your name? ')
  52. rcx = 0x3C
  53.  
  54. print "Input: " + name
  55.  
  56. name = name.lower()
  57.  
  58. ##########################
  59. #DEAFBEAD portion / third step
  60. mask = 0xDEAFBEAD
  61. mask2 = 0x7F7F7F80
  62. cycles = 0x61
  63.  
  64. #print "Mask: " + hex(mask)
  65. for x in range (0, cycles):
  66. mask = finalMask(mask, mask2)
  67. #print "Cycle: " + hex(cycles - x) + ". Mask: " + hex(mask)
  68.  
  69. #print "Mask: " + hex(mask)
  70. #############################
  71.  
  72.  
  73. #These are final values that we want - mask lower 4 bits don't care
  74. rcx = 0
  75. rdx = mask
  76.  
  77. ##############################
  78. #Second step - backwards
  79. for x in range (0, len(name)):
  80. rax = ord(name[(len(name) - 1) - x])
  81. rcx = rcx ^ rax
  82.  
  83.  
  84. rcx = (rcx << 5) | (rcx >> 3)
  85.  
  86.  
  87. rcx = rcx & 0xFF
  88.  
  89.  
  90. rdx = rax ^ rdx
  91. #print "1 RDX: " + hex(rdx)
  92. rdx = ror(rdx,0x11)
  93. #print "2 RDX: " + hex(rdx)
  94.  
  95. #rax = name[x]
  96. #print "RAX: " + hex(rax) + " - RDX: " + hex(rdx) + " - RCX: " + hex(rcx)
  97.  
  98. #print "FINAL RAX: " + hex(rax) + " - RDX: " + hex(rdx) + " - RCX: " + hex(rcx)
  99.  
  100.  
  101. ##############################
  102. #First step - backwards
  103.  
  104.  
  105.  
  106.  
  107. compare = mask ^ rdx
  108.  
  109. compare = compare >> 4
  110.  
  111. if compare == 0:
  112. print "Panic! Panic in the disco!"
  113.  
  114. 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)
  115.  
  116. wait = raw_input("PRESS ENTER TO CONTINUE.")
  117. print "Quitting..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement