from Hacker News

Fun with Kermit and ZMODEM over SSH

by fcambus on 4/25/23, 4:45 PM with 107 comments

  • by jerf on 4/25/23, 5:16 PM

    Hello! Thank you for starting me up! I'm the Kermit protocol and I'm happy to hel... wait, you want to transfer what file? What the hell is a gigabyte? Well, man, OK, you're the user so you know best, but man, this is going to take like, days man, settle in, here we gooo

    ooooooo whooooooo OOOOOOOOO AAAAAAAAAAAAAAA !!!!!!!!!!1!! qcjqrjrcorRC!!!

    WHAT THE HECK WAS THAT? Did I just do megabytes per second? Holy shit. Am I high or something? What is this hardware? What is going on here?

    No... wait... is that the end? Am I done here? No! No, I want to transfer more! More! Megabytes per second! Gigabytes per second! I can see it now, I want it, I want more, please, let's transfer another file, come on man, I want to ride again, please ple

        EXECUTION COMPLETED
        $
  • by NoZebra120vClip on 4/25/23, 11:36 PM

    How I contributed to Emacs

    Once when I should've been in college still, I was using the Telix terminal program on a 286 with a 2400MNP5 modem. Now Telix had a really awesome scripting language that could do all sorts of terminal magic, but that's a story for another day.

    My connection to the Internet was 8-bit clean, and at the time I was an avid Emacs user/evangelist. (Since then, I have seen the light of vim's face and have never turned away.)

    I saw that Emacs included a mapping file for mskermit to generate ESC sequences for Alt+Keypress, and I figured out that if I mapped each scancode for Alt+Keypress to the appropriate 8-bit code, it would convert my Alt key into a Meta buckybit, perfect for Emacs usage!

    So I painstakingly mapped out each scancode and transcribed it into the ms-kermit configuration, and before long I was Emacsing in all its 8-bit-meta-glory.

    I figured it would be useful to other Emacs users, and so I sent the file upstream. Lo and behold, it was incorporated into the standard Emacs distribution, and it stayed that way for a long, long time.

    Unfortunately, since I had never formally assigned copyright or done whatever legal bit needs to be done to GPL the code, TPTB did an audit of the Emacs distro and culled any code that did not have solid legal footing. At that point, ms-kermit was really obsolete anyway, so I suppose it's all for the best!

  • by bm3719 on 4/25/23, 5:31 PM

    My only source of internet in undergrad was dialing into my university's modem pool and getting a shell on the main server (a DEC Alpha running OSF/1). Browsing the web was done through lynx.

    That worked fine but every now and then, a site would have some inline image that I'd want to see, so I'd view source to get the img URL and then download that to /tmp and transfer the file to my local machine via zmodem. Usually, it wouldn't be worth the effort. I'd also download mp3s off IRC via DCC and queue up a bunch of data for zmodem to transfer overnight or when I was in class. I really appreciated those bytes back then. Now, not so much.

  • by mikecoles on 4/25/23, 5:14 PM

    The article mentions 'Terminate'. That software was a joy to use.

    https://web.archive.org/web/19980627010642/http://www.termin...

  • by glonq on 4/25/23, 5:30 PM

    Last year we implemented "ymodem over BLE" for reasons that are complicated and possibly stupid.

    It felt familiar but strange and wrong to do such a thing. Worked great though.

  • by rsync on 4/25/23, 8:12 PM

    So, on the one hand ...

    I have actually used 'sz' and 'rz' in relatively modern times for quick and dirty file transfer and found it very convenient in a very narrow set of use-cases.

    However ...

    It's a serious violation of the cleanliness and available attack surface involved in a terminal interface and we should be on the lookout for, and reject, similar interfaces and applications.

    In order for zmodem to work over the terminal, the terminal program itself needs to know something about the text flowing over the connection and then invoke special, extra routines based on monitoring that textual flow.

    This opens up all manner of weird, extra attack surface.

    The beauty of the text terminal is that I can, theoretically, cat any file I want to without fear of what it contains. I can open up (perhaps with 'strings' or 'hexedit') any email attachment without fear of the strings that it contains. I can do this because I am using a dumb terminal.

    As soon as the terminal is smart - even a little bit - you've got vectors for weird strings doing things you don't want them to.

  • by diydsp on 4/25/23, 10:04 PM

    > There is something quite special about seeing ZMODEM transfers reach speeds close to 600 MBit/s. It's hard to explain.

    Yep that's 1.5 million times the speed I used to get.

  • by jebr224 on 4/25/23, 5:52 PM

    Kermit is still used in the embedded space, on modern platforms specifically for uboot.

    zmodem can also be used in embedded spaces to retrieve files if the only interface is a serial port.

  • by poettering on 4/25/23, 7:20 PM

    Still would love if desktop terminal emulators would implement the zmodem receiver side, so that you can ssh into some host of your choice and just type "sz" to copy arbitrary files of your choice onto your local system.
  • by ractive on 4/25/23, 9:58 PM

    I never thought, I'd read again about ZMODEM and Kermit. To learn programming and dive more into C/C++, I implemented both protocols while writing a Windows application to transfer files from the PC to a HP48 graphics calculator over the serial port in ca. 1999. This app then became the "official" PC link program "HPComm", released under the GPL. Almost 25 years go... :-o

    https://hpcomm.sourceforge.net/index-old.html

  • by sedatk on 4/25/23, 5:31 PM

    Thankfully, ZModem existed. I’d never been able to use Kermit successfully back in the days, always had trouble with it. I even had more success with XModem.
  • by jmclnx on 4/25/23, 5:10 PM

    Interesting, I used kermet on Coherent to dial into work. Once I started it, work would call be back so I would not have to pay for the session on my phone bill.
  • by spudlyo on 4/25/23, 6:34 PM

    At my last job, I worked in the PCI cardholder data environment, and we were very careful to limit egress from our systems in order to make it hard to exfiltrate data in the unlikely event of a breach. I remember thinking, if I were a wily hacker and I managed to pop a shell on one of these hosts, I would not be deterred by network egress roadblocks. I'd figure out a way to get `sz` on to a host and exfiltrate data to my heart's content with ZMODEM like we did back in the day.

    Looks like it's still quite possible, I wonder if our network monitoring tools would have noticed gigabytes of data flowing out of the network that way.

  • by distantsounds on 4/25/23, 7:40 PM

    lrzsz is one of the first packages i install when configuring a new system. being able to send and receive files between remote and local without needing a separate ssh session is such a time saver. it's really fast as well. i do wonder if anyone has developed something more modern to make it even more performant?
  • by seanmceligot on 4/25/23, 6:14 PM

    I still miss sz and rz when I ssh from a computer with no ssh server like nearly every windows box. If I remember right, sz = send a file from the server I'm in back to the client server. rz = receive a file from the client server.

    You can accomplish the with a new scp session on the client server, but it's an extra step. I use this as a helper when for building the scp command.

    function scppath() { echo $USER@$(hostname).$(dnsdomainname):$(realpath $1) ]

  • by Tepix on 4/25/23, 5:39 PM

    I remember having to deal with Kermit on the dialup line to the university. The connection wasn't 8-bit clean and IIRC XON/XOFF wouldn't work either on their modem, so it was very finicky and flaky whenever you wanted to transfer something.

    Aren't brains amazing, storing all those ancient unused acronyms for decades?

  • by thomashabets2 on 4/25/23, 10:19 PM

    Here's an ugly script to do zmodem over an SSH connection: https://github.com/ThomasHabets/ssh-scripts

    Should work through multiple SSH hops, and not giving the hassle of using scp through those same sets of hops.

  • by dublin on 4/26/23, 12:29 AM

    While it's nice to use a version of Kermit or Zmodem that has SSH built into it, it's not necessary. The plain vanilla versions from decades ago will work just fine in any terminal connection you establish: Telnet, SSH, rsh, whatever - even 7-bit ASCII...

    I used this frequently to move files back in the dialup modem days, after doing an ugly redirect to get the Zmodem binary on the far end, and because of its superior compression, Zmodem was faster than uucp/uucico (when you were lucky enough to have the uucp suite installed and configured, which unlike Kermit and Zmodem, required root privileges...)

  • by knorker on 4/25/23, 10:02 PM

    I tried to sell the OpenSSH team on implementing inline file transfer with zmodem once, but they were not interested.
  • by jedberg on 4/25/23, 5:31 PM

    Kermit and ZMODEM, now that takes me back. Haven't thought about those protocols for a long time.
  • by pimlottc on 4/25/23, 6:25 PM

    This is great! Just make sure you upload something as well to keep your ratio intact.
  • by zabzonk on 4/25/23, 6:45 PM

    i wrote implementations of the kermit protocol (and vt100 terminal emulators) for z80 cp/m machines and for the 6502-based BBC micro (both purely in assembler) way back in the mid 1980s. it was fun, and the protocol was really well documented, unlike some others i've had to deal with (i'm looking at you DDE & CORBA). oh, happy times! a bit later i wrote an implementation in C (and a bit of assembler for the interrupt-driven i/o) for the ibm pc.
  • by marcodiego on 4/25/23, 5:21 PM

    Project for the future: write an Arduino sketch which will send its own (compressed) source code using one of these protocols over the serial interface.
  • by ezekiel68 on 4/26/23, 5:53 AM

    Man this title takes me way back. Of course, ymodem-g on an HST was faster. But hard to beat the auto-resume feature of zmodem.
  • by tech-no-logical on 4/25/23, 9:28 PM

    zmodem... that brings be back to my BBS days when I had a fido node 2:281/909.4. why do I still know that by heart ? playing glorious BBS door-games over 2400 baud :)
  • by thrownaway561 on 4/25/23, 5:47 PM

    LOL... The good old days of writing modem strings for OS/2.
  • by johng on 4/25/23, 7:59 PM

    HS/Link was the pinnacle during my modem days.
  • by Jemm on 4/26/23, 1:30 PM

    Compuserve wants their cool back.
  • by YesThatTom2 on 4/25/23, 6:16 PM

    sz and rz! Such good memories.