| Adding windowshell.py - brcon2025-hackathons - Bitreichcon 2025 Hackathons | |
| git clone git://bitreich.org/brcon2025-hackathons git://enlrupgkhuxnvlhsf6lc3fz… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| --- | |
| commit 21bcb97ccf369f776500e8215bf6372a86945530 | |
| parent f10e342fba766304ea9cf5727682a096ffea4a30 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Thu, 31 Jul 2025 21:43:02 +0200 | |
| Adding windowshell.py | |
| Diffstat: | |
| A seeedfarming/windowshell.py | 57 +++++++++++++++++++++++++++++… | |
| 1 file changed, 57 insertions(+), 0 deletions(-) | |
| --- | |
| diff --git a/seeedfarming/windowshell.py b/seeedfarming/windowshell.py | |
| @@ -0,0 +1,57 @@ | |
| +#!/usr/bin/env micropython | |
| +# coding=utf-8 | |
| +# | |
| +# Microsoft Windows is Hell. | |
| +# | |
| + | |
| +import network | |
| +import socket | |
| +import time | |
| + | |
| +wlan = network.WLAN() | |
| +wlan.active(True) | |
| +wlan.scan() | |
| +wlan.connect('seeeder', 'seeedrooots') | |
| + | |
| +while not wlan.isconnected(): | |
| + print('.', end='') | |
| +print(' connected') | |
| + | |
| +myip = wlan.ipconfig('addr4')[0] | |
| +print(myip) | |
| + | |
| +myport = 70 | |
| + | |
| +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| +s.bind((myip, myport)) | |
| +s.listen(9) | |
| + | |
| +def gopher_info(line): | |
| + line = line.replace("\t", " ") | |
| + print("i%s\t\t\t\t\r\n" % (line)) | |
| + | |
| +def gopher_print(text): | |
| + for line in text.split("\n"): | |
| + gopher_info(line) | |
| + | |
| +def gopher_link(baseselector, newdir): | |
| + newdir = newdir.replace("\t", " ") | |
| + printf("1%s\t%s/%s\t%s\t%s\r\n" % (newdir, baseselector, newdir, | |
| + myserver, myport)) | |
| + | |
| +endserial="66666666666666666" | |
| + | |
| +while True: | |
| + conn, addr = s.accept() | |
| + print('Connected with %s:%s' % (addr[0], addr[1])) | |
| + selector = conn.read() | |
| + selectorpath = selector.split("/") | |
| + serialnumber = "".join(selectorpath) | |
| + if serialnumber == endserial: | |
| + gopher_print("You found the right serial number!\nHave a nice … | |
| + print("%s:%s found the exit from windows hell!" % (addr[0], ad… | |
| + else: | |
| + gopher_print("Welcome to Windows Hell!\nTry to find the Serial… | |
| + for number in range(0, 9): | |
| + gopher_link(selector, number) | |
| + |