mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 13:55:25 +01:00 
			
		
		
		
	Fine tuning of --outprefix
The standard separator after $FNAME_PREFIX is now '-'. You can as well supply a different <fname_prefix> ending in '.', '_' or ',' , then no no additional '-' will be appended. Also a small bash function get_last_char() has been introduced which returns the last char from a supplied string.
This commit is contained in:
		| @@ -412,7 +412,7 @@ whole 9 yards | |||||||
| \fB\-\-append\fR Normally, if an output file already exists and it has a file size greater zero, testssl\.sh will prompt you to manually remove the file exit with an error\. \fB\-\-append\fR however will append to this file, without a header\. The environment variable APPEND does the same\. Be careful using this switch/variable\. A complementary option which overwrites an existing file doesn\'t exist per design\. | \fB\-\-append\fR Normally, if an output file already exists and it has a file size greater zero, testssl\.sh will prompt you to manually remove the file exit with an error\. \fB\-\-append\fR however will append to this file, without a header\. The environment variable APPEND does the same\. Be careful using this switch/variable\. A complementary option which overwrites an existing file doesn\'t exist per design\. | ||||||
| . | . | ||||||
| .P | .P | ||||||
| \fB\-\-outprefix <fname_prefix>\fR Prepend output filename prefix \fIfname_prefix\fR before \'\e${NODE}\.\'\. You can use as well the environment variable FNAME_PREFIX\. Using this any output files will be named \fB<fname_prefix>\.${NODE}\-p${port}${YYYYMMDD\-HHMM}\.<format>\fR when no file name of the respective output option was specified\. | \fB\-\-outprefix <fname_prefix>\fR Prepend output filename prefix \fIfname_prefix\fR before \'\e${NODE}\-\'\. You can use as well the environment variable FNAME_PREFIX\. Using this any output files will be named \fB<fname_prefix>\-${NODE}\-p${port}${YYYYMMDD\-HHMM}\.<format>\fR when no file name of the respective output option was specified\. If you do not like the separator \'\-\' you can as well supply a \fB<fname_prefix>\fR ending in \'\.\', \'_\' or \',\'\. In this case or if you already supplied \'\-\' no additional \'\-\' will be appended to \fB<fname_prefix>\fR\. | ||||||
| . | . | ||||||
| .P | .P | ||||||
| A few file output options can also be preset via environment variables\. | A few file output options can also be preset via environment variables\. | ||||||
|   | |||||||
| @@ -394,7 +394,7 @@ The same can be achieved by setting the environment variable <code>WARNINGS</cod | |||||||
|  |  | ||||||
| <p><code>--append</code>                      Normally, if an output file already exists and it has a file size greater zero, testssl.sh will prompt you to manually remove the file exit with an error. <code>--append</code> however will append to this file, without a header. The environment variable APPEND does the same. Be careful using this switch/variable. A complementary option which overwrites an existing file doesn't exist per design.</p> | <p><code>--append</code>                      Normally, if an output file already exists and it has a file size greater zero, testssl.sh will prompt you to manually remove the file exit with an error. <code>--append</code> however will append to this file, without a header. The environment variable APPEND does the same. Be careful using this switch/variable. A complementary option which overwrites an existing file doesn't exist per design.</p> | ||||||
|  |  | ||||||
| <p><code>--outprefix <fname_prefix></code>   Prepend output filename prefix <var>fname_prefix</var> before '\${NODE}.'. You can use as well the environment variable FNAME_PREFIX. Using this any output files will be named <code><fname_prefix>.${NODE}-p${port}${YYYYMMDD-HHMM}.<format></code> when no file name of the respective output option was specified.</p> | <p><code>--outprefix <fname_prefix></code>   Prepend output filename prefix <var>fname_prefix</var> before '\${NODE}-'. You can use as well the environment variable FNAME_PREFIX. Using this any output files will be named <code><fname_prefix>-${NODE}-p${port}${YYYYMMDD-HHMM}.<format></code> when no file name of the respective output option was specified. If you do not like the separator '-' you can as well supply a <code><fname_prefix></code> ending in '.',  '_' or ','. In this case or if you already supplied '-' no additional '-' will be appended to <code><fname_prefix></code>.</p> | ||||||
|  |  | ||||||
| <p>A few file output options can also be preset via environment variables.</p> | <p>A few file output options can also be preset via environment variables.</p> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -316,7 +316,7 @@ The same can be achieved by setting the environment variable `WARNINGS`. | |||||||
|  |  | ||||||
| `--append`                      Normally, if an output file already exists and it has a file size greater zero, testssl.sh will prompt you to manually remove the file exit with an error. `--append` however will append to this file, without a header. The environment variable APPEND does the same. Be careful using this switch/variable. A complementary option which overwrites an existing file doesn't exist per design. | `--append`                      Normally, if an output file already exists and it has a file size greater zero, testssl.sh will prompt you to manually remove the file exit with an error. `--append` however will append to this file, without a header. The environment variable APPEND does the same. Be careful using this switch/variable. A complementary option which overwrites an existing file doesn't exist per design. | ||||||
|  |  | ||||||
| `--outprefix <fname_prefix>`   Prepend output filename prefix <fname_prefix> before '\${NODE}.'. You can use as well the environment variable FNAME_PREFIX. Using this any output files will be named `<fname_prefix>.${NODE}-p${port}${YYYYMMDD-HHMM}.<format>` when no file name of the respective output option was specified. | `--outprefix <fname_prefix>`   Prepend output filename prefix <fname_prefix> before '\${NODE}-'. You can use as well the environment variable FNAME_PREFIX. Using this any output files will be named `<fname_prefix>-${NODE}-p${port}${YYYYMMDD-HHMM}.<format>` when no file name of the respective output option was specified. If you do not like the separator '-' you can as well supply a `<fname_prefix>` ending in '.',  '_' or ','. In this case or if you already supplied '-' no additional '-' will be appended to `<fname_prefix>`. | ||||||
|  |  | ||||||
| A few file output options can also be preset via environment variables. | A few file output options can also be preset via environment variables. | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -343,9 +343,9 @@ IP46ADDRs="" | |||||||
| LOCAL_A=false                           # Does the $NODEIP come from /etc/hosts? | LOCAL_A=false                           # Does the $NODEIP come from /etc/hosts? | ||||||
| LOCAL_AAAA=false                        # Does the IPv6 IP come from /etc/hosts? | LOCAL_AAAA=false                        # Does the IPv6 IP come from /etc/hosts? | ||||||
| XMPP_HOST="" | XMPP_HOST="" | ||||||
| PROXY="" | PROXYIP=""                              # $PROXYIP:$PROXPORT is your proxy if --proxy is defined ... | ||||||
| PROXYIP="" | PROXYPORT=""                            # ... and openssl has proxy support | ||||||
| PROXYPORT="" | PROXY=""                                # Once check_proxy() executed it contains $PROXYIP:$PROXPORT | ||||||
| VULN_COUNT=0 | VULN_COUNT=0 | ||||||
| SERVICE=""                              # Is the server running an HTTP server, SMTP, POP or IMAP? | SERVICE=""                              # Is the server running an HTTP server, SMTP, POP or IMAP? | ||||||
| URI="" | URI="" | ||||||
| @@ -1080,6 +1080,10 @@ else | |||||||
|      tolower() { echo -n "${1,,}"; } |      tolower() { echo -n "${1,,}"; } | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | get_last_char() { | ||||||
|  |      echo "${1:~0}"      # "${string: -1}" would work too (both also in bash 3.2) | ||||||
|  | } | ||||||
|  |                          # Checking for last char. If already a separator supplied, we don't need an additional one | ||||||
| debugme() { | debugme() { | ||||||
|      [[ "$DEBUG" -ge 2 ]] && "$@" |      [[ "$DEBUG" -ge 2 ]] && "$@" | ||||||
|      return 0 |      return 0 | ||||||
| @@ -16174,9 +16178,10 @@ check_proxy() { | |||||||
|           if ! "$HAS_PROXY"; then |           if ! "$HAS_PROXY"; then | ||||||
|                fatal "Your $OPENSSL is too old to support the \"-proxy\" option" $ERR_OSSLBIN |                fatal "Your $OPENSSL is too old to support the \"-proxy\" option" $ERR_OSSLBIN | ||||||
|           fi |           fi | ||||||
|           if [[ "$PROXY" == "auto" ]]; then |           if [[ "$PROXY" == auto ]]; then | ||||||
|                # get $ENV (https_proxy is the one we care about) |                # Get $ENV https_proxy is the one we care about for connects | ||||||
|                PROXY="${https_proxy#*\/\/}" |                PROXY="${https_proxy#*\/\/}" | ||||||
|  |                # Fallback: | ||||||
|                [[ -z "$PROXY" ]] && PROXY="${http_proxy#*\/\/}" |                [[ -z "$PROXY" ]] && PROXY="${http_proxy#*\/\/}" | ||||||
|                [[ -z "$PROXY" ]] && fatal "you specified \"--proxy=auto\" but \"\$http(s)_proxy\" is empty" $ERR_CMDLINE |                [[ -z "$PROXY" ]] && fatal "you specified \"--proxy=auto\" but \"\$http(s)_proxy\" is empty" $ERR_CMDLINE | ||||||
|           fi |           fi | ||||||
| @@ -17475,7 +17480,15 @@ parse_cmd_line() { | |||||||
|                     ;; |                     ;; | ||||||
|                --outprefix) |                --outprefix) | ||||||
|                     FNAME_PREFIX="$(parse_opt_equal_sign "$1" "$2")" |                     FNAME_PREFIX="$(parse_opt_equal_sign "$1" "$2")" | ||||||
|                     [[ $? -eq 0 ]] && shift && FNAME_PREFIX="${FNAME_PREFIX}." |                     if [[ $? -eq 0 ]]; then | ||||||
|  |                          shift | ||||||
|  |                          case "$(get_last_char "$FNAME_PREFIX")" in | ||||||
|  |                               '.') ;; | ||||||
|  |                               '-') ;; | ||||||
|  |                               '_') ;; | ||||||
|  |                               *) FNAME_PREFIX="${FNAME_PREFIX}-" ;; | ||||||
|  |                          esac | ||||||
|  |                     fi | ||||||
|                     ;; |                     ;; | ||||||
|                --openssl|--openssl=*) |                --openssl|--openssl=*) | ||||||
|                     OPENSSL="$(parse_opt_equal_sign "$1" "$2")" |                     OPENSSL="$(parse_opt_equal_sign "$1" "$2")" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dirk
					Dirk