-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquick-maths.py
48 lines (36 loc) · 1.17 KB
/
quick-maths.py
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
from pwn import *
p = remote('pwn.ctf.unswsecurity.com',7002)
p.recvuntil('What\'s ')
number = p.recvuntil(' in hexadecimal', drop=True)
p.sendline(hex(int(number)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in octal', drop=True)
p.sendline(oct(int(number)))
p.recvuntil('What\'s ')
a = p.recvuntil(' + ', drop=True)
b = p.recvuntil('?', drop=True)
p.sendline(str(int(a) + int(b)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in decimal', drop=True)
p.sendline(str(int(number,2)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in octal', drop=True)
p.sendline(oct(int(number,2)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in hexadecimal', drop=True)
p.sendline(hex(int(number,2)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in binary', drop=True)
p.sendline(bin(int(number,16)))
p.recvuntil('What\'s ')
number = p.recvuntil(' in octal', drop=True)
p.sendline(oct(int(number,16)))
p.recvuntil('What\'s ')
a = p.recvuntil(' + ', drop=True)
b = p.recvuntil(' in decimal', drop=True)
p.sendline(str(int(a,16) + int(b,2)))
p.recvuntil('What\'s ')
a = p.recvuntil(' + ', drop=True)
b = p.recvuntil(' in octal', drop=True)
p.sendline(oct(int(a,16) + int(b,2)))
p.interactive()