Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import sys
print " [1] stage 1: rebuild encoding table with key = 0xd6"
line = "5a1f4ef6f88630f04cb7cae5892a1de416f53a27288d4009036f3699afaedbef15e78e63069c569a31e664b558954904eedf7e0bb1729676ad23b02fb2a77a"
alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
n = 2
keys = [line[i:i+n] for i in range(0, len(line), n)]
xlate = {}
for i in range(0,len(keys)):
key = keys[i]
c = alpha[i]
if key in xlate.keys():
print " [?] duplicate key %s" % key
xlate[key] = c
print " [2] stage 2: decrypt string with lookup table"
line = "234999582f722f492f72b19a7aaf72e6e776b57aee722fe77ab5ad9aaeb156729676ae7a236d99b1df"
out = ""
target = [line[i:i+n] for i in range(0, len(line), n)]
for i in range(0,len(target)):
out += xlate[target[i]]
print " missing key: %s" % target[i]
out += "?"
# 5UBS717U710N_C1PH3R_W17H_R4ND0M123D_5?B0X"
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.