key.txt -> escape-room.exe ->나오는 페이지에서 진행(escaperoom.py)
text = 'password is "p4ssw0rd"'
compression = ''
for i in text:
compression += bin(ord(i))[2:].zfill(8)
print(compression)
zflag = True
compressionText = ''
count = 0
num = 0
temp = 0
while True:
if zflag:
temp = count
try:
count += compression[count:].index('1')
num = count
sub = num-temp
except:
sub = len(compression[count:])
compressionText += str(sub) # f"0{sub}"
break
compressionText += str(sub) # f"0{sub}"
# print(count)
zflag = False
else:
temp = count
try:
count += compression[count:].index('0')
num = count
sub = num-temp
except:
sub = len(compression[count:])
compressionText += str(sub) # f"1{sub}"
break
compressionText += str(sub) # f"1{sub}"
# print(count)
zflag = True
print(compressionText)
run length encoding 기법으로 문자열 비트단위로 압축시키는 코드
compressionText = '135241132213221313121413212221416211211322217131236211332213221313225321222141311'
bitString =''
zFlag = True
for i in compressionText:
if zFlag:
bitString += '0'* int(i)
else:
bitString += '1'* int(i)
zFlag = not zFlag
print(bitString)
pw = ''
for i in range(0, 176, 8):
pw += chr(int(bitString[i:i+8:], base=2))
print(pw)
압축문을 평문으로 변환시키는 코드
'교내해킹대회 > Web' 카테고리의 다른 글
Injection (0) | 2020.05.14 |
---|---|
투명망토 (0) | 2020.05.14 |
Captcha Challenge (0) | 2020.05.09 |
blind_sqli (0) | 2020.05.02 |
File upload 문제 설계 과정 (0) | 2020.04.30 |