Open marrold opened 2 years ago
Hey, this is awesome! Thanks for actually following through with what I was going to try to do a few months ago, and making Wordle accessible over dialup :)
So, the way I did this was to create a user and set their shell to the wordle game (or a script setting the "random" environment variable to "True" and then running the game, for the user play-random). But then of course I had exactly the same problem you did - I couldn't get it to work without specifying a user. And I wanted functionality exactly like that nyancat server - in fact I actually tried
Goddammit my finger slipped I didn't mean to do that. Anyway.
I actually tried onenetd as well, but got fed up trying to configure it and did something a bit more arcane. The BSD version of telnetd (installable on Linux) allows you to specify a custom login program. So, I simply wrote another python script to login automatically depending on what user was specified, or if no user was specified. This line in /etc/inetd.conf was all I needed to configure this:
telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd -L /telnet.py
Of course, you could literally just set the login program to the wordle game itself. But I wouldn't recommend this as then it would run as root.
Please let me know if you manage to get this working! I'm gonna try with mine again now uni's over for the year. And this EMF camp sounds interesting - I might get a ticket myself!
Cheers
Ah thanks for that additional info -would you mind sharing the other python script you were using to initialise it, And any other config?
I'm hoping to just spin up another instance that's always random and doesn't rely on the login to specify
Thanks
Sure no problem! I think this should be all the relevant information to get it working -
Telnet server: Debian package telnetd
.
/etc/inetd.conf:
telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd -L /telnet.py
/telnet.py:
#!/usr/bin/env python3
import os, sys
try:
if "play-random" in sys.argv or "random" in sys.argv:
os.system("/bin/login -f play-random")
elif "play-lineonly" in sys.argv:
os.system("/bin/login -f play-lineonly")
elif "play-lineonly-random" in sys.argv:
os.system("/bin/login -f play-lineonly-random")
elif "wordle" in sys.argv or "play" in sys.argv or len(sys.argv) <= 4:
os.system("/bin/login -f wordle")
else:
print("user account '", sys.argv[4], "' not recognised. defaulting to word of the day, normal mode.")
os.system("/bin/login -f wordle")
except: # don't spit out python errors if something goes wrong; just silently exit
pass
All you need to do is remove the if statement and replace it with a single call to os.system("/bin/login -f wordle")
. This assumes you have a user called wordle
whose shell is set to the wordle program (which you can edit lines 130-133 of to make it default to random play). Or, as mentioned, you could just cut out the middleman and put the wordle script itself in /telnet.py... but then it would run with root privileges, so probably better to drop to a user (the other benefit to this approach is it gives you ssh
for free).
Perfect, thanks.
Do you know where this "bian / Linux are free software" glitch is coming from? It doesn't happen from a modern terminal but does with Syncterm. Its like a MOTD or something
Thanks
touch /home/wordle/.hushlogin
seems to have fixed it
Ah I forgot about that - yeah, .hushlogin
is the answer!
Cheers
On Fri, 27 May 2022, 20:40 Matthew Harrold, @.***> wrote:
touch /home/wordle/.hushlogin seems to have fixed it
— Reply to this email directly, view it on GitHub https://github.com/xereeto/wordleTTY/issues/2#issuecomment-1139974108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEVQWFBCEQUUYG5F7CDGKDVMEQK5ANCNFSM5W3E3EGQ . You are receiving this because you modified the open/close state.Message ID: @.***>
Hi, First of all thanks for creating this, its amazing!
I'm hoping to do some modem stuff at https://www.emfcamp.org/ and figured as Wordle is the latest hotness I should try and make it accessible via modem, but I've hit a few stumbling blocks.
For a bit of context I'm using Cisco routers with built in modems. They can then Telnet to a TCP service and bridge it to the modem. One caveat is they can't send a USER, but I want to play a random game.
I'm trying to run this in docker - I tried using onenetd to listen on a TCP port and run wordleTTY (similar to nyancat-server but if I use telnet it throws an exception and exits
I have a bit more luck with
nc
but there's some alignment issues with the characters and problems deleting them.Could you let me know how you're running it on your hosted system so I could attempt to copy it?
Any other suggestions appreciated
Thanks