[solved] Unsafe terminal escape sequences and ANSI codes from decryption

"G.K." <[email protected]> Mon, 6 Mar 2023 04:04:58 -0600
Newsgroups sci.crypt,alt.security.pgp,alt.bbs,comp.terminals,alt.computer.security
Organization Cyber23 news
Message-ID <[email protected]>
On 3/6/23 03:29, Simon Tatham wrote:
> "G.K." <[email protected]> writes:
>> Another distinction occurs to me that might ease the problem
>> requirement. Is there a cheap way to distinguish between control codes
>> and formatting codes (color, foreground, background, underline,
>> blinkenlights) codes in a text stream.
> 
> 'less -R' does something along those lines. I don't know if the
> filtering code is conveniently separable from the rest of 'less', but
> it might be a start: somebody else has already done the work of making a
> set of decisions about which codes count in which category.

This solves the problem. This is a boon and does almost all the work 
necessary. From the less manual:

[quote]
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are output in "raw" 
form.  Unlike -r, the screen appearance is maintained correctly in  most 
cases.  ANSI "color" escape sequences are sequences of the form:

        ESC [ ... m

where  the "..." is zero or more color specification characters For the 
purpose of keeping track of screen appearance, ANSI color escape 
sequences are assumed to not move the cursor. [/quote]

After this I can pipe through a few intelligent line length and UTF-8 
validation checks and ship it.

-- 

G.K.