Sh3ll



Directory :  /scripts2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Current File : //scripts2/imunify_list.sh
#!/bin/bash
# List infected files of an account (ImunifyAV).

USER=$1

if ! [ "$USER" ]; then
  echo "You must provide a username."
  exit 1
fi

if ! id $USER 2> /dev/null > /dev/null; then
  echo "User \"$USER\" does not exist."
  exit 2
fi

LOAD=$(imunify-antivirus malware user list --json \
       | jq -r --arg USER "$USER" '.items[] | select( .user == $USER)')

LIMIT=$(echo $LOAD | jq -r .infected)
SCAN_RAW=$(echo $LOAD | jq -r .scan_date)

CUR_RAW=$(imunify-antivirus malware on-demand status | grep -w $USER)

if [ "$SCAN_RAW" == "null" ]; then
  SCAN=Never
else
  SCAN=$(date -d @$SCAN_RAW)
fi

if [ "$CUR_RAW" ]; then
  CUR=Yes
else
  CUR=No
fi

HEADER=\
"------ Account: $USER ------\nScanning?: $CUR\nLast scan: $SCAN\nTotal infected: $LIMIT\n------ Account: $USER ------"

echo -e $HEADER
imunify-antivirus malware malicious list --user $USER --limit $LIMIT --json | jq -r .items[].file
echo -e $HEADER

Sh3LL