Skip to content

Commit

Permalink
fix redact script
Browse files Browse the repository at this point in the history
  • Loading branch information
mhristof committed Feb 20, 2020
1 parent d954b38 commit b824db1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions redact.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#! /usr/bin/env bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
#set -euo pipefail
#IFS=$'\n\t'

while read -r line; do
pbpaste | while IFS= read line; do
aws_key=$(echo $line | grep -oP '(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])')
if [[ ! -z $aws_key ]]; then
line=$(echo $line | sed "s/$aws_key/${aws_key:0:5}xxxxxxxxxx${aws_key:15:20}/g")
Expand All @@ -13,7 +10,8 @@ while read -r line; do
if [[ ! -z $aws_secret ]]; then
line=$(echo $line | sed "s!${aws_secret}!${aws_secret:0:5}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx${aws_secret:35:40}!g")
fi

echo $line
done < <(pbpaste)
done

exit 0

0 comments on commit b824db1

Please sign in to comment.