Making a list of IPs that try relaying on my Postfix server
Making a list of IPs that try relaying on my Postfix server
- Subject: Making a list of IPs that try relaying on my Postfix server
- From: Bernardo Hoehl <email@hidden>
- Date: Fri, 19 Nov 2004 12:43:41 -0200
Hi List,
I am working a new script to collect IP numbers from /var/log/mail.log that try relaying SPAM on my server, put on a list and later add them to my IPFW rules. Maybe I will use separate scripts, one for making the list, and another for implementing the rules in IPFW, and Crontab for actually running both scripts periodically.
I am a bit confused at this moment, and would like to share my code with you (not fully functional at this moment).
I appreciate reading your comments, how you would approach the problem.
Thanks,
Bernardo Hoehl
Rio de Janeiro - Brazil.
++++++++++++++++
property MyBockedList : ""
set numero to -1
repeat 100 times
try
set MaiLog to do shell script "tail " & numero & " /var/log/mail.log"
set MyString to MaiLog --paragraph 1 of MaiLog
--display dialog MyString giving up after 1
if MyString contains "Relay access denied" then
--beep
set AppleScript's text item delimiters to the "["
set the item_list to every text item of MyString
set TheIpBlock to item 3 of the item_list
set AppleScript's text item delimiters to the "]"
set the item_list to every text item of TheIpBlock
set TheIp to item 1 of the item_list
tell me to activate
--display dialog MyBockedList giving up after 1
end if
set numero to numero - 1
if TheIp contains "." and MyBockedList does not contain TheIp then
set MyBockedList to MyBockedList & TheIp & return
end if
end try
end repeat
return MyBockedList _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden