summaryrefslogtreecommitdiff
path: root/number-to-name.awk
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-10-01 22:51:47 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-10-01 22:51:47 +0200
commit4f49800cadaa467aadfbe079de6392f72a1232d8 (patch)
tree09718ddcabbdb9ffc2a3c74c621f67428f2ed0b3 /number-to-name.awk
parent798b5a620746f042dce4a019c73e2d9c82598d22 (diff)
downloadwireshark-notes-4f49800cadaa467aadfbe079de6392f72a1232d8.tar.gz
number-to-name.awk: support suites.txt file format
Diffstat (limited to 'number-to-name.awk')
-rwxr-xr-xnumber-to-name.awk10
1 files changed, 9 insertions, 1 deletions
diff --git a/number-to-name.awk b/number-to-name.awk
index 8c499be..ba9a733 100755
--- a/number-to-name.awk
+++ b/number-to-name.awk
@@ -4,9 +4,17 @@
BEGIN {
if (!cmd) cmd = "openssl ciphers -V";
+ # alternative: cat suites.txt
while ((cmd | getline) > 0) {
- if ( split($0, a, / +- +|[, ]+/)) {
+ if ($1 ~ /^[0-9]+/) {
+ # suites.txt format: <decimal-number> <name>
+ num = $1;
+ name = $2;
+ number_to_name[num] = name;
+ } else if (split($0, a, / +- +|[, ]+/) >= 2) {
+ # `openssl ciphers -V` format:
+ # 0xHH,0xHH - <name> ...
num = strtonum(a[2]) * 256 + strtonum(a[3]);
name = a[4];
number_to_name[num] = name;