Skip to content

Instantly share code, notes, and snippets.

@Lathanao
Created February 24, 2024 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lathanao/8710316b4d27d5e22db70daa82139bde to your computer and use it in GitHub Desktop.
Save Lathanao/8710316b4d27d5e22db70daa82139bde to your computer and use it in GitHub Desktop.
Supercharge my shell with that in my .zshrc
expiration_password=$(passwd -S $USER | awk '{print $3}')
expiration_password_unix=$(date -d "$expiration_password" +%s)
date_actuelle=$(date +%s)
diff=$((date_actuelle - expiration_password_unix))
if [ $diff -gt 2592000 ]; then
echo "\e[36m\e[5m Password too old. Update it with $ passwd \${whoami}.\e[0m" | bat --style grid
fi
w | awk 'NR>2' | bat --style grid
# journalctl --since=24h --source=sshd --grep="Failed password for root from"
# journalctl --since=24h --source=sshd --grep="from <adresse_ip>"
journalctl -u sshd.service -n 10
journalctl --disk-usage
systemctl list-units --failed | awk 'NR>2' | bat --style grid
ip neighbor
TABLE_DNS=''
for ip in $(ss --ipv4 | tr ":" " " | awk 'NR>2' | awk '{print $7}') ; do
#TABLE_DNS+=$(echo $ip '\t\t\t' $(dig -x $ip | head -n 14 | tail -n 1 | awk '{print $5}') )
#TABLE_DNS+='\n'
done
[[ ! -z "$TABLE_DNS" ]] && echo ${TABLE_DNS::-2} | bat --style grid
cat /var/log/usercron/ip-tracker.log | tail -n1 | awk '{new_var=$4" "$7; print new_var}'
cat /var/log/usercron/cpu-tracker.log | tail -n6 | bat --style grid
cat /var/log/usercron/update-hosts.log | tail -n2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment