Support backslashes in SOC passwords

This commit is contained in:
Jason Ertel
2020-09-23 10:09:21 -04:00
parent 4f228c1b7c
commit 2f7c0c34e6
4 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ test -t 0
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo "Enter new password:" echo "Enter new password:"
fi fi
read -s CORTEX_PASS read -rs CORTEX_PASS
# Create new user in Cortex # Create new user in Cortex
resp=$(curl -sk -XPOST -H "Authorization: Bearer $CORTEX_KEY" -H "Content-Type: application/json" "https://$CORTEX_IP/cortex/api/user" -d "{\"name\": \"$CORTEX_USER\",\"roles\": [\"read\",\"analyze\",\"orgadmin\"],\"organization\": \"$CORTEX_ORG_NAME\",\"login\": \"$CORTEX_USER\",\"password\" : \"$CORTEX_PASS\" }") resp=$(curl -sk -XPOST -H "Authorization: Bearer $CORTEX_KEY" -H "Content-Type: application/json" "https://$CORTEX_IP/cortex/api/user" -d "{\"name\": \"$CORTEX_USER\",\"roles\": [\"read\",\"analyze\",\"orgadmin\"],\"organization\": \"$CORTEX_ORG_NAME\",\"login\": \"$CORTEX_USER\",\"password\" : \"$CORTEX_PASS\" }")

View File

@@ -39,7 +39,7 @@ test -t 0
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo "Enter new password:" echo "Enter new password:"
fi fi
read -s FLEET_PASS read -rs FLEET_PASS
FLEET_HASH=$(docker exec so-soctopus python -c "import bcrypt; print(bcrypt.hashpw('$FLEET_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'));" 2>&1) FLEET_HASH=$(docker exec so-soctopus python -c "import bcrypt; print(bcrypt.hashpw('$FLEET_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'));" 2>&1)
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then

View File

@@ -39,7 +39,7 @@ test -t 0
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo "Enter new password:" echo "Enter new password:"
fi fi
read -s THEHIVE_PASS read -rs THEHIVE_PASS
# Create new user in TheHive # Create new user in TheHive
resp=$(curl -sk -XPOST -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" "https://$THEHIVE_IP/thehive/api/user" -d "{\"login\" : \"$THEHIVE_USER\",\"name\" : \"$THEHIVE_USER\",\"roles\" : [\"read\",\"alert\",\"write\",\"admin\"],\"preferences\" : \"{}\",\"password\" : \"$THEHIVE_PASS\"}") resp=$(curl -sk -XPOST -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" "https://$THEHIVE_IP/thehive/api/user" -d "{\"login\" : \"$THEHIVE_USER\",\"name\" : \"$THEHIVE_USER\",\"roles\" : [\"read\",\"alert\",\"write\",\"admin\"],\"preferences\" : \"{}\",\"password\" : \"$THEHIVE_PASS\"}")

View File

@@ -96,7 +96,7 @@ function updatePassword() {
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo "Enter new password:" echo "Enter new password:"
fi fi
read -s password read -rs password
validatePassword "$password" validatePassword "$password"
fi fi