-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelx11.py
More file actions
79 lines (71 loc) · 1.51 KB
/
Levelx11.py
File metadata and controls
79 lines (71 loc) · 1.51 KB
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
from pwn import *
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"levelx11")
log.success("Receiving Challenge")
data_chall = s.recv(1024)
print(data_chall)
data_chall = data_chall.decode().split(" ")
MORSE_CODE_DICT = {
"A": ".-",
"B": "-...",
"C": "-.-.",
"D": "-..",
"E": ".",
"F": "..-.",
"G": "--.",
"H": "....",
"I": "..",
"J": ".---",
"K": "-.-",
"L": ".-..",
"M": "--",
"N": "-.",
"O": "---",
"P": ".--.",
"Q": "--.-",
"R": ".-.",
"S": "...",
"T": "-",
"U": "..-",
"V": "...-",
"W": ".--",
"X": "-..-",
"Y": "-.--",
"Z": "--..",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
"9": "----.",
"0": "-----",
", ": "--..--",
".": ".-.-.-",
"?": "..--..",
"/": "-..-.",
"-": "-....-",
"(": "-.--.",
")": "-.--.-",
}
data_chall_res = []
for citext in data_chall:
tmp = list(MORSE_CODE_DICT.keys())[list(MORSE_CODE_DICT.values()).index(citext)]
# print(tmp)
data_chall_res += tmp
data_chall = "".join(data_chall_res).encode()
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())