"<ESC>[31M"? ANSI Terminal security in 2023 and finding 10 CVEs
I wrote a VT100 (+ Sun extensions) emulator in PostScript that had a magical &quot;^_PostScript Code^]&quot; escape sequence that let you download arbitrary PostScript code into the NeWS window server (which could do anything you want)! Also ^A would print out the stack, because why not? ;)<p><a href="https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;code&#x2F;term.ps.txt" rel="nofollow noreferrer">https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;code&#x2F;term.ps.txt</a><p>It also supported the &lt;ESC&gt;#8 &quot;fill screen with E&quot; test sequence, just so it could pass VTTest, plus a few extra Sun and AAA sequences that my slave driving boss Hugh Daniel demanded (since he was from Ann Arbor). Yes, a company actually called &quot;Wedge Computer, Inc.&quot; paid me to write it!<p>There are also some subtleties about missing numeric arguments that VTTest checks. My SoftTTY emulator would detect syntax errors in escape sequences, which implied you were trying to test it with VTtest, so then it would change the cursor to the shape of a hand giving you the finger (shape-error-cursor), and flash it 20 times, to flip Hugh off for subjecting my terminal emulator to VTTest.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Vttest" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Vttest</a><p><pre><code>    &#x2F;ps-string-prefix {
      &#x2F;ps-string 256 string def
      &#x2F;ps-string-len 0 def
      &#x2F;termulate-char &#x2F;&#x2F;termulate-ps-string def
    } def

    &#x2F;termulate-ps-string {
      dup 27 eq {
        pop
        reset-termulator
        ps-string 0 ps-string-len getinterval cvx
        { exec } stopped pop
      } {
        ps-string ps-string-len 3 -1 roll put
        &#x2F;ps-string-len ps-string-len 1 add def
        ps-string-len ps-string length eq {
          &#x2F;ps-string
        ps-string-len dup add string
        ps-string 1 index copy pop
      def
        } if
      } ifelse
    } def
</code></pre>
I used it for writing a Lisp &quot;Little Backwards Chainer&quot; program that would download a tree of dirty knowledge base symbols into the server to define a corresponding tree of pop-up pie menus, so I could browse the Lisp data structures as pie menus to debug the program.<p><a href="https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;archive&#x2F;lisp&#x2F;little-backwards-chainer.lisp" rel="nofollow noreferrer">https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;archive&#x2F;lisp&#x2F;little-backwards-ch...</a><p><pre><code>    ; Write dirty nodes to the NeWS server in PostScript, and mark them as 
    ; clean.
    (defun sweep ()
      (clean-tree &#x27;*KB*))

    (defun clean-tree (node)
      (cond ((get node &#x27;dirty)
         (send-node node)
         (putprop node nil &#x27;dirty)))
      (cond
        ((null (node-alist node)) nil)
        (t (mapcar #&#x27;(lambda (link)
               (clean-tree (link-node link)))
               (node-alist node))
           nil)))

    (defun send-node (node)
      (ps-make-node node (node-sexp node)
        (node-associated-atom node)
        (node-alist node)))

    ; Magic control characters the PostScript terminal emulator responds to.
    (setq StartPS &quot;^_&quot;) ; Ctrl-_: begin trojan horse
    (setq EndPS &quot;^]&quot;) ; Escape: end and execute trojan horse

    ; Write out a NeWS menu definition, with the right control characters to 
    ; make the PostScript terminal program (SoftTTY) execute it.
    (defun ps-make-node (name sexp associated-atom alist)
      (msg &quot;% Sending &quot; name &quot;...&quot;)
      (msg StartPS &quot;userdict &#x2F;&quot; name &quot; [&quot; N)
      (msg &quot;  &quot; (list &#x27;Name= name) &quot; {&quot; (ncons name) &quot; print}&quot; N
           &quot;  &quot; (list &#x27;Sexp= sexp) &quot; {&quot; (ncons sexp) &quot; print}&quot; N
           &quot;  &quot; (list &#x27;Atom= (fact-name associated-atom))
            &quot; {&quot; (ncons (fact-name associated-atom)) &quot; print}&quot; N)
      (mapcar #&#x27;(lambda (link)
              (msg &quot;  &quot; link &quot; &#x2F;&quot; (link-node link) &quot; cvx&quot; N))
          alist)
      (msg &quot;] &#x2F;new DefaultMenu send put&quot; N)
      (msg name &quot; &#x2F;Clockwise false put&quot; N)
      (cond ((eq name &#x27;*KB*) (msg &quot;&#x2F;ClientMenu *KB* def&quot; N))) ; kludge
      (msg EndPS N))
</code></pre>
Hugh was the author of ColorToy and ColorTool, which lets you play with and change all the user interface colors (even to dynamic random procedural colors that changed every time it paints, which was the most fun, and useful for debugging drawing, incremental screen updating, and clipping bugs!)<p><a href="https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;archive&#x2F;NeWS&#x2F;news-tape&#x2F;utilities&#x2F;colortool&#x2F;colortool" rel="nofollow noreferrer">https:&#x2F;&#x2F;donhopkins.com&#x2F;home&#x2F;archive&#x2F;NeWS&#x2F;news-tape&#x2F;utilities...</a>