Skip to content

Instantly share code, notes, and snippets.

@imseandavis
Forked from willfurnass/dss2emails.sh
Created April 10, 2021 23:37
Show Gist options
  • Select an option

  • Save imseandavis/024324e092d40e12a848906cddc69a7e to your computer and use it in GitHub Desktop.

Select an option

Save imseandavis/024324e092d40e12a848906cddc69a7e to your computer and use it in GitHub Desktop.
Extract usernames and emails from a Synology DSS config dump file (.dss)
#!/bin/bash
# Will Furnass
# Oct 2017
if [[ $# -lt 1 ]]; then
echo 1>&2 "Extract list of user email addresses from Synology DSS '.dss' config dump"
exit 1
fi
dss_path="$1"
if [[ ! ( -f $dss_path && -r $dss_path ) ]]; then
echo 1>&2 "Synology .dss config dump not readable"
exit 2
fi
dss_file="$(basename ${dss_path})"
tmp_dir=$(mktemp -d)
pushd "${tmp_dir}" > /dev/null
cp "$dss_path" "${dss_file}.tar.xz"
tar --warning=no-timestamp -Jxf "${dss_file}.tar.xz"
#sqlite3 -column ConfigBkp/_Syno_ConfBkp.db 'SELECT DISTINCT name, mail FROM confbkp_user_tb WHERE mail != "";'
sqlite3 ConfigBkp/_Syno_ConfBkp.db 'SELECT DISTINCT name, mail FROM confbkp_user_tb WHERE mail != "";' | column -t -s "|"
popd > /dev/null
rm -r "${tmp_dir}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment