You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may - or may not - be a "no brainer" issue for sockdump.py users. Nonetheless -
The output from sockdump.py --format string ... has no leading delimiters to set apart the descriptive header from the actual data into and out of the socket. A trailing delimiter is already included with the python3 print() command by default.
The output format is not a problem with, for instance, an http interaction, which is profuse with "CR/LF" line endings. However, when viewing output from interaction with an smtp "milter" socket, many interactions involve short commands with no such "CR/LF" line endings. The result is that a single line displays data from an interaction in front of the header for the following interaction. This can be very confusing, especially the first time it is seen.
Of course, the user can easily modify the sockdump.py script to add leading delimiters to the header output, which then act as effective delimiters to those, in this example, short milter commands which have no "LF" terminators. Still, the question arises, would we like sockdump.py to provide, perhaps, an alternative format option which adds a line separator before the header?
To avoid interfering with the way sockdump.py currently functions, there might be an additional - rather trivial - option, perhaps "--format delimited", which is the same as "--format string" except with a simple "LF" preceding the header, so that the header is always set apart, on a line by itself, regardless of the form of the data being displayed.
Or, maybe sockdump.py should just include a leading "LF" in the header, by default? That's the simple ask.
And then, the user has to keep in mind that this "LF" at the end of the data is also not itself part of that data, but was a "LF" added by sockdump.py. But, I expect that that is easier than trying to read "run together" output on a single line.
In my case, I've added an additional leading "LF LF TAB" to the header, just to leave an empty line between data exchanges, and to set off the header itself from those short milter command lines. But that's just my preference.
And, something related, the display of non-printing characters in "--format string" output is an issue. This is something that may not be immediately apparent to the user, especially the new user, when data containing non-printing characters is displayed on a terminal, where those characters will be "invisible". Interestingly, when using the "--output" option, and viewing the output file with, say, less, then otherwise non-printing characters will be apparent, especially shown with reversed colors. But on a terminal - not so much.
Another question then, would we like a sockdump.py option which automatically displays non-printing characters to a terminal?
Of course, the user can easily use sockdump.py --format string ... | cat -e, but they would have to know to do this. Should this functionality be included, either automatically or as an option, in sockdump.py itself?
Alternatively, there might be a "--format raw" option, in which the invisible "LF" is removed from the header itself - print('...', end='') - some unusual, easily parsed, visible leading and trailing delimiters included with the sockdump.py header, such as "#$#", and the actual data is set between the headers, unmodified, as is.
Again, instead, the user could just customize the sockdump.py header themselves. But the current header format, as displayed on a terminal, with only the trailing "LF" and no leading "LF", can be confusing with some output.
Some things for consideration...
The text was updated successfully, but these errors were encountered:
This may - or may not - be a "no brainer" issue for
sockdump.py
users. Nonetheless -The output from
sockdump.py --format string ...
has no leading delimiters to set apart the descriptive header from the actual data into and out of the socket. A trailing delimiter is already included with the python3print()
command by default.The output format is not a problem with, for instance, an http interaction, which is profuse with "CR/LF" line endings. However, when viewing output from interaction with an smtp "milter" socket, many interactions involve short commands with no such "CR/LF" line endings. The result is that a single line displays data from an interaction in front of the header for the following interaction. This can be very confusing, especially the first time it is seen.
Of course, the user can easily modify the
sockdump.py
script to add leading delimiters to the header output, which then act as effective delimiters to those, in this example, short milter commands which have no "LF" terminators. Still, the question arises, would we likesockdump.py
to provide, perhaps, an alternative format option which adds a line separator before the header?To avoid interfering with the way
sockdump.py
currently functions, there might be an additional - rather trivial - option, perhaps "--format delimited", which is the same as "--format string" except with a simple "LF" preceding the header, so that the header is always set apart, on a line by itself, regardless of the form of the data being displayed.Or, maybe
sockdump.py
should just include a leading "LF" in the header, by default? That's the simple ask.And then, the user has to keep in mind that this "LF" at the end of the data is also not itself part of that data, but was a "LF" added by
sockdump.py
. But, I expect that that is easier than trying to read "run together" output on a single line.In my case, I've added an additional leading "LF LF TAB" to the header, just to leave an empty line between data exchanges, and to set off the header itself from those short milter command lines. But that's just my preference.
And, something related, the display of non-printing characters in "--format string" output is an issue. This is something that may not be immediately apparent to the user, especially the new user, when data containing non-printing characters is displayed on a terminal, where those characters will be "invisible". Interestingly, when using the "--output" option, and viewing the output file with, say,
less
, then otherwise non-printing characters will be apparent, especially shown with reversed colors. But on a terminal - not so much.Another question then, would we like a
sockdump.py
option which automatically displays non-printing characters to a terminal?Of course, the user can easily use
sockdump.py --format string ... | cat -e
, but they would have to know to do this. Should this functionality be included, either automatically or as an option, insockdump.py
itself?Alternatively, there might be a "--format raw" option, in which the invisible "LF" is removed from the header itself -
print('...', end='')
- some unusual, easily parsed, visible leading and trailing delimiters included with thesockdump.py
header, such as "#$#", and the actual data is set between the headers, unmodified, as is.Again, instead, the user could just customize the
sockdump.py
header themselves. But the current header format, as displayed on a terminal, with only the trailing "LF" and no leading "LF", can be confusing with some output.Some things for consideration...
The text was updated successfully, but these errors were encountered: