I believe you can just put this in a text file here. Put it in your /Library/StartupItems folder and it'll launch when you reboot everytime. If StartupItems isn't there just make a folder called StartupItems and it should work.
Code:
#!/bin/sh
. /etc/rc.common
CheckForNetwork
if [ "${NETWORKUP:=-NO-}" = "-YES-" ]; then
sudo ipfw add deny udp from any to any 0000
fi
You can make the shell script executable and use cron to run it whenever you would like.
I don't know alot about cron, but you could do a 'man crom' from the terminal to get more info. I know you would have to edit your/etc/crontab file to get this to work. This way you could keep the file wherever you wish and then point to its correct location in the crontab.
Let me know if this works or not, and if it does, how you got it to work.