mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
function os
This commit is contained in:
@@ -17,13 +17,13 @@ CHECK_TYPE_extra757="EXTRA"
|
||||
CHECK_ALTERNATE_check757="extra757"
|
||||
|
||||
extra757(){
|
||||
OLDAGE="$(date -v -6m '+%Y-%m-%d')"
|
||||
OLDAGE="$(get_date_previous_than_months 6)"
|
||||
textInfo "Looking for EC2 instances in all regions..."
|
||||
for regx in $REGIONS; do
|
||||
textInfo "Looking for EC2 instances in region $regx"
|
||||
INSTACES_OLD_THAN_AGE=$($AWSCLI --region $regx ec2 describe-instances --query "Reservations[].Instances[?LaunchTime<='$OLDAGE'][].{id: InstanceId, launched: LaunchTime}" --output text)
|
||||
EC2_RUNNING="$($AWSCLI ec2 describe-instances --region $regx --query "Reservations[*].Instances[*].[InstanceId]" --output text)"
|
||||
if [[ $EC2_RUNNING ]]; then
|
||||
INSTACES_OLD_THAN_AGE=$($AWSCLI --region $regx ec2 describe-instances --query "Reservations[].Instances[?LaunchTime<='$OLDAGE'][].{id: InstanceId, launched: LaunchTime}" --output text)
|
||||
if [[ $INSTACES_OLD_THAN_AGE ]]; then
|
||||
while IFS= read -r ec2_instace
|
||||
do
|
||||
|
||||
@@ -17,7 +17,7 @@ CHECK_TYPE_extra758="EXTRA"
|
||||
CHECK_ALTERNATE_check758="extra758"
|
||||
|
||||
extra758(){
|
||||
OLDAGE="$(date -v -12m '+%Y-%m-%d')"
|
||||
OLDAGE="$(get_date_previous_than_months 12)"
|
||||
textInfo "Looking for EC2 instances in all regions..."
|
||||
for regx in $REGIONS; do
|
||||
textInfo "Looking for EC2 instances in region $regx"
|
||||
|
||||
@@ -76,6 +76,12 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
DAYS_TO=$((( $DATE_IN_DAYS - $TODAY_IN_DAYS )/60/60/24))
|
||||
echo $DAYS_TO
|
||||
}
|
||||
get_date_previous_than_months()
|
||||
{
|
||||
MONTHS_TO_COMPARE=$1
|
||||
DATE_BEFORE_MONTHS_TO_COMPARE=$(date -v -$(echo $MONTHS_TO_COMPARE)m '+%Y-%m-%d')
|
||||
echo $DATE_BEFORE_MONTHS_TO_COMPARE
|
||||
}
|
||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
# POSIX compatibility layer and Linux environment emulation for Windows
|
||||
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
|
||||
|
||||
Reference in New Issue
Block a user