From jhawk@MIT.EDU Sun Nov 10 19:56:50 1996 Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id TAA16732 for ; Sun, 10 Nov 1996 19:56:50 -0500 Received: from LOLA-GRANOLA.MIT.EDU by MIT.EDU with SMTP id AA16782; Sun, 10 Nov 96 19:56:49 EST Received: (from jhawk@localhost) by lola-granola.MIT.EDU (8.6.12/8.6.12) id TAA28202; Sun, 10 Nov 1996 19:56:47 -0500 Message-Id: <199611110056.TAA28202@lola-granola.MIT.EDU> Date: Sun, 10 Nov 1996 19:56:47 -0500 From: John Hawkinson Reply-To: jhawk@MIT.EDU To: krb5-bugs@MIT.EDU Subject: "toggle netdata" should display ASCII data X-Send-Pr-Version: 3.99 >Number: 171 >Category: telnet >Synopsis: "toggle netdata" should display ASCII data >Confidential: no >Severity: non-critical >Priority: medium >Responsible: hartmans >State: open >Class: change-request >Submitter-Id: unknown >Arrival-Date: Sun Nov 10 19:57:00 EST 1996 >Last-Modified: Mon Nov 11 11:08:00 EST 1996 >Originator: John Hawkinson >Organization: MIT >Release: 1.0-development >Environment: System: NetBSD lola-granola 1.1B NetBSD 1.1B (LOLA) #2: Thu Jul 11 00:13:13 EDT 1996 mycroft@zygorthian-space-raiders:/afs/sipb.mit.edu/project/netbsd/dev/current-source/build/i386_nbsd1/sys/arch/i386/compile/LOLA i386 >Description: It is annoying that "toggle netdata" always produces hex output, regardless of the setting of "toggle prettydump". Particularly when debugging protocol problems that pertain to ASCII data, converting from hex to ASCII by hand is suboptimal, and using perl scripts to munge the data leave a bad taste in one's mouth. >How-To-Repeat: >Fix: Add "toggle sexydump" with a politically correct alias (listed in helptext) of "toggle asciidump". Here's a patch to appl/telnet/telnet. This also hyphenates user-readable and clarifies what "toggle debug" does (helptext fixes). =================================================================== RCS file: RCS/utilities.c,v retrieving revision 1.1 diff -c -r1.1 utilities.c *** utilities.c 1996/11/10 23:09:15 1.1 --- utilities.c 1996/11/11 00:46:19 *************** *** 54,59 **** --- 54,60 ---- FILE *NetTrace = 0; /* Not in bss, since needs to stay */ int prettydump; + int sexydump; /* * upcase() *************** *** 147,152 **** --- 148,177 ---- (*pThis)&0xff); pThis++; } + length -= BYTES_PER_LINE/2; + offset += BYTES_PER_LINE/2; + } else if (sexydump) { + unsigned char *q; + int i; + + q = pThis; + buffer = buffer + min(length, BYTES_PER_LINE/2); + + i = 0; + while (pThis < buffer) { + fprintf(NetTrace, "%.2x%s", *pThis++, i++%2?" ":""); + } + if (i % 2) { /* Need to ensure we've outputted an even number of bytes */ + fprintf(NetTrace, " "); + i++; + } + fprintf(NetTrace, "%*s", 10 + (BYTES_PER_LINE/2 - i) / 2 * 5, ""); + + while (q < buffer) { + fputc(isprint(*q)?*q:'.', NetTrace); + q++; + } + length -= BYTES_PER_LINE/2; offset += BYTES_PER_LINE/2; } else { =================================================================== RCS file: RCS/commands.c,v retrieving revision 1.4 diff -c -r1.4 commands.c *** commands.c 1996/10/30 04:12:43 1.4 --- commands.c 1996/11/11 00:01:24 *************** *** 740,746 **** "print hexadecimal representation of curses data" }, #endif /* defined(unix) && defined(TN3270) */ { "debug", ! "debugging", togdebug, &debug, "turn on socket level debugging" }, --- 740,746 ---- "print hexadecimal representation of curses data" }, #endif /* defined(unix) && defined(TN3270) */ { "debug", ! "debugging (socket level)", togdebug, &debug, "turn on socket level debugging" }, *************** *** 750,759 **** &netdata, "print hexadecimal representation of network traffic" }, { "prettydump", ! "output of \"netdata\" to user readable format (debugging)", 0, &prettydump, ! "print user readable output for \"netdata\"" }, { "options", "viewing of options processing (debugging)", 0, --- 750,769 ---- &netdata, "print hexadecimal representation of network traffic" }, { "prettydump", ! "output of \"netdata\" to user-readable format (debugging)", 0, &prettydump, ! "print user-readable output for \"netdata\"" }, ! { "asciidump", ! "output of \"netdata\" to a more user-readable format (debugging)", ! 0, ! &sexydump, ! "print ASCII user-readable output for \"netdata\"" }, ! { "sexydump", ! NULL, /* Hidden version of asciidump */ ! 0, ! &sexydump, ! "print ASCII user-readable output for \"netdata\"" }, { "options", "viewing of options processing (debugging)", 0, =================================================================== RCS file: RCS/externs.h,v retrieving revision 1.1 diff -c -r1.1 externs.h *** externs.h 1996/11/10 23:09:20 1.1 --- externs.h 1996/11/10 23:58:51 *************** *** 150,155 **** --- 150,156 ---- crmod, netdata, /* Print out network data flow */ prettydump, /* Print "netdata" output in user-readable format */ + sexydump, /* Print "netdata" output in an ASCII user-readable format */ #if defined(TN3270) cursesdata, /* Print out curses data flow */ apitrace, /* Trace API transactions */ >Audit-Trail: From: John Hawkinson To: krb5-bugs@MIT.EDU Cc: krb5-prs@RT-11.MIT.EDU Subject: Re: telnet/171: "toggle netdata" should display ASCII data Date: Mon, 11 Nov 1996 03:13:35 -0500 (EST) Oops, left out the obligatory manpage fix. *** telnet.1 1996/11/01 04:43:37 1.3 --- telnet.1 1996/11/11 08:11:36 *************** *** 1252,1257 **** --- 1252,1267 ---- .SM TELNET escape sequence is preceded by a '*' to aid in locating them. .TP + .B asciidump + When the + .B netdata + flag is enabled, if + .B asciidump + qis enabled the output from the + .B netdata + command will be formatted with ASCII characters alongside of + hex values. This is particularly useful in finding text strings. + .TP .B skiprc When the skiprc flag is .SM TRUE, From: John Hawkinson To: krb5-bugs@MIT.EDU Cc: krb5-prs@RT-11.MIT.EDU Subject: Re: telnet/171: "toggle netdata" should display ASCII data Date: Mon, 11 Nov 1996 03:16:46 -0500 (EST) While we're at it, here's an unrelated manpage typo fix (missing backslash before fP). --jhawk *** telnet.1 1996/11/11 08:11:11 1.4 --- telnet.1 1996/11/11 08:16:25 *************** *** 320,326 **** .B encrypt disable \&? command. .TP ! \fBenable\fP \fItype]fP [\fBinput\fP|\fBoutput\fP] Enables the specified type of encryption. If you omit input and output, both input and output are enabled. To obtain a list of available types, use the --- 320,326 ---- .B encrypt disable \&? command. .TP ! \fBenable\fP \fItype]\fP [\fBinput\fP|\fBoutput\fP] Enables the specified type of encryption. If you omit input and output, both input and output are enabled. To obtain a list of available types, use the From: John Hawkinson To: krb5-bugs@MIT.EDU Cc: krb5-prs@RT-11.MIT.EDU Subject: Re: telnet/171: "toggle netdata" should display ASCII data Date: Mon, 11 Nov 1996 11:07:27 -0500 (EST) Rapidly this is becoming a misc. telnet nits PR. "enc status" currently reports nothing if you've never turned on encryption. This patch fixes it to at least note cleartext. Also corrects an inconsistancy in the way statement blocks surround if predicates. --jhawk --- libtelnet/encrypt.c 1996/11/11 15:58:02 1.1 +++ encrypt.c 1996/11/11 16:04:48 @@ -402,18 +402,20 @@ if (encrypt_output) printf("Currently encrypting output with %s\r\n", ENCTYPE_NAME(encrypt_mode)); - else if (encrypt_mode) { - printf("Currently output is clear text.\r\n"); - printf("Last encryption mode was %s\r\n", - ENCTYPE_NAME(encrypt_mode)); + else { + printf("Currently output is clear text.\r\n"); + if (encrypt_mode) + printf("Last encryption mode was %s\r\n", + ENCTYPE_NAME(encrypt_mode)); } - if (decrypt_input) { + if (decrypt_input) printf("Currently decrypting input with %s\r\n", ENCTYPE_NAME(decrypt_mode)); - } else if (decrypt_mode) { - printf("Currently input is clear text.\r\n"); - printf("Last decryption mode was %s\r\n", - ENCTYPE_NAME(decrypt_mode)); + else { + printf("Currently input is clear text.\r\n"); + if (decrypt_mode) + printf("Last decryption mode was %s\r\n", + ENCTYPE_NAME(decrypt_mode)); } return 1; } >Unformatted: