Implement blackbox in Golang (#250)

* Initial release
This commit is contained in:
Tom Limoncelli
2020-07-24 14:21:33 -04:00
committed by GitHub
parent e049c02655
commit 1c77c87555
86 changed files with 6074 additions and 22 deletions

2
binv2/blackbox_addadmin Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox admin add "$@"

2
binv2/blackbox_cat Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox cat "$@"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox decrypt --all --agentcheck=true --overwrite "@"

2
binv2/blackbox_decrypt_file Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox decrypt --overwrite "$@"

2
binv2/blackbox_deregister_file Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox file remove --safe "$@"

2
binv2/blackbox_diff Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox diff --diff "$@"

2
binv2/blackbox_edit Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox edit "$@"

2
binv2/blackbox_edit_end Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox encrypt --shred "$@"

2
binv2/blackbox_edit_start Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox decrypt "$@"

2
binv2/blackbox_initialize Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox init "$@"

2
binv2/blackbox_list_admins Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox admin list

2
binv2/blackbox_list_files Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox file list

2
binv2/blackbox_listadmins Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox admin list

2
binv2/blackbox_postdeploy Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
blackbox decrypt --all --overwrite --group "$1"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox file add --shred "$@"

2
binv2/blackbox_removeadmin Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox admin remove "$@"

2
binv2/blackbox_shred_all_files Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox shred --all

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec blackbox reencrypt --all --agentcheck

2
binv2/blackbox_view Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
blackbox cat "$@" | ${PAGER:-less}

51
binv2/blackbox_whatsnew Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# blackbox_whatsnew - show what has changed in the last commit for a given file
#
exec blackbox whatsnew "$@"
exit 0
set -e
source "${0%/*}/_blackbox_common.sh"
if [[ $# -ne 1 ]]
then
echo "Pass only 1 file at a time"
exit 1
fi
fail_if_not_in_repo
gpg_agent_notice
COLUMNS=`tput cols`
FILE=$1
GIT="git log --abbrev-commit --pretty=oneline"
CURR_COMMIT=`$GIT $FILE | head -1 | awk '{print $1}'`
PREV_COMMIT=`$GIT ${CURR_COMMIT}~1 $FILE | head -1 | awk '{print $1}'`
# Use colordiff if available
if which colordiff > /dev/null 2>&1
then DIFF="colordiff"
else DIFF="diff"
fi
cat_commit()
{
COMMIT=$1
git checkout $COMMIT $FILE
echo "[$COMMIT] $FILE"
echo "---------------------"
"${BLACKBOX_HOME}/blackbox_cat" $FILE | sed '/========== PLAINFILE/,/========== EXTRACTING/d'
}
CURR_CONTENT=`cat_commit $CURR_COMMIT`
PREV_CONTENT=`cat_commit $PREV_COMMIT`
clear
# For some unknown reason this command executes fine but return exit code 1
$DIFF -y --width $COLUMNS \
<(echo "CURRENT" "$CURR_CONTENT" | fold -w $(( $COLUMNS / 2 - 4 )) ) \
<(echo "PREVIOUS" "$PREV_CONTENT" | fold -w $(( $COLUMNS / 2 - 4 )) )
git checkout $CURR_COMMIT $FILE
echo