-
Notifications
You must be signed in to change notification settings - Fork 1
/
torque__init.py
292 lines (260 loc) · 11.2 KB
/
torque__init.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
' # This file is part of the Troopers 19 Badge project, https://troopers.de/troopers19/#
# The BSD 3-Clause License
#
# Copyright (c) 2019 @hnzlmnn, @br3zel
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import display
import time
import random
from system import app, screen, Kernel
from machine import Pin, I2C
class StartScreen(screen.Screen):
ACTION_TITLE = 0
ACTION_GAME = 1
MENU_ITEMS = [
{\'text\': \'TORQUE-A TR19 Zork adventure\', \'action\': ACTION_TITLE},
{\'text\': \'Start\', \'action\': ACTION_GAME},
]
def on_menu_selection(self, item):
if item[\'action\'] == self.ACTION_GAME:
return Kernel.ACTION_LOAD_SCREEN, 1
class GameScreen(screen.Screen):
loop = 4
response = ""
# So you are using the SOURCE? Good! Here is your not properly secured BROT64: fzKdeUF1NXJjPjJjMDKdeUNxZ0RjPjJ2OEhzMUNyNUVuNEB0Oj1yPUB1MUZ0OUJjgR==
story = {
4: (
"You arrive in the cyberspace, west of a datacenter\
A (secret) path leads southwest into a domain forest.\
A mailbox is in front of you ", {
"open mailbox": (
"It is secured with military grade encryption.",
None
),
"break encryption": (
"Decypting the mailbox reveals tons of\
mails and an attachment that catches your\
attention...a PDF.",
None
),
"go east": (
"The datacenter is secured with a firewall.",
None
),
"bypass firewall": (
"It is NEXT-GEN...it is impossible to bypass a nextgen firewall.",
None
),
"look at datacenter": (
"The datacenter is a beautiful building which is painted in blue, red, yellow, blue, green, red. It is clear that the owners are extremely wealthy and heavily guarded.",
None
),
"access datacenter": (
"It is secured with a firewall.",
None
),
"open pdf": (
"Howdy F.U.C.S.S Agent.\
Your mission as a F.U.C.S.S agent as part of TORQUE is to find the evil forces\
behind the SHADOWBROKER and VAULT7 leaks. Use the TORQUE, agent. At the end of the message there is a strange string... ",
None
),
"read pdf": (
"Howdy F.U.C.S.S Agent.\
Your mission as a F.U.C.S.S agent as part of TORQUE is to find the evil forces\
behind the SHADOWBROKER and VAULT7 leaks. Use the TORQUE, agent. At the end of the message there is a strange string... ",
None
),
"read string": ("n7SlmcN9VfRrXrSamfe1kPe3mPe1if24kf++kvu0hgayk/C8mferigSAhfWxmfCwlAiulvG7iPC+kvlrULSlmcV5h8ZrXrR+VMh7Uch9VMt2Xcp8WL95WMt7Uct/XMlroZ==\
You save it for later...",
None
),
"man torque": (
"This is a classical text adventure just like the old zork game. Either use directions like go north, go southwest or perform actions on items(e.g. open something, break something,look at,inspect,break,...)",
None
),
"help": (
"This is a classical text adventure just like the old zork game. Either use directions like go north, go southwest or perform actions on items(e.g. open something, break something,look at...",
None
),
"go southwest": (
"Entering the domain forest...",
8
),
}
),
8: ("Entering the domain forest reveals\
underground TOR tunnels in all directions.\
The 0DAY is strong with the east.", {
"go west": ("Darknet dealers are in your way trying to sell you prohibited goods. You leave.",
None
),
"go north": ("The domain forest becomes impenetrable to the North.",
None
),
"go south": (
"Darknet hitmen trying to sell you an assissination. You turn around...",
None),
"go east": (
"Naughty Naughty.Following the 0DAY.\
Going east...",
9
),
}),
9: (
"You are in a clearing, with unproteced\
forests surrounding you on all sides.\
A path leads south.", {
"go west": ("Your credentails are not valid in this part of the domain forest. You leave ...",
None
),
"go north": ("Dark clouds nebulize your view, you turn back.",
None
),
"go east": (
"Broadcaststorm-tossed connections block your way.",
None),
"go south": ("Going south unveils a cave...",
10
),
}
),
10: ("You are in a tiny exploit cave with a\
dark, forbidding staircase leading down. There is a crashed FishBowl agent in one corner.", {
"take agent": ("Why would you do that? Are you some sort of zombie process?",
None
),
"inspect agent": ("CONGRATS!\
You found what you were looking for...\
Infoleaks contain exploit blueprints proving that @FishBowl is behind the leaks. Go deeper...", 10),
"smash agent": ("Sick person. Have some respect mate.",
None
),
"break agent": ("I have two questions: Why and with What? It is already crashed.",
None
),
"go deeper": ("Going deeper...just like LeoDiCaprio\
*dramaticalmusicinthebackground*",
11 # changed from 11
),
"go down staircase": ("Going down...",
11
),
"scale staircase": ("Going down...",
11
),
"descend staircase": ("Descending the staircase...",
11
),
"suicide": ("You disable your Windows XP firewall. You die.",
4
), }),
11: ("You have entered a cryptocurrency-floored room. Lying half buried in already used exploits there is an old crypto wallet, bulging with bitcoins.",
{
"open wallet": ("Opening...Checking your F.U.C.S.S hacking equipment...", 12),
})
}
def update(self):
chapter = self.story.get(self.loop, None)
if self.loop == 12:
return Kernel.ACTION_LOAD_SCREEN, 2
if chapter == None:
self.loop = 4
return Kernel.ACTION_RELOAD
if self.response != \'\':
self.display.fill(display.BACKGROUND)
self.display.text(self.response, 0, y=0,
wrap=display.WRAP_INDENT, update=True)
time.sleep(5)
self.input.get_user_input(self, 1, title=chapter[0]+"\
What do you do?", title_wrap=display.WRAP_INDENT)
def on_text(self, event):
if event.value is None:
return self.back()
self.response = \'\'
chapter = self.story.get(self.loop, None)
if chapter == None:
self.loop = 4
else:
value = event.value.lower()
if value == "":
return Kernel.ACTION_RELOAD
path = chapter[1].get(event.value.lower(), None)
if path is None:
return Kernel.ACTION_RELOAD
else:
self.response = path[0]
if path[1] is not None:
self.loop = path[1]
return Kernel.ACTION_RELOAD
def back(self, event):
self.RENDER = True
return Kernel.ACTION_LOAD_SCREEN, 0
class EndScreen(screen.Screen):
def wheel(self, pos):
if pos < 85:
return pos * 3, 255 - pos * 3, 0
elif pos < 170:
pos -= 85
return 255 - pos * 3, 0, pos * 3
else:
pos -= 170
return 0, pos * 3, 255 - pos * 3
def rainbow(self, state=None, direction=None):
if state is None:
state = (0, 1) # Marks the start of the LED
if direction is not None:
state = (state[0], int(direction))
for i in range(self.count):
self.set(self.wheel(int(i * 256 / self.count)),
lights=(i + state[0]) % self.count)
return (state[0] + state[1]) % self.count, state[1]
def update(self, delta=0):
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000)
i2ccount = i2c.scan() # HACK THE BADGE! JUST ATTACH ANY i2c device :-D
if len(i2ccount) == 5:
self.display.fill(display.BACKGROUND)
self.display.text("You receive a (sports car) KEY\
(https://brot64.eu/get-started/) with an engraving. It says:\
Quellentelekommunikationsueberwachungsverordnung.\
\
FIN! \
", 0, y=0, wrap=display.WRAP_INDENT, update=True)
return Kernel.ACTION_RELOAD
else:
self.display.fill(display.BACKGROUND)
self.display.text(
"You need F.U.C.C.S Hacking equipment from the soldering corner.\
", 0, y=0, wrap=display.WRAP_INDENT, update=True)
return Kernel.ACTION_RELOAD
class App(app.App):
VERSION = 1
screens = [
StartScreen(),
GameScreen(),
EndScreen(),
]
'