zhouat / ctf

0 stars 0 forks source link

wp for http://ssctf.seclover.com/challenge/4/ #4

Open zhouat opened 7 years ago

zhouat commented 7 years ago
def lol(str='',offset=0):
    if str.islower():
        return  chr(ord(str) + offset) if (ord(str) + offset) <= ord('z') else chr((ord(str) + offset) % (ord('z') + 1)+ord('a'))
    elif str.isupper():
        return chr(ord(str) + offset) if (ord(str) + offset) <= ord('Z') else chr((ord(str) + offset) % (ord('Z') + 1) + ord('A'))
    else:
        return str
# -*- coding: utf_8 -*-
e = raw_input('input\n')
elen = len(e)
field=[]
for i in range(2,elen):
            if(elen%i==0):
                field.append(i)

for f in field:
    b = elen / f
    result = {x:'' for x in range(b)}
    for i in range(elen):
        a = i % b;
        result.update({a:result[a] + e[i]})
    d = ''
    for i in range(b):
        d = d + result[i]
    print f,'\t',d
zhouat commented 7 years ago
str=zlib.decompress(message.decode("hex"))

import Image
MAX = 25
pic = Image.new("RGB",(MAX, MAX))
i=0
for y in range (0,MAX):
    for x in range (0,MAX):
        if(str[i] == '1'):
            pic.putpixel([x,y],(0, 0, 0))
        else:
            pic.putpixel([x,y],(255,255,255))
        i = i+1
pic.show()
pic.save("flag.png")