Category Archives: bash


Updated script to scan linux servers for viruses.


### Test log with Infected files

LOGFILE=”/var/log/clamav/clamav-$(/bin/date +’%Y-%m-%d’).log”;


# Need to build an email header to know which system is scanned.
# Gmail gateway is overwriting from line when it forwards the email.

HEADER_OS_LEVEL=”$(/bin/uname -a)”;

> /var/log/clamav/freshclam.log

### Test clamscan
#/usr/bin/clamscan -ri /root/* > “$LOGFILE”;

/usr/bin/clamscan -ri –exclude-dir=/sys/* / > “$LOGFILE”;

# get the value of “Infected lines”
MALWARE=$(/bin/cat “$LOGFILE” | /bin/grep Infected | /usr/bin/cut -d” ” -f3);

# if the value is not equal to zero, send an email with the log file attached
if [ “$MALWARE” -ne “0” ];then

/bin/echo ” ” > /var/log/clamav/EMAIL.MSG;
/bin/echo “OS: $HEADER_OS_LEVEL” >> /var/log/clamav/EMAIL.MSG;
/bin/echo “Date: $HEADER_DATE” >> /var/log/clamav/EMAIL.MSG;
/bin/echo ” ” >> /var/log/clamav/EMAIL.MSG;
/bin/echo “Freshclam Status:” >> /var/log/clamav/EMAIL.MSG;
/bin/cat /var/log/clamav/freshclam.log >> /var/log/clamav/EMAIL.MSG;
/bin/echo ” ” >> /var/log/clamav/EMAIL.MSG;
/bin/echo “Log File: $LOGFILE” >> /var/log/clamav/EMAIL.MSG;
/bin/cat “$LOGFILE” >> /var/log/clamav/EMAIL.MSG;

/bin/cat /var/log/clamav/EMAIL.MSG | /usr/bin/mail -s “ClamAV Alert” “$EMAIL_TO”;

exit 0


usage: passbox [action]

Passbox – command line password manager utility


add-field Update an existing entry to add additional fields to
delete Remove an entry from the password database
get Get a particular password entry by it’s name
generate Generate a new random password
new Prompt to create a new passbox entry
remove-field Update an existing entry to remove additional fields
search Search the password database for a particular string, returns all matching entries
update Update an existing entry in the password database