高校公开
re¶
fxck¶
# import base64
# import string
# str1 = "ZmxhZ#tiYXNlNjRfRjRubnl("
# string1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz)!@#$%^&*(+/="
# string2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
# print(base64.b64decode(str1.translate(str.maketrans(string1, string2))))
# a = "DH~mqqvqxB^||zll@Jq~jkwpmvez{"
# for x in a:
# print(chr(ord(x) ^ 0x1f), end='')
__b58chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ123456789abcdefghijkmnopqrstuvwxyz'
# base58_tables
__b58base = len(__b58chars)
def b58encode(v):
""" encode v, which is a string of bytes, to base58.
"""
long_value = int(v.encode("hex_codec"), 16)
result = ''
while long_value >= __b58base:
div, mod = divmod(long_value, __b58base)
result = __b58chars[mod] + result
long_value = div
result = __b58chars[long_value] + result
# Bitcoin does a little leading-zero-compression:
# leading 0-bytes in the input become leading-1s
nPad = 0
for c in v:
if c == '\0':
nPad += 1
else:
break
return (__b58chars[0] * nPad) + result
def b58decode(v):
""" decode v into a string of len bytes
"""
long_value = 0
for (i, c) in enumerate(v[::-1]):
long_value += __b58chars.find(c) * (__b58base ** i)
result = ''
while long_value >= 256:
div, mod = divmod(long_value, 256)
result = chr(mod) + result
long_value = div
result = chr(long_value) + result
nPad = 0
for c in v:
if c == __b58chars[0]:
nPad += 1
else:
break
result = chr(0) * nPad + result
return result
if __name__ == "__main__":
# print "flag{ => "+b58encode("flag{12345678901234567890123456789012}")
# print "flag => "+b58encode("flag")
print(b58decode("4VyhuTqRfYFnQ85Bcw5XcDr3ScNBjf5CzwUdWKVM7SSVqBrkvYGt7SSUJe"))
# GuHoa5kBDyh9dCH41YguMpnpwE9x3
code = [
0xC5, 0xDD, 0xC5, 0xC5, 0xC5, 0xA9, 0xC4, 0xA8, 0xFD, 0xA9, 0xC5, 0xC5, 0x01, 0xC4, 0xDD, 0xC5, 0xC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C5, 0xC5, 0x01, 0xC5, 0xC5, 0xC5, 0xDD, 0xC5, 0xA9, 0xC4, 0xC4, 0xC4, 0xA8, 0xFD, 0xA9, 0x01, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0x01, 0xC5, 0xC5, 0xC5, 0xC5, 0xC5, 0x01, 0xC5, 0x01, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xDD, 0xC5, 0xA9, 0xC4, 0xC4, 0xA8, 0xFD, 0xA9, 0xC4, 0x01, 0xC5, 0xDD, 0xC5, 0xC5, 0xA9, 0xC4, 0xA8, 0xFD, 0xA9, 0xC5, 0xC5, 0x01, 0xC5, 0x01, 0xA9, 0xC5, 0xDD, 0xC5, 0xC5, 0xC5, 0xA9, 0xC4, 0xA8, 0xFD, 0xA9, 0xC5, 0xC5, 0x01, 0xC5, 0x01, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0x01]
fuck_len = len(code)
k = 0
arr_500 = [0] * 500
fd_1000 = [0] * 1000
inc = 0
while k < fuck_len:
if code[k] == 0xDD:
arr_500[inc] = k
inc += 1
if code[k] == 0xfd:
fd_1000[k] = arr_500[inc - 1]
fd_1000[arr_500[inc - 1]] = k
inc += 1
k += 1
pc = 0
while (pc < fuck_len):
c = code[pc]
if c == 0xc4:
print(pc, "++*index")
if c == 0xDD:
print(pc, "if *index==0")
print(" jmp "+str(fd_1000[pc]+1))
if c == 0xfd:
print(pc, "jmp " + str(fd_1000[pc]))
if c == 0xc5:
print(pc, "--*index")
if c == 0xa8:
print(pc, "++inedx")
if c == 0xa9:
print(pc, "--index")
if c == 1:
print(pc, "v8++")
print(" if cipher[v8]!=*index")
print(" return 0;")
pc += 1
本页面的全部内容在 CC BY-NC-SA 4.0 协议之条款下提供,附加条款亦可能应用。