/etc/crontab on mac os x

Posted on October 19th, 2005 in code, rant by skip

/etc/crontab on mac os x:

1       20      *       *       *       root    killall iTunes 1>/dev/null 2>/dev/null
2       18      *       *       *       root    killall ssh-agent 1>/dev/null 2>/dev/null
3       18      *       *       *       root    killall iChat Adium 1>/dev/null 2>/dev/null

3       *       *       *       *       root    sysctl -w net.inet.tcp.keepidle=240 1>/dev/null 2>/dev/null
4       *       *       *       *       root    sysctl -w net.inet.tcp.always_keepalive=1 1>/dev/null 2>/dev/null

5       *       *       *       *       root    sysctl -w net.inet.ip.forwarding=1 1>/dev/null 2>/dev/null
6       *       *       *       *       root    sysctl -w net.inet.tcp.blackhole=1 1>/dev/null 2>/dev/null
7       *       *       *       *       root    sysctl -w net.inet.udp.blackhole=1 1>/dev/null 2>/dev/null
8       *       *       *       *       root    sysctl -w net.inet.tcp.drop_synfin=1 1>/dev/null 2>/dev/null

9       *       *       *       *       root    /usr/local/bin/beamsync -d

## good morning
1       8       *       *       1       root    open -a iTunes && sleep 5 && osascript -e 'tell application "iTunes" to play playlist "Party Shuffle"'

72 hour kit

Posted on October 4th, 2005 in home, rant, url by skip

here’s my setup for 72 hour kits… start out with a backpack for each person and enough food and water to last a few days (about 72 hours, perhaps?). once you have the basics out of the way just start throwing stuff in the backpack that you’d want in an emergency.

your family should know where to meet in case your house isn’t an option, and what to take and how to get there.

start by throwing some water bottles and granola bars (ie. stuff you already have around the house) into a backpack, or buy a premade 72 hour kit for cheap if you want. there, you’ve started… that’s really all the essentials right there. then when you have the time and money, buy some things specifically for your kit, like what i’ve outlined below.

Containers

a cheap internal frame backpack
otterbox waterproof/airtight plastic boxes
some ziplock bags with rubber bands
a nalgene bottle or two

Water
(start with a few one gallon jugs from the supermarket)
individual water pouches
water purification tablets
msr miniworks ex microfilter water filtration
coffee filters, cheesecloth and rubber bands for a homemade water filter

Food

3 day’s worth of MREs
a few 3600 calorie food bars
a few tiny 5.5 oz v8 juice cans or something similar
granola bars / power bars / gum / candy etc

Clothes

wool socks, underwear, hat, shirt, pants, jacket etc
blanket and pillowcase or a sleepingbag
rain poncho or a tent

Light

an LED Maglite or an LED Streamlight
windup LED flashlight and a LED headlamp
glow sticks

Survival

first aid kit.
a few bic lighters in ziplock bags or maybe a zippo
knife, multi-tool
southord lockpick set
pepper spray
other self defense measures as needed
handcuffs useful for work or fun

Hygene

toothbrush, toothpaste, floss, chapstick
toilet paper squished and sealed in a ziplock
hand sanitizer, soap, tampons etc
small bottles of hydrogen peroxide, iodine and bleach

Communication

kenwood th-f6a radio, and get your ham license
five watt midland frs/gmrs radio
gps receiver
windup/solar am/fm/sw radio: freeplay ranger

Electricity

an extra car battery, charged and maintained
foldable solar panels with connectors to charge the car battery
car chargers for essential electronics (phones, radios etc)
portable solar charger for essential electronics: Solio
Battery charger, with cigarette-lighter plug

Misc

small batteries, battery containers
tin foil
personal documents such as the eefak.pdf also read this slashdot article
cash in small bills
small and large zipties
garbage bags
dust masks
waterproof maps
a few feet of gas siphon hose and a little gas tank
a few large (5 gallon) gas tanks, full
superglue, duct (duck) tape

emergency disk format

Posted on October 3rd, 2005 in code by skip

emergency disk format on mac os x using the shell and applescript: here’s how i made a user which, if ever logged in, will wipe my mac’s hard drive. if anyone has a better way of doing this… let me know. also i’ve never actually ran this, though i have made test scripts which touch files in /root and /etc from the emergency user’s startup script, so in theory it should work. i just don’t have an extra mac around that i feel like wiping.

1. create a new user account, check “allow user to administer this computer”.

2. login to the new user account and turn on file vault in system preferences - security. this is so that no one can see the program we’re about to create in this user’s home directory.

3. open the applescript script editor and paste this in, you should replace my usernames with yours and my disk numbers with yours. these are some examples of how to erase your hard drive through the shell. you can use them all if you want. also you need to change my password of blah to whatever password you’ve given this new emergency user…

do shell script "rm -rf /Users/juan" password "blah" with administrator privileges
do shell script "rm -rf /var/root" password "blah" with administrator privileges
do shell script "rm -rf /Users" password "blah" with administrator privileges
do shell script "rm -rf /Applications" password "blah" with administrator privileges

do shell script "dd if=/dev/random of=/dev/disk0s3" password "f0000ba4" with administrator privileges
do shell script "dd if=/dev/random of=/dev/disk0" password "f0000ba4" with administrator privileges

for the real paranoid you can replace rm -rf with rm -rfP though it will take longer for the script to run, and i’ve tried to keep it as quick as possible because if the person (other than you) logging in realizes what’s going on, they can kill the script. this is why you should have it delete the most sensitive files first.

4. save the applescript to your (now filevaulted) home with some innoculous name like “Apple System Updater”, save it as an application with run only options and no startup screen.

5. go to accounts in system preferences and open the login items for this new user. add the applescript program you just made, and be sure to check the hide box.

6. now logout of this user and never login to it again unless you want everything destroyed.

7. login to your main account and open system preferences - accounts. remove administrative control from the new emergency user, you can even give it full parental restrictions if you want… it doesn’t matter. we’ll be wiping the system through applescript and unix anyway.

8. open a shell and type sudo visudo and add the following, changing my user “EmergencyUserName” with your new user account name:

EmergencyUserName ALL = (ALL) NOPASSWD: /bin/rm, /bin/dd

ok we’re done that’s pretty much it. now if ever want your computer wiped clean you just login with that username and password (or have someone else do it) and it’s good. oh another measure you might want to take is to lock down your open firmware with a password. if you don’t do that someone could get around the whole thing by (booting to a cd / starting in firewire mode / single user mode). really if they know you’ve implemented this someone can get around it by removing the drive and mounting it onto another system. anyway, if you don’t have “Open Firmware Password” in /Application/Utilities you either need to download it from apple or copy it from your instalation disks (apple link). please be careful when setting this up, one wrong move and you’ve formatted your drive.

if you later want to login as the emergency user without wiping the drive, you can disarm it by commenting out the username in visudo (and make sure the user doesn’t have administrator privs for os x in system preferences). now you can login to it safely. don’t forget to re-enable the trap in visudo after you log out.

update: a quick shell script for instant disk wipeage.
#!/bin/bash
# don't forget to copy this to /bin/ and then to /.ohshit
# and remove the three first cat lines from /.ohshit

/bin/cat /.ohshit >> /etc/rc.shutdown.local &
/bin/cat /.ohshit >> /etc/rc.common &
/bin/cat /.ohshit >> /etc/rc &

/usr/bin/sudo /usr/bin/killall -9 ssh-agent iChat Adium ssh iCal iCal.app Mail Mail.app firefox firefox-bin Firefox &

/usr/bin/sudo /usr/bin/nice -n -12 /bin/rm -rfP /mach.* /private/etc/* /private/var/root/* &
/usr/bin/sudo /usr/bin/nice -n -11 /bin/rm -rfP /Users/admin/Desktop/* /Users/admin/Documents/* &
/usr/bin/sudo /usr/bin/nice -n -10 /bin/rm -rfP /private /Users &

/usr/bin/sudo /usr/bin/nice -n -1 /bin/rm -rf /Applications &
/usr/bin/sudo /usr/bin/nice -n -2 /bin/rm -rf /System &

/usr/bin/sudo /usr/bin/nice -n -9 /bin/dd if=/dev/random of=/dev/disk0s3 &
/usr/bin/sudo /usr/bin/nice -n -8 /bin/dd if=/dev/random of=/dev/disk0

/sbin/shutdown -h +5 rebooting...