I keep doing the same ipfw commands over and over. Enough of that, here is my first applescript application every. Probably filled with bugs and other scary things, and I’m probably not the first one to do this, but I think I’m the first to stick the source out there.
property FLUSH_TEXT : "Quit and flush" property SET_TEXT : "Set speed" -- be damn carefull what you input here, it will run as root on ipfwLimit(bandwidth) my ipfwFlush() do shell script "ipfw pipe 1 config bw " & bandwidth & "KB" with administrator privileges do shell script "ipfw add 10 pipe 1 tcp from any 80 to me" with administrator privileges do shell script "ipfw add 11 pipe 1 tcp from me to any 80" with administrator privileges end ipfwLimit -- flush any ipfw rules on ipfwFlush() do shell script "ipfw -f flush" with administrator privileges end ipfwFlush on main() set question to display dialog "Control your http traffic speed" buttons {FLUSH_TEXT, SET_TEXT} default button 2 set answer to button returned of question if answer is equal to FLUSH_TEXT then my ipfwFlush() end if if answer is equal to SET_TEXT then set bandwidth_question to display dialog "Enter bandwidth in KB/s (don't do something stupid like entering \"; rm -rf /)" default answer "56" set bandwidth to text returned of bandwidth_question my ipfwLimit(bandwidth) my main() end if end main my main()