567,13 → 567,13 |
|
ROWS="" |
while read -r access ; do |
access_datas=(${access//|||/ }) |
access_datas=(${access//|/ }) |
|
accces_date_intl=$(echo "${access_datas[0]} ${access_datas[1]}" | sed -E 's@^([0-9]{2})+/+([0-9]{2})+/+([0-9]{4})+@\3-\2-\1@') # Convert date format DD/MM/YYYY to YYYY-MM-DD |
access_date=$(date -d "$accces_date_intl" +%s) |
access_user=${access_datas[2]} |
access_ip=${access_datas[3]} |
|
access_agent=${access_datas[4]} |
if [ $access_date -lt $SECS_AGO ]; then |
break |
fi |
580,18 → 580,18 |
|
access_date_formatted=$(date -d @$access_date +"%x %X") |
|
ROWS="$ROWS<tr><td>$access_date_formatted</td><td>$access_user</td><td>$access_ip</td></tr>" |
done < <(cat /var/www/html/acc/admin_log.txt | sort -r) |
ROWS="$ROWS<tr><td>$access_date_formatted</td><td>$access_user</td><td>$access_ip</td><td>$access_agent</td></tr>" |
done < <(cat /var/Save/security/acc_access.log | sort -r) |
# TODO: Read archives if necessary |
|
if [ -z "$ROWS" ]; then |
ROWS="<tr><td colspan=\"3\" style=\"text-align: center;\">Aucune connexion</td></tr>" |
ROWS="<tr><td colspan=\"4\" style=\"text-align: center;\">Aucune connexion</td></tr>" |
fi |
|
# Create HTML document |
echo "<h2>Connexion à l'ALCASAR Control Center (ACC)</h2>" >> $HTML_REPORT |
echo "<table class=\"table table-striped\">" >> $HTML_REPORT |
echo "<thead><tr><th>Date</th><th>Utilisateur</th><th>Adresse IP</th></tr></thead><tbody>" >> $HTML_REPORT |
echo "<thead><tr><th>Date</th><th>Utilisateur</th><th>Adresse IP</th><th>Agent</th></tr></thead><tbody>" >> $HTML_REPORT |
echo $ROWS >> $HTML_REPORT |
echo "</tbody></table>" >> $HTML_REPORT |
|