Can't find a good bracket character, so just removing it

This commit is contained in:
Neale Pickett 2018-07-10 22:12:53 +00:00
parent 37e6f4c7c8
commit 04fb93ec2b
2 changed files with 8 additions and 7 deletions

View File

@ -123,7 +123,7 @@ which will convert payloads to an octet stream,
after you have done any maniuplations you want. after you have done any maniuplations you want.
## pmerge: merge pcap files ## pmerge: merge pcap files
Takes a list of pcap files, assuming they are sorted by time Takes a list of pcap files, assuming they are sorted by time
(you would have to work hard to create any other kind), (you would have to work hard to create any other kind),
@ -132,7 +132,7 @@ and merges them into a single sorted output.
## puniq: omit repeated frames ## puniq: omit repeated frames
Removes duplicate frames from input, Removes duplicate frames from input,
writing to output. writing to output.
@ -185,8 +185,8 @@ and many other languages' string literals.
Shows all octets from `00` to `ff` in a hex dump. Shows all octets from `00` to `ff` in a hex dump.
This is occasionally more helpful than `man ascii`. This is occasionally more helpful than `man ascii`.
$ octets $ octets
00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ┆·☺☻♥♦♣♠•◘○◙♂♀♪♫☼┆ 00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f □☺☻♥♦♣♠•◘○◙♂♀♪♫☼
00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ┆►◄↕‼¶§▬↨↑↓→←∟↔▲▼┆ 00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ┆►◄↕‼¶§▬↨↑↓→←∟↔▲▼┆
00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f ┆ !"#$%&'()*+,-./┆ 00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f ┆ !"#$%&'()*+,-./┆
00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f ┆0123456789:;<=>?┆ 00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f ┆0123456789:;<=>?┆
@ -234,7 +234,7 @@ Same pretty-print as before, and also pipe to `less` so we can page through it.
For each ICMP packet, drop the first 5 octets, and base64-decode the remainder, preserving conversation chunks For each ICMP packet, drop the first 5 octets, and base64-decode the remainder, preserving conversation chunks
cat input.pcap | pcat | grep ICMP | while read ts proto src dst payload; do cat input.pcap | pcat | grep ICMP | while read ts proto src dst payload; do
printf "%s -> %s (%s)\n" $src $dst $ts printf "%s -> %s (%s)\n" $src $dst $ts
echo $payload | unhex | slice 5 | base64 -d | hd echo $payload | unhex | slice 5 | base64 -d | hd
done done

5
hd.c
View File

@ -2,6 +2,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
/* These glyphs are in most monospace fonts I tried in 2018 */
const char *charset[] = { const char *charset[] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "§", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "§", "", "", "", "", "", "", "", "", "", "",
@ -63,11 +64,11 @@ dump(FILE *f)
printf(" "); printf(" ");
} }
} }
printf(" "); printf(" ");
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
printf("%s", charset[bytes[i]]); printf("%s", charset[bytes[i]]);
} }
if (-1 == printf("\n")) { if (-1 == printf("\n")) {
perror("printf"); perror("printf");
return 1; return 1;
} }