from pwn import * from ctypes import * from libcfind import * from LibcSearcher import* import base64 import sys context(os='linux', arch='amd64', log_level='debug') context.terminal = ["tmux","splitw","-h"] debug = 0 if debug: p = process('./pwn') elf = ELF('./pwn') # p = process('', env={'LD_PRELOAD':'./libc.so'}) # gdb.attach(p) else: p = remote('192.168.18.22', 7777) elf = ELF('./pwn') # ----------------------------------------------------------------------- s = lambda data: p.send(data) sa = lambda text, data: p.sendafter(text, data) sl = lambda data: p.sendline(data) sla = lambda text, data: p.sendlineafter(text, data) r = lambda num=4096: p.recv(num) rl = lambda text: p.recvuntil(text) pr = lambda num=4096: sys.stdout.write(p.recv(num)) inter = lambda: p.interactive() l32 = lambda: u32(p.recvuntil('\xf7')[-4:].ljust(4,'\x00')) l64 = lambda: u64(p.recvuntil('\x7f')[-6:].ljust(8,'\x00')) uu32 = lambda: u32(p.recv(4).ljust(4, '\x00')) uu64 = lambda: u64(p.recv(6).ljust(8, '\x00')) int16 = lambda data: int(data, 16) lg = lambda s, num: p.success('%s -> 0x%x' % (s, num)) # ----------------------------------------------------------------------- defadd(index,num,content): rl("4:This old man's case is no longer needed") sl('1') rl("Which elderly case do you need to add?") sl(str(index)) rl("How much content does this elderly person's case need to include?:") sl(str(num)) rl("So what are you going to write about:") sl(content) defshow(index): rl("4:This old man's case is no longer needed") sl('2') rl("Which elderly case do you want to show?") sl(str(index)) defdelete(index): rl("4:This old man's case is no longer needed") sl('4') rl("Which elderly case do you want to delete?") sl(str(index)) defedit(index,content): rl("4:This old man's case is no longer needed") sl('3') rl("Which elderly case do you want to edit?") sl(str(index)) rl("So what are you going to write about:") sl(content)
import libnum import gmpy2 import binascii withopen('./flag.enc','rb') as f: txt = f.read() print(txt) c = int(binascii.b2a_hex(txt).decode(),16)
print(c)
N = 0xC2636AE5C3D8E43FFB97AB09028F1AAC6C0BF6CD3D70EBCA281BFFE97FBE30DD print(N) p = 275127860351348928173285174381581152299 q = 319576316814478949870590164193048041239
phi = (p-1)*(q-1) d = libnum.invmod(65537,phi) print(d)