Virus action.sh: Difference between revisions
Clandmeter (talk | contribs) (New page: #!/bin/sh ## Send the user usefull info in the notification email FROM="`awk '/^[Ff][Rr][Oo][Mm]:/' $EMAIL`" SUBJECT="`awk '/[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:/' $EMAIL`" ## Logfile to lo...) |
Dubiousjim (talk | contribs) (Category:Mail) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<pre> | |||
#!/bin/sh | |||
## Send the user usefull info in the notification email | |||
FROM="`awk '/^[Ff][Rr][Oo][Mm]:/' $EMAIL`" | |||
SUBJECT="`awk '/[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:/' $EMAIL`" | |||
## Logfile to log status to | |||
LOGFILE="/tmp/virus_action.log" | |||
## From email address where the notification email comes from | |||
MAILFROM="" | |||
## Email address to send a copy of the virus/spam email to | |||
QUARANTAINE="" | |||
exec 1>>"$LOGFILE" | |||
exec 2>>"$LOGFILE" | |||
notify_user() { | |||
echo "HELO `hostname -f`" | echo "HELO `hostname -f`" | ||
echo "MAIL FROM:<$MAILFROM>" | echo "MAIL FROM:<$MAILFROM>" | ||
Line 34: | Line 35: | ||
echo "Virus/spam name: $VIRUS" | echo "Virus/spam name: $VIRUS" | ||
echo "" | echo "" | ||
echo "If you think this is incorrect, please notify your administrator at | echo "If you think this is incorrect, please notify your administrator at once." | ||
echo "" | echo "" | ||
echo "Best regards," | echo "Best regards," | ||
Line 41: | Line 42: | ||
echo "." | echo "." | ||
echo "quit" | echo "quit" | ||
} | |||
send_virus() { | |||
echo "HELO `hostname -f`" | echo "HELO `hostname -f`" | ||
echo "MAIL FROM:<$MAILFROM>" | echo "MAIL FROM:<$MAILFROM>" | ||
Line 52: | Line 53: | ||
echo "." | echo "." | ||
echo "quit" | echo "quit" | ||
} | |||
notify_user | nc localhost 10026 | |||
send_virus | nc localhost 10026 | |||
rm "$EMAIL" | |||
</pre> | |||
[[Category:Mail]] |
Latest revision as of 09:47, 12 March 2012
#!/bin/sh ## Send the user usefull info in the notification email FROM="`awk '/^[Ff][Rr][Oo][Mm]:/' $EMAIL`" SUBJECT="`awk '/[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:/' $EMAIL`" ## Logfile to log status to LOGFILE="/tmp/virus_action.log" ## From email address where the notification email comes from MAILFROM="" ## Email address to send a copy of the virus/spam email to QUARANTAINE="" exec 1>>"$LOGFILE" exec 2>>"$LOGFILE" notify_user() { echo "HELO `hostname -f`" echo "MAIL FROM:<$MAILFROM>" for RCPT in "$RECIPIENTS"; do echo "RCPT TO:<$RCPT>" done echo "RCPT TO:<$RECIPIENTS>" echo "DATA" sleep 1 echo "Subject: Mail system notification" echo "Dear user," echo "" echo "A virus or spam email has been found by the mail system." echo "We have gathered the following information for you:" echo "" echo "Date: `date`" echo "$FROM" echo "$SUBJECT" echo "Virus/spam name: $VIRUS" echo "" echo "If you think this is incorrect, please notify your administrator at once." echo "" echo "Best regards," echo "" echo "Your mail administrator" echo "." echo "quit" } send_virus() { echo "HELO `hostname -f`" echo "MAIL FROM:<$MAILFROM>" echo "RCPT TO:<$QUARANTAINE>" echo "DATA" sleep 1 cat "$EMAIL" echo "." echo "quit" } notify_user | nc localhost 10026 send_virus | nc localhost 10026 rm "$EMAIL"