Debian Codegraph @

src/decrypt-dbeaver-configuration

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # ==========================================================================
3 # _ _ _ ____ ____ _____
4 # | | | (_) _ \ ___ _ __ / ___|___ _ _|_ _| __ __ _ ___ ___ _ __
5 # | |_| | | |_) / _ \ '__| | / _ \| '_ \| || '__/ _` |/ __/ _ \ '__|
6 # | _ | | __/ __/ | | |__| (_) | | | | || | | (_| | (_| __/ |
7 # |_| |_|_|_| \___|_| \____\___/|_| |_|_||_| \__,_|\___\___|_|
8 #
9 # --- High-Performance Connectivity Tracer (HiPerConTracer) ---
10 # https://www.nntb.no/~dreibh/hipercontracer/
11 # ==========================================================================
12 #
13 # High-Performance Connectivity Tracer (HiPerConTracer)
14 # Copyright (C) 2015-2026 by Thomas Dreibholz
15 #
16 # This program is free software: you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation, either version 3 of the License, or
19 # (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License
27 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #
29 # Contact: [email protected]
30
31 # Bash options:
32 set -euo pipefail
33
34
35 # ###### Usage ##############################################################
36 usagescip-shell shell shell-project 0.0.0 usage(). () {
37 local exitCode="$1"
38 echoscip-shell system . . echo. >&2 "Usage: $0 encrypted_dbeaver_credentials_config_json plain_dbeaver_credentials_config_json [-h|--help] [-v|--version]"
39 exit "${exitCode}"
40 }
41
42
43 # ###### Version ############################################################
44 versionscip-shell shell shell-project 0.0.0 version(). () {
45 echoscip-shell system . . echo. "Decrypt-DBeaver-Configuration @BUILD_MAJOR@.@BUILD_MINOR@.@BUILD_PATCH@"
46 exit 0
47 }
48
49
50
51 # ###### Main program #######################################################
52
53 # ====== Handle arguments ===================================================
54 if (( BASH_VERSINFO[0] < 4 )) || (( (BASH_VERSINFO[0] == 4) && (BASH_VERSINFO[1] < 4) )) ; then
55 echoscip-shell system . . echo. "ERROR: Bash 4.4 or higher is required, but Bash ${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]} is installed!"
56 exit 1
57 fi
58 UNAME="$(unamescip-shell system . . uname.)"
59 case "${UNAME}" in
60 FreeBSD)
61 GETOPT="$(PATH="/usr/local/bin:${PATH}" command -v getopt || truescip-shell system . . true.)"
62 ;;
63 NetBSD)
64 GETOPT="$(PATH="/usr/pkg/bin:${PATH}" command -v getopt || truescip-shell system . . true.)"
65 ;;
66 OpenBSD)
67 GETOPT="$(command -v gnugetopt || truescip-shell system . . true.)"
68 ;;
69 Darwin)
70 GETOPT="$(envscip-shell system . . env. PATH="/opt/homebrew/opt/gnu-getopt/bin:${PATH}" command -v getopt || truescip-shell system . . true.)"
71 ;;
72 *)
73 GETOPT="$(command -v getopt || truescip-shell system . . true.)"
74 ;;
75 esac
76 if "${GETOPT}" -T >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 || [[ $? -ne 4 ]]; then
77 echoscip-shell system . . echo. >&2 "ERROR: Enhanced/GNU getopt is required!"
78 exit 1
79 fi
80 options="$(${GETOPT} -o hv --long help,version -a -- "$@")"
81 # shellcheck disable=SC2181
82 if [[ $? -ne 0 ]]; then
83 usagescip-shell shell shell-project 0.0.0 usage(). 1
84 fi
85
86 eval set -- "${options}"
87 while [scip-shell system . . `[`. $# -gt 0 ] ; do
88 case "$1" in
89 -h | --help)
90 usagescip-shell shell shell-project 0.0.0 usage(). 0
91 ;;
92 -v | --version)
93 versionscip-shell shell shell-project 0.0.0 version().
94 ;;
95 --)
96 shift
97 break
98 ;;
99 *)
100 # This should not happen: wrong getopt parameters, or missing case?
101 echoscip-shell system . . echo. >&2 "INTERNAL ERROR: Unhandled option $1!"
102 exit 1
103 ;;
104 esac
105 shift
106 done
107 if [scip-shell system . . `[`. $# -ne 2 ] ; then
108 usagescip-shell shell shell-project 0.0.0 usage(). 1
109 fi
110
111 INPUT_FILE="$1"
112 if [scip-shell system . . `[`. "${INPUT_FILE}" == "-" ] ; then
113 INPUT_FILE="/dev/stdinscip-shell filesystem . . `/dev/stdin`."
114 fi
115 OUTPUT_FILE="$2"
116 if [scip-shell system . . `[`. "${OUTPUT_FILE}" == "-" ] ; then
117 OUTPUT_FILE="/dev/stdoutscip-shell filesystem . . `/dev/stdout`."
118 fi
119
120 # ====== Process file =======================================================
121 opensslscip-shell system . . openssl. aes-128-cbc -d \
122 -K babb4a9f774ab853c96c2d653dfe544a -iv 00000000000000000000000000000000 \
123 -in "${INPUT_FILE}" | ddscip-shell system . . dd. bs=1 skip=16 status=none | jqscip-shell system . . jq. . >"${OUTPUT_FILE}"