1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
#!/bin/cat
#? NAME
#? usage_examples - examples for advanced usage of o-saft.pl
#?
#? DESCRIPTION
#? This file just contains examples and hints for advanced usage of
#? o-saft.pl.
#?
###############################################################################
###
### Command completion
###
# Command and parameter completion exists for following shells:
#
# shell file to be used
# -------+-------------------------
# bash bash_completion_o-saft
# fish fish_completion_o-saft
# tcsh tcsh_completion_o-saft
# -------+-------------------------
#
# These files are located in the contrib/ directory. For installing and using
# them, please see the files itself and the shell's manual pages.
###############################################################################
###
### Postprocessing output
###
# All output is designed to be easily parsed by postprocessors. For details
# please see:
o-saft.pl --help=OUTPUT
o-saft.pl --help=RESULTS
# For converting (postprocessing) the results to other formats, some filter
# scripts are provided in the contrib/ directory. The usage i.g. is like:
# o-saft.pl ... | contrib/filter-script
# for example:
o-saft.pl +cipher --header --enabled your.tld | contrib/HTML-table.awk
# If you write your own filter script, it's probably best to use o-saft.pl's
# --legacy=quick option, which separates label and value by a TAB character.
# However, it should be still possible to parse the default format of the
# results, which is:
# Text of label: TABvalue
# Where the : (colon) terminates the label text, which is followed by spaces
# to align in columns, followed by a TAB character (aka \t aka 0x09) followed
# by the value (the result).
#
# For practical examples, please see contrib/filter_examples .
###############################################################################
###
### Postprocessing output with colours
###
# To colourize the results, the script contrib/bunt.pl (or contrib/bunt.sh)
# can be used. It generates ANSI codes for the termnal. Example:
o-saft.pl some.tld +check | contrib/bunt.pl
# Sometimes colours need to be adapted, i.e. for red-green visual impairments
# or when a light background is used.
o-saft.pl some.tld +check | contrib/bunt.pl --blind
o-saft.pl some.tld +check | contrib/bunt.pl --purple
# If the "aha - Ansi HTML Adapter" (from https://github.com/theZiz/aha) is
# available, the output can be converted to an HTML page:
o-saft.pl some.tld +check | contrib/bunt.pl | aha -w -b -t "some.tld +check" > some.tld_check.html
# If "ansi2html" is availabe (sometimes in package colorized-logs), output
# can be converted to an HTML page:
o-saft.pl some.tld +check | contrib/bunt.pl | ansi2html > some.tld_check.html
###############################################################################
###
### Beautify output
###
# Replace values yes and no by character symbols.
o-saft.pl some.tld +check | contrib/symbol.pl
# Just print data from certificate
o-saft.pl some.tld +info | contrib/Cert-beautify.pl
###############################################################################
###
### Generating a list with all possible commands
###
o-saft.pl --help=cmd
# same, but one command per line:
o-saft.pl --help=cmd --norc | awk 'BEGIN{i=4}{while (i<NF){print $i;i++}}'
# or more lazy:
o-saft.pl --help=cmd | tr ' ' '\012'
# list all commands with brief description
o-saft.pl --help=commands
###############################################################################
###
### Redefine label texts in output
###
# generate list with --cfg-data=CMD= options, which can be used to rewite
# the labels for output (the old way without --help=cfg-data ):
o-saft.pl --help=cmd --norc \
| awk 'BEGIN{i=4}{while (i<NF){sub(/+/,"",$i);print "--cfg-data="$i"="i;i++}}'
# To change the label (text) of a command, the option --cfg-data=CMD=TEXT or
# --cfg-check=CMD=TEXT can be used:
o-saft.pl --help=cfg-data --norc
o-saft.pl --help=cfg-check --norc
# This will generate one line --cfg-data=COMMAND= foreach command. Simply
# redirect this to for example ./my-info-labels.txt then add your new texts
# to each line in that file and use the file like:
o-saft.pl some.tld +info --rc=./my-info-labels.txt
# This feature can be used to translate the labels in other languages. There-
# for add the modified ./my-info-labels.txt to .o-saft.pl (which will be
# read automatically by o-saft.pl).
###############################################################################
###
### Adding additional information (text) to the results
###
# o-saft.pl writes a "hint" text for each +check and for each +info (data)
# command. This is initially intended to give additional informations about
# the performed checks. Each such hint is written in a separate line behind
# the corresponding info or check line.
# This feature can also be (mis-)used to add your own description to whatever
# check you want, simply by using the option --cfg-hint=CMD=TEXT .
# A template file with all options for all possible commands can be generated
# as follows:
o-saft.pl --help=cmd --norc \
| awk 'BEGIN{i=4}{while (i<NF){sub(/+/,"",$i);print "--cfg-hint="$i"="i;i++}}'
# Then proceed as describe for "Redefine label texts" above.
# Take care that this may overwrite existing hint texts. Existing texts will
# be shown with:
o-saft.pl --help=cfg-hint --norc
###############################################################################
###
### Reading parameters from file or STDIN
###
# o-saft.pl does not support reading parameters (arguments and options) from
# STDIN, here-documents or redirected from a file. This behaviour is reserved
# for future functionality (reading data from STDIN etc.).
# However, o-saft.pl supports reading parameters from its RC-FILE ,see
# o-saft.pl --help=CUSTOMIZATION
# this can be used to tweak reading prepared file.
#
# Example: file host-list.txt which contains host:port one per line:
o-saft.pl +cipher `awk -F: '/:/{print "--port="$2" --host="$1}' host-list.txt`
|