GithubHelp home page GithubHelp logo

Considering ZMODEM forwarding about twin HOT 3 OPEN

cosmos72 avatar cosmos72 commented on August 20, 2024
Considering ZMODEM forwarding

from twin.

Comments (3)

vanrein avatar vanrein commented on August 20, 2024

I decided to have a look at server/tty.c which seems to be the ZMODEM target area.

Some documents on ZMODEM are:

And in summary they say:

  • ZMODEM starts sending proactively with ZPAD,ZPAD,ZDLE,ZHEX or ZPAD,ZDLE,ZBIN or ZPAD,ZDLE,ZBIN32 sequences.
  • ZMODEM starts receiving proactively by sending the same variants; the difference follows in the content after these markers.
  • The ZPAD are padding, and are the character * which can be skipped; looking for ZDLE suffices. ZDLE is octal 030 or hexadecimal 0x18 or decimal 24.
  • There is a formal protocol end, but also a bail-out form of a sequence of ZDLE, five of which count as a break signal to the recipient (the sender actually sends more).

In TtyWriteAscii(), the ZDLE character would be marked as non-printable, so unless control characters were setup for printing, the character would be passed to write_ctrl(). This holds a case 24 setting DState = ESnormal to cause normal printing. Supposedly, the ZDLE code (called CAN in ASCII, and entered manually as ^X) is not used in normal terminal uses, so this is probably a generic treatment for an unknown code? At least stty -a does not list ^X as a signal generator.

So here's the plan that's ripening:

  1. Pickup on ZDLE and switch the tty.c module to a mode for ZMODEM transport.
  2. Have a builtin.c element (or tty.c globals) to which ZMODEM traffic is passed.
  3. In this builtin, recognise the difference between send and receive headers.
  4. When sender and receiver meet, proxy traffic between them.
  5. Detect breakdown of ZMODEM and decouple at that time; return tty.c to normal.

This allows sz in one window and rz in another, and TWIN would couple them. No issue if the commands run on different hosts, of course. They must be true TTY sessions though, nothing like MOSH. SSH would be transparant to these commands though, so remote access is no problem.

There could be room for default connections to the enclosing terminal. This might require option setting. It might cause multiple attached displays to exchange files too.

from twin.

 avatar commented on August 20, 2024

Zmodem is a bear. I implemented it similarly to your strategy early on for Qodem, but could not obtain some of the values I wanted to expose on the download/upload screen. In the end I implemented the entire protocol myself and discovered numerous errors in both the protocol and the (l)rzsz implementation. Most are noted at the top of this.

If you are just looking for a way to do Zmodem download inside any terminal session, LCXterm in passthru mode ('lcxterm -p') will do Zmodem (and Kermit) autostart and download.

from twin.

vanrein avatar vanrein commented on August 20, 2024

Spooky, I just compiled QODEM today! Now also got LCXTERM [0], as it seems to be an interesting tool -- TWIN has value as a TUI that does many of the things you do with LCXTERM, but LCXTERM can be run in other/graphical environments to do the same.

I started this topic with an idea that is new AFAIK, namely to directly connect two terminal sessions engaging in ZMODEM where the TUI or GUI is merely a connector; in the understanding that an admin would trust the sites he visited, he could send from one logged-in host and receive on another, and use this to share files. I regularly need that to keep replicated setups properly in sync. This is a new idea, and it could be very pleasant. I did not finish the work, mostly because I'm better at infrastructure than at user interface code, but the idea is still lurking in my mind.

Other uses of ZMODEM that I can see include running a remote configuration shell and needing to pass data in and out for commands, such as certificates or other goodies. When we operate the shell as an AMQP command queue I can easily attach files to commands, but it would be wonderful to have a shell analogon.

[0] Note that your v0.9 release does not have a tag in Git, and lacks the Makefile.in in the release download.

from twin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.