Introduction
Introduction Statistics Contact Development Disclaimer Help
windowshell.py - brcon2025-hackathons - Bitreichcon 2025 Hackathons
git clone git://bitreich.org/brcon2025-hackathons git://enlrupgkhuxnvlhsf6lc3fz…
Log
Files
Refs
Tags
---
windowshell.py (1684B)
---
1 #!/usr/bin/env micropython
2 # coding=utf-8
3 #
4 # Microsoft Windows is Hell.
5 #
6
7 import network
8 import socket
9
10 wlan = network.WLAN()
11 wlan.active(True)
12 wlan.scan()
13 wlan.connect('seeeder', 'seeedrooots')
14
15 while not wlan.isconnected():
16 print('.', end='')
17
18 print(' connected')
19
20 myip = wlan.ipconfig('addr4')[0]
21 print(myip)
22
23 bindport = 70
24 maxconn = 100
25 myport = 7000 + int(myip.split('.')[3])
26 myserver = 'bitreich.org'
27
28 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
29 s.bind((myip, bindport))
30 s.listen(maxconn)
31
32 print("available at gopher://%s:%u/1/" % (myserver, myport))
33
34 def gopher_info(conn, line):
35 line = line.replace("\t", " ")
36 s = "i%s\t\t\t\t\r\n" % (line)
37 conn.write(s.encode())
38
39 def gopher_print(conn, text):
40 for line in text.split("\n"):
41 gopher_info(conn, line)
42
43 def gopher_link(conn, baseselector, newdir):
44 newdir = newdir.replace("\t", " ")
45 s = "1%s\t%s/%s\t%s\t%s\r\n" % (newdir, baseselector, newdir, my…
46 conn.write(s.encode())
47
48 endserial="66666666666666666"
49
50 while True:
51 conn, addr = s.accept()
52 print('Connected with %s:%s' % (addr[0], addr[1]))
53 selector = conn.readline().decode().rstrip()
54 print('read %s from client\n' % selector)
55 selectorpath = selector.split("/")
56 serialnumber = "".join(selectorpath)
57 if serialnumber == endserial:
58 gopher_print(conn, "You found the right serial number!\n…
59 print("%s:%s found the exit from windows hell!" % (addr[…
60 else:
61 gopher_print(conn, "Welcome to Windows Hell!\nTry to fin…
62 for number in range(0, 9):
63 gopher_link(conn, selector, str(number))
64 conn.write(".\r\n".encode())
65 conn.close()
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.