Operating System - Linux
1827881 Members
1251 Online
109969 Solutions
New Discussion

Re: Procmail Shell Script

 
Chan Choth PUTH
Advisor

Procmail Shell Script

Dear Sir or Madam:

Would you mind explaining me each line of this script? I do not well understand with this script. What is :O means, !^, *, \ ...etc...? The script is like the following:
#Trap unapproved attachments
SHELL=/bin/sh
LOGFILE=/var/log/procmail.log
:0
* !^FROM_DAEMON
* ^Content???Type: (Multipart|Application)
* B ?? Name=(\/".+\.(EXE|COM|BAT|WAV|PIF|SCR)"|\/.+\.(EXE|COM|BAT|WAV|PIF|SCR))
{
LOGFILE=/var/log/delmail.log
:0 h i c
| ( formail ???r ???A 'From: MAILER???DAEMON@domain_name'; echo; echo " ***********SECURITY WARNING***********"; echo; echo "Your computer seems to be infected by a virus ??? I received mail from you"; echo; echo "with an attachment[$MATCH] which you probably did not send intentionally."; echo; echo "This message will be deleted automatically."; echo; echo "Please do not send any e???mail out before you have cleaned out the virus,"; echo "otherwise, it will again send itself by picking up random file from your"; echo "computer and a virus file to others."; echo; echo; echo; echo; echo " ";) | $SENDMAIL ???U ???oi ???t

LOG="Del: "

:0
/dev/null

}
Thank you so much for your explanation.

Regards,

Choth
Sharing IT knowledge and Information
2 REPLIES 2
Def_1
New Member

Re: Procmail Shell Script

#Trap unapproved attachments
#Comment :)

SHELL=/bin/sh
#set environment variable(shell path for run scripts)

LOGFILE=/var/log/procmail.log

:0
# apply lines bellow for all message

* !^FROM_DAEMON
#not apply for mails from FROM_DAEMON

* ^Content???Type: (Multipart|Application)
#all mail where Content-Type=... in headers

* B ?? Name=(\/".+\.(EXE|COM|BAT|WAV|PIF|SCR)"|\/.+\.(EXE|COM|BAT|WAV|PIF|SCR))
#regexp for matching with name of attach files


#and bellow script for create reply mail(used utils formail and drop incoming mail)

{
LOGFILE=/var/log/delmail.log
:0 h i c
| ( formail ???r ???A 'From: MAILER???DAEMON@domain_name'; echo; echo " ***********SECURITY WARNING***********"; echo; echo "Your computer seems to be infected by a virus ??? I received mail from you"; echo; echo "with an attachment[$MATCH] which you probably did not send intentionally."; echo; echo "This message will be deleted automatically."; echo; echo "Please do not send any e???mail out before you have cleaned out the virus,"; echo "otherwise, it will again send itself by picking up random file from your"; echo "computer and a virus file to others."; echo; echo; echo; echo; echo " ";) | $SENDMAIL ???U ???oi ???t

LOG="Del: "

:0
/dev/null

}



--------------
programmer of AlarIT

*
http://www.alarit.com
*

Chan Choth PUTH
Advisor

Re: Procmail Shell Script

Dear Def,

Thank you so much for your reply. I would like to ask you some remaining explanations:
:0 Is it capital o or zero? You say that "# apply lines bellow for all message". What is its long form means, I mean that URL is stand for Uniform Resource Locator and what is capital o or zero means? What is *, !, ^, \/, \, |?

* ^Content-Type: (Multipart|Application)
#all mail where Content-Type=... in headers
Would you mind telling me "all mail where Content-Type=... in headers", what this line means sir, I do not understand.

* B ?? Name=(\/".+\.(EXE|COM|BAT|WAV|PIF|SCR)"|\/.+\ (EXE|COM|BAT|WAV|PIF|SCR))
#regexp for matching with name of attach files
What is B means? What this line means sir :0 h i c? h i c? What these following lines mean?
echo " ";)|$SENDMAIL -U -oi -t
LOG="Del: "
:0
/dev/null

Thank you so much for your explanation and thank you for giving me a very good idea on writing the script.

Best regards,

Chot
Sharing IT knowledge and Information