mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
Improved extra714 to find secrets
This commit is contained in:
@@ -17,7 +17,7 @@ CHECK_TYPE_extra741="EXTRA"
|
||||
CHECK_ALTERNATE_check741="extra741"
|
||||
|
||||
extra741(){
|
||||
textInfo "Looking for keys in EC2 User Data all regions... (max 100 instances per region, use -m to increase it) "
|
||||
textInfo "Looking for keys in EC2 User Data in instances across all regions... (max 100 instances per region, use -m to increase it) "
|
||||
for regx in $REGIONS; do
|
||||
LIST_OF_EC2_INSTANCES=$($AWSCLI ec2 describe-instances $PROFILE_OPT --region $regx --query Reservations[*].Instances[*].InstanceId --output text --max-items $MAXITEMS | grep -v None)
|
||||
if [[ $LIST_OF_EC2_INSTANCES ]];then
|
||||
@@ -26,7 +26,8 @@ extra741(){
|
||||
USERDATA=$($AWSCLI ec2 describe-instance-attribute --attribute userData --query UserData.Value $PROFILE_OPT --region $regx --instance-id $instance --output text | decode_report > $USERDATA_FILE)
|
||||
if [ -s $USERDATA_FILE ];then
|
||||
FILE_FORMAT_ASCII=$(file -b $USERDATA_FILE|grep ASCII)
|
||||
FINDINGS=$(grep '[A-Za-z0-9]\{20,40\}' $USERDATA_FILE|wc -l|tr -d '\ ')
|
||||
#FINDINGS=$(grep '[A-Za-z0-9]\{20,40\}' $USERDATA_FILE | grep -i -e key -e secret -e token -e pass - |wc -l|tr -d '\ ')
|
||||
FINDINGS=$(grep -i -e key -e secret -e token -e pass $USERDATA_FILE |wc -l|tr -d '\ ')
|
||||
if [[ $FILE_FORMAT_ASCII ]]; then
|
||||
if [[ $FINDINGS -eq 0 ]]; then
|
||||
textPass "$regx: Nothing found in $instance" "$regx"
|
||||
|
||||
Reference in New Issue
Block a user