11 ms·
Still Love Telnet
- trollied 3y agoI guess telnet is going to make us oldies feel old. They don't teach it these days :)
- applied_heat 3y agoI used to use it for sending test emails via smtp when troubleshooting other clients struggling to send
- chasil 3y agoNetcat is really a cleaner solution from this perspective. Netcat, combined with the openssl utility, can do some amazing things with moving files over SMTP. I can post my favorite hand-rolled script if there is interest. I boiled it out of mpack down to the shell.
- pmontra 3y agoPlease, post it or post an URL to the script.
- chasil 3y agoHere is the script. This is like FTP/scp to an inbox. Remove the two leading spaces that HN needs in quoting code blocks. This uses OpenSSL to a) send a base64-encoded MD5 hash of each file in the headers, then b) base64-encode the file itself. There is also an OpenSSL "smime" applet, but I really don't know what it does. The netcat is going to send this over cleartext; use OpenSSL s_client (or maybe "nc -ssl" if your netcat supports it) if cleartext is a problem. This is written in dash, so it should run in most POSIX-compliant shells. Note that local variables are not POSIX-compliant; for a true POSIX shell, change the shell function to "mimer () ( ...body ...)" to force a subshell. Shellcheck doesn't like printf formats done like this, but you can't please everybody. This also works in Windows with ports of OpenSSL and busybox, btw. $ cat mimer #!/bin/dash mimer () { local f \ SMTP='smtp.yourco.com' \ BOUND="$(openssl rand -base64 21 | sed 's@[/+=]@_@g')" \ SFORMAT='helo %s mail from:%s rcpt to:%s data Mime-Version: 1.0 Subject: %s Content-Type: multipart/mixed; boundary="%s" This is a MIME encoded message. ' \ MFORMAT='%s Content-Type: application/octet-stream; name="%s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="%s" Content-MD5: %s ' { printf "$SFORMAT" "$HOSTNAME" "$2" "$1" "$3" "$BOUND" shift 3 while [ -n "$1" ] do f=${1##*/} printf "$MFORMAT" "--$BOUND" "$f" "$f" \ "$(openssl dgst -md5 -binary < "$1" | openssl base64)" # base64 < "$1" openssl base64 -in "$1" echo shift done printf '%s--\n.\nquit\n' "--$BOUND" } | sed -e 's/$/\r/' | nc "$SMTP" 25 } [ -z "$4" ] && { echo mimer to from subject file1 '[file2]' ...; exit; } mimer "$@"
- hddqsb 3y agoNice, thanks for sharing. Not directly related, but since you mentioned s_client, please see my warning regarding its security: https://news.ycombinator.com/item?id=36179850#36186559 https://news.ycombinator.com/item?id=36179850#36186559
- fragmede 3y agoOver SMTP? I'm interested!
- chasil 3y agoI hope that you like it!
- yjftsjthsd-h 3y ago> Netcat, combined with the openssl utility At that point, wouldn't it be easier to just use socat?
- Melkman 3y agoSocat doesn't support STARTTLS. If you want to debug SMTP submission "openssl s_client -starttls smtp -connect server:587" is awesome. Just take care not to use upper case "R" or "Q". Man, why did they implement rekeying and quit in such a bothersome way. Just use recipient and quit instead of RECIPIENT and QUIT.
- jwilk 3y agoSince OpenSSL 1.1.0, you can turn it off with -nocommands: https://github.com/openssl/openssl/commit/6ba8a5b77af5792b https://github.com/openssl/openssl/commit/6ba8a5b77af5792b
- hddqsb 3y agoSee my warning regarding s_client and security: https://news.ycombinator.com/item?id=36179850#36186559 https://news.ycombinator.com/item?id=36179850#36186559
- hinkley 3y agoLong, long ago in a galaxy far, far away, I used it to debug browser parsing issues. Curl has been around for ages, but not for the entire WWW age.
- kstrauser 3y agoMy fingers type “telnet” themselves out of muscle memory, but is it actually better for anything than netcat?
- belter 3y agoNeat NCAT Tricks: https://nmap.org/ncat/guide/ncat-tricks.html https://nmap.org/ncat/guide/ncat-tricks.html https://nmap.org/ncat/guide/ncat-simple-services.html https://nmap.org/ncat/guide/ncat-simple-services.html https://nmap.org/ncat/guide/ncat-broker.html https://nmap.org/ncat/guide/ncat-broker.html
- kqr 3y agoIt took me a while but is Ncat the same thing as netcat? Edit: ah, clarified by other page: > Ncat is our modern reinvention of the venerable Netcat (nc) tool released by Hobbit in 1996. While Ncat is similar to Netcat in spirit, they don't share any source code.
- JdeBP 3y agoThere are actually several tools in this vein. Although there are a handful that do, some others don't even go by the name "cat" at all.
- bdowling 3y agoShort version: Telnet better supports interactive terminal applications by exchanging info like the TERM environment setting, screen size, translation codes, etc. Netcat doesn’t do any of that, but is simpler and better suited for sending or receiving binary data. It also has features that telnet doesn’t, like listening for incoming TCP connections and sending and receiving on UDP ports.
- hddqsb 3y agoObligatory: Telnet is better than netcat for interactive logins, but SSH is even better than Telnet for that. So don't use Telnet.
- reaperducer 3y agoJust last week I set up a telnet connection to give a piece of legacy hardware access to the rest of the world. Better than throwing an old computer in the garbage. People act like if you're not connecting through SSH that you'll magically set the internet on fire. Not every connection needs to be secure. I don't care if hackers see me reading Radio France International.
- sigjuice 3y agoBut surely you would care if ads or other junk is getting injected into whatever you are reading?
- applied_heat 3y agoAds are already injected in just about everything I read, except for here
- qawwads 3y agoPeople insist on ssh being the secure option then go on to write confidential informations on Google Doc, then copy-paste it in Google Translate for translation and ChatGPT to get a summary, then mail everything using webmail.
- mk_stjames 3y agoI had an old device that spit out some odd format serial data I wanted to log recently. I pulled out an random ESP8266 on a tiny board from a drawer and quickly wrote some code to read a single pin for the Rx. I didn't have any memory onbaord to store anything, and figured it would be cool to just dump this data onto my network and use something else to check what the current value being reported was and log it on another machine. I could have used any number of packages that would create a little host on the ESP8266, or something that sends out MQTT packages to another server, etc etc. but you know what was quickest? Telnet server on port 23, open, blasting out the buffered serial data once every second. It just sits there and does this. And if I want the data I just point a dashboard to that IP at that port and out it flows. If the device loses power and reboots, it is back up in a fraction of a second. Security? who cares. it's some random numbers on my internal home network.
- chasil 3y ago> "For the purposes of logging into a remote server, you should never, and probably have never considered it." This is not true when the client and server have both implemented Wireguard. With Wireguard in place, it is safe to return to legacy telnet, ftp, and rsh. The use of rcp still remains problematic, for the same reasons that scp is deprecated. It is not best practice to return and rely on these legacy protocols, as they are bad habits and are vulnerable when Wireguard (or equivalent protections at a lower level in the network stack) are in place.
- pmontra 3y agoIs this the CVE that makes scp insecure? https://bugzilla.redhat.com/show_bug.cgi?id=1860487 https://bugzilla.redhat.com/show_bug.cgi?id=1860487
- arp242 3y agoYes, but note this is only the scp protocol. The /bin/scp tool uses the sftp protocol by default now, and you can just continue using it without problems (if you ssh is new enough; check the manpage).
- riffic 3y agozero trust begs to differ. practicing defense in depth is almost always a better approach.
- slondr 3y agoFor corporate environments sure, for my home lab that seems like overkill
- jcrawfordor 3y agoSSH is not overkill, it is the default. There are some narrow circumstances where you might have a good reason to use telnet in 2023, but they are edge cases related to legacy hardware and possibly occasionally the desire for easy on-path interception. It is very unlikely that you have a good reason to not just use SSH. Even if you care nothing about the security advantages, SSH has more consistent and better-defined behavior around 8-bit data, and offers far more features.
- placesalt 3y agoThere's a jpl service kicking around that's on telnet and is fun to play with. Nothing requiring a password - it's published material, essentially a website, but in command line form. Presumably the anon account permissions would take some care to set up, but once that's done it's a good interface, I think.
- Twisol 3y agoHorizons! https://ssd.jpl.nasa.gov/horizons/ https://ssd.jpl.nasa.gov/horizons/ IIRC, the Telnet interface is technically more fully-featured than the others, although that's probably simply because it would have come into existence first.
- anthk 3y agoMUDs are still fun. Altough I would love to have TTS support in Frotz and Flite.
- kazinator 3y agoI wonder what it would take to take a MUD which speaks only telnet, and make it work behind a sshd proxy, with regular ssh password auth. Somehow we would want sshd to authenticate users using their MUD user name and password, and connect locally to the MUD instance, passing the credentials somehow. The right way to do it is via libssh, I suppose; but that's integrating the SSH into the server.
- anthk 3y agoJust use a Tor hidden service. https://dataswamp.org/~solene/2018-10-11-tor-hidden-service.html https://dataswamp.org/~solene/2018-10-11-tor-hidden-service.... Replace the SSH port with the MUD one.
- ElongatedMusket 3y agoIs there a tool that has incorporated everything mentioned in this article into a one-liner app/script and spits out all the server replies and a diagnosis guess? Not intending to build it myself, just curious if it exists!
- nico 3y agoIn college, wow 23 years ago now, my school still had a Telnet interface for students to apply for spots in the classes they wanted for the following semester It was quickly replaced by a web interface, which I promptly hacked to be able to take whatever classes I wanted with priority over everyone else, fun times In case you are wondering, I let the admins know and they hired me to help them fix it Still use Telnet on a regular basis to test connectivity to web servers or other services Love connecting to port 80 and then typing: HEAD / HTTP 1.0\n\n It’s amazing to manually “talk” the protocol that browsers use to communicate with web servers
- floren 3y agoDuring my time at RIT, 2005-2010, you could apply for classes via a web interface, but if you wanted to actually get the good spots, you'd use the telnet interface. Specifically, you'd connect to a cluster of VMS machines (some VAXes, some Alphas) which had a text interface to the (reputedly) off-campus mainframe which did registration. I recall that "vaxa" was usually the most crowded because it was always listed first, but if you got on one of the Alpha systems it was more responsive. Everyone insisted that you MUST use telnet, not ssh (although ssh was enabled) because having hundreds of students logged onto each VAX was enough load already without introducing cryptography. If I remember right, you could get a list of who was logged in which indicated if they came in via telnet or SSH, and people did get shamed for using SSH.
- oldstrangers 3y agoI used telnet as a child to pretend I was a hacker. Then I used telnet as a child to actually hack into things. So much fun. And wardialing... Boy did I love wardialing.
- spicyusername 3y agonetcat is what all the cool kids use these days.
- jcrawfordor 3y agoI think a lot of this type of affection for telnet is misplaced. The fact that telnet functions acceptably as an arbitrary TCP client is an unintentional side effect of the design, not its purpose. netcat is not only a more feature complete tool for simple network connections and diagnosis, it gives clearer and more helpful output on the state of the connection when used with the verbose flag. The telnet client and protocol offer various gotchas that can appear as mysterious problems when you use them for troubleshooting instead of netcat. For example, telnet is not 8-bit clean because of the fact that it was designed specifically as a protocol to carry 7-bit ASCII. RFC 856 seeks to address this and netkit telnet can be told to behave in RFC 856 mode using the -8 option, but there can be variations between clients in this regard, and virtually no one uses the -8 flag anyway. netkit (Linux) telnet without the -8 option will behave oddly whenever non-ASCII characters are encountered, as they will be interpreted as control codes in the telnet protocol. It is a bit ironic, in this regard, that people using telnet as a TCP client almost always seem to be using it to troubleshoot SMTP - another protocol which is, for historic reasons, not 8-bit clean without extra work! And that kind of gets at the biggest problem: telnet is not an arbitrary TCP connection utility, it specifically implements the telnet protocol. The telnet protocol is very simple, but it is there, and common telnet clients will send unsolicited (by the user) bytes in various circumstances in order to perform the telnet protocol. This can break the state of other protocols when you use telnet as a TCP client. If you want a tool for network diagnosis or arbitrary connections, it is netcat. Telnet for this purpose is just a workaround that is becoming quite obsolete as fewer distributions include telnet by default (removing its primary advantage over netcat, that it is "already there"). Even bash's odd built-in TCP functionality is a better choice than telnet in a lot of these situations, as it's simpler and won't try to conform to the telnet protocol.
- gabereiser 3y agoThis is correct, telnet will send IAC codes (0x255) followed by two bytes. WILL, WONT, DO, DONT. If telnet encounters a IAC code, it will read the next two bytes or subcommand bytes hiding that from your output. Telnet should not be used for TCP debugging.
- 3y ago
- elliottkember 3y agoThe original version of Android, on the T-Mobile G1 / HTC Dream, had a bug where all characters were sent to the command line as root. I restarted my friend's phone, typed `telnetd` and was able to telnet into the phone. A surprising number of options were available over telnetd. I made a few calls!
- charcircuit 3y agoNeither telnet nor ssh handle problems like your laptop going to sleep or changing networks. These are stale and it in due time that we move to something better.
- chasil 3y agoI haven't used it, but mosh supposedly handles suspended sessions. Alternately, you can do the same with tmux or screen.
- kstrauser 3y agoMosh into a tmux session is dreamy. I can connect from my iPad to a remote server at home, carry it onto a bus and continue working, then carry to a coffee shop and finish what I was doing, all without ever having to reconnect.
- mlambie 3y agoI’ve had some success with eternal-terminal too, where mosh didn’t support true colour.
- deleted 3y ago[deleted]
- forgotmypw17 3y agoI agree, and about human-accessible protocols in general, like HTTP and IRC.
- idorosen 3y agoThe author is confused. They seem to have misspelled netcat. (“nc” on most distros.)
- VadimPR 3y agoMudlet (https://mudlet.org https://mudlet.org) is a scriptable, with Lua, telnet client that's pretty solid. Supports secure telnet over TLS as well.
- cbondurant 3y agoTo second the discussion everyone has about utilizing netcat instead I also want to point out that there is a tool on pretty much every linux machine ever that can perform netcat for SSL: `openssl s_client`. Ive used it on multiple occasions for toying with the HTTPS protocol and all of the features that only enable themselves when using a secure connection. It does just what netcat does, but initiates a secure SSL tunnel first.
- tedunangst 3y agoYou can't send a line containing only (make that beginning with) the letter R with s_client because that does a renegotiation.
- codetrotter 3y agoThat’s pretty interesting but also, how often do you find yourself needing to send a single capital “R” in practice? I mean, I assume at least once since you know about it. But for me, I don’t think I’ve ever typed a singular capital R anywhere on purpose.
- tedunangst 3y agoIt's actually any line starting with R, like Referrer: yahoo.com. Also any line starting with Q, like Quiet, will disconnect, because you obviously meant Quit.
- codetrotter 3y agoOof :/
- jandrese 3y agoTry the -nocommands option to disable that bit of braindamage.
- juped 3y agoif only someone were to add tls support to nc(1) or something
- senko 3y agotelnet towel.blinkenlights.nl (yes, it works with netcatting to port 23, as no Telnet IAC codes are being used, but for me it will forever be a telnet show).
- draxil 3y ago...but you should probably use netcat instead.
- nologic01 3y agoOk, that brought memories. Now back to the future and a post about Gopher.
- kune 3y agoWhy telnet, if you have `$ echo foo >/dev/tcp/localhost/8080`-
- yafbum 3y agoBased on the contents, there's a typo... It should read "still love netcat"
- op00to 3y agocurl telnet:// works nicely and curl is everywhere.
- deleted 3y ago[deleted]
- teleforce 3y agoFun facts, Telnet was actually the first Internet application and was also the very first killer application for the Internet. "The first data exchange over this new network occurred between computers at UCLA and the Stanford Research Institute. On their first attempt to log into Stanford's computer by typing "log win," UCLA researchers crashed their computer when they typed the letter 'g.'" [1]. [1] ARPAnet: The World's First Internet: https://www.thoughtco.com/arpanet-the-worlds-first-internet-4072558 https://www.thoughtco.com/arpanet-the-worlds-first-internet-...
- residualmind 3y agoIsn't this really what netcat is for? I've used telnet like this before I was really aware of netcat.. I even knew how to login to and use an irc server with telnet, PING/PONG included
- megous 3y agoOr socat with readline interface. Line editing, history, etc. Very convenient.
- jmartrican 3y agoCame here to rave about Telnet, and found out I'm just an old n00b that should be using netcat. Got it.
- LgWoodenBadger 3y agoTelnet reminds me of the days when the internet was mysterious and exotic machines of all types existed. I miss those times and often wonder what the world would be like had the internet remained as obscure (relatively) as it was back in the early 90s when I discovered it.
- twosdai 3y agoThey still do, infact they're are a LOT more. Just go looking. Google dorks are a lost cost and low effort way of searching for weird machines. https://www.exploit-db.com/google-hacking-database https://www.exploit-db.com/google-hacking-database This is an interesting site which has some commands you can look through. Note I would probably not be logged in with Google while trying this, just so you don't get flagged for review.
- throwawaaarrgh 3y agoTelnet (the command) is still how I discover who the admin is for any given mail server. Random OSes don't come with nc. telnet mail.foo.com 25 Connected to mail.foo.com port 25. EHLO mail.foo.com 250-mail.foo.com Hello [172.16.0.5] MAIL FROM: <me@myemail> 250 2.1.0 Sender OK RCPT TO: <root>, <admin>, <mail admin>, <postmaster> 250 2.1.5 Recipient OK DATA 354 Start mail input; end with <CRLF>.<CRLF> Subject: looking for mail admin Hello! I'm Blahblah, I really need to reach the mail admin. Who are you?? How can I reach you? .
- imoverclocked 3y agoIs putty still used significantly in the windows world? Is there something better these days?
- riffic 3y agoWindows Terminal is probably your best bet if you want a clean default https://github.com/microsoft/terminal https://github.com/microsoft/terminal
- zmvn8872hk 3y agoI would recommend windows terminal and the builtin windows openssh over putty these days if you must use windows. Anecdotally, a lot of the more senior windows admins at my work are still using putty and they do not seem interested one bit in switching. So putty definitely has some die-hard fans.
- JohnFen 3y agoWhy do you recommend this? I find putty to be a much nicer solution than windows terminal.
- JdeBP 3y agoMicrosoft Terminal still has some oddities that PuTTY does better, including REP of Supplementary Plane characters, but now the converse is also true. (-: * https://github.com/microsoft/terminal/issues/15390 https://github.com/microsoft/terminal/issues/15390 PuTTY is used in thin disguise by all MobaXTerm users, of course.
- raincole 3y agoFun fact: in Taiwan Telnet-based BBS is still quite popular today. The most popular forum, PTT, has 50~100k concurrent users.
- phendrenad2 3y agoWow that's interesting. Any similar ones in the US?
- maple3142 3y agoTelnet support for PTT has already been deprecated for security reason so I am not sure PTT still count as a telnet-based BBS. Only ssh and websocket is supported nowadays.
- JdeBP 3y agoWhether it counts depends from whether it's just "deprecated" or whether the users have actually stopped using it. Consider that the GNU version of "fgrep" was "deprecated" for just under 14 years. And yet people were very clearly still using it in 2022 (when the 2021 code change apparently hit Debian) and 2023 (when the change hit Chris Siebennmann).
- imoverclocked 3y agoAnyone else miss being able to just “talk” to people? It was the ultimate in distributed instant messaging. Instant down to the characters you were typing. I remember starting to craft a response before a friend was completely done asking a question … and then that friend stopping short and starting the next question before I was done answering.
- deleted 3y ago[deleted]
- haolez 3y agoI use netcat for this. Is telnet better somehow?
- hddqsb 3y agoNo, in fact telnet is worse because it's not 8-bit clean. See https://news.ycombinator.com/item?id=36179850#36180346 https://news.ycombinator.com/item?id=36179850#36180346 and https://news.ycombinator.com/item?id=36179850#36180923 https://news.ycombinator.com/item?id=36179850#36180923
- snarkypixel 3y agoTelnet was great. Had so much fun learning the IRC protocol with it.
- p5a0u9l 3y agoThat was terrible writing.
- thayne 3y agoI used to use telnet for this. Until,for compliance reasons, telnet was no longer allowed to be installed on many of the machines I work with. Now I use nc instead.
- warrenmiller 3y agoanyone miss ytalk :)
- pjmlp 3y agoThe SAMBA example will no longer work with the upcoming version of SMB protocol, that requires end to end encryption.
- dumpster_fire 3y agoTo be honest, I only know Telnet as the tool I used to play MUD games like Castle Arcanum.
- littlecranky67 3y agoI remember how I learned networking protocols basically over telnet in the 90s. You could send email by telnet'ing to some SMTP server, using the (HELO, MAIL FROM, RCPT TO commands). I of course debugged my HTTP cgi gateway using telnet and sending "GET / HTTP/1.1\nHost:somehost.com\n\n". I connected to IRC using telnet, joining channels and sending privmsgs (although answering PING requests from the server become annoying quickly). I learned that you can connect to FTPs using telnet, and on wrongly configured ones (FXP), you could use the FTP control channel to have the content of an arbitrary ASCII file be sent over a socket - just to use it to have the FTP server connect to an IRC server and send message to my online buddies. Good times. I look back at it with my rose-tinted glasses of course, but I wonder how it is today, given that everything is now SSL/TLS secured and you can basically not tamper with anything anymore without a deep understanding of the protocol and writing code first.
- augustk 3y agoThe next step could be to write a script which uses telnet and the other commands in the article to automatically pinpoint the connection problem, something like whatstheproblemwith hostname port
- p0w3n3d 3y agoTelnet is usually removed from all contemporary development servers as a "security compromising tool". This renders problems much more hard to diagnose
- hddqsb 3y agoIf netcat is installed, just use that instead (it's also better for non-telnet protocols). If you don't even have netcat but you do have bash, you can use: bash -c 'exec 3<>/dev/tcp/$host/$port; cat >&3 | cat <&3' (this uses `|` as a trick to run two processes in parallel).
- akritid 3y agoI think the main advantage of telnet is the line edit mode and local echo. It helps working over high latency connections.
- Sosh101 3y agoTelnet will always have a special place in my heart because of MUDs.
- aldanor 3y agoThinking back, I've probably learning programming via writing tintin++ scripts and triggers and all that in late 90s.
- giraffe_lady 3y agoI wonder if you'll find it reassuring or chilling that tintin++ is still under active development and is arguably still the state of the art for mud scripting. I had to reverse engineer a telnet interface for work last year and I did nearly all of the exploratory work in tt++. Got me back into mudding after many years away though. Once I had mastered that tool, why not.
- Sosh101 3y agoCan you recommend a good active MUD? I didn't realise they were still going! Might be interesting to dip back into it and see if it's still fun.
- giraffe_lady 3y agoI like discworld mud, it's loosely based on terry pratchett's books but has drifted a lot over the decades it's been active and is largely its own thing now. Achaea is still really popular and active but I didn't spend all that much time on it when I was getting back into muds. It's got some freemium aspects to its model that turned me off but I understand is really well-liked by its players so probably worth a try anyway. I also hear good things about alter aeon and it seems to be really active. I've been meaning to check it out but haven't yet. --- A quick look makes mudding look more popular than it really is. There are hundreds of unique operating muds, but probably fewer than a dozen that ever see more than 50 simultaneous players. You could pretty easily narrow it down based on that and choose a couple whose theme appeals to you most. But also if you get into it you're choosing a community as much as a game, so observe and feel out the culture a bit before you get too invested. And IMO skip anything that allows concurrent multiplay. Those look more busy than they are; in reality it's going to be a handful of people who have known each other for years each multiplaying dozens of characters.
- teddyh 3y agoI run telnet every day. Over IPsec.
- JohnFen 3y agoI still run telnet services as easter eggs. One just connects up to an implementation of the original ADVENT, one to nethack, etc. Few people have ever discovered these, but they amuse me anyway. And I like being able to play nethack from anywhere, on any machine.