-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelx32.py
More file actions
43 lines (31 loc) · 946 Bytes
/
Levelx32.py
File metadata and controls
43 lines (31 loc) · 946 Bytes
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
from pwn import *
from hashlib import md5
HOST = "temperance.hackmyvm.eu"
PORT = 9988
context.proxy = (socks.SOCKS5, "localhost", 7891)
s = remote(HOST, PORT)
log.success("Receiving Introduction")
data_introduction = s.recv(1024)
print(data_introduction)
# send level information
s.send(b"levelx32")
log.success("Receiving Challenge")
data_chall = s.recv(1024)
print(data_chall)
def get_permutations(string):
from itertools import permutations
perms = permutations(string)
perms_list = ["".join(perm) for perm in perms]
return perms_list
data_chall = data_chall.decode().split(" ")
data_chall_list = get_permutations(data_chall[1])
for i in data_chall_list:
if md5(i.encode()).hexdigest() == data_chall[0]:
data_chall = i
break
log.success("Sending Challenge")
s.send(data_chall)
# Receive the flag / Recibe la flag.
log.success("Receiving Flag")
data_flag = s.recv(1024)
print(data_flag.decode())