IP Forward
IP Forward is small Apple Script I wrote to enable or disable IP forwarding on Mac OSX.
Only tested on OSX 10.5.8 (Leopard), I guess this script should work in almost all OSX versions
Here a screenshot:
Once you chose the action you want, the script will ask your super user password to apply the change.
Download
IP Forward v.1.00
2010-04-09 — ZIP package (344 Ko)
Changelog
Version 1.00 — 2010-04-09
- First release
Source code
(*
(c) Copyright 2010 Joris Berthelot <admin@eexit.net> httpt://www.eexit.net
*)
display dialog "Current state of IP Forwarding:" & return & return & (do shell script "sysctl net.inet.ip.forwarding") & return & (do shell script "sysctl net.inet.ip.fastforwarding") with title "IP Forward — eexit.net" with icon note buttons {"Enable", "Disable", "Quit"} cancel button 3 default button 1
set choice to button returned of result
try
if choice contains "Enable" then
display dialog (do shell script "sysctl -w net.inet.ip.forwarding=1 net.inet.ip.fastforwarding=1" with administrator privileges) with title "IP Forward — eexit.net" with icon note buttons {"Done"} default button 1 giving up after 10
end if
if choice contains "Disable" then
display dialog (do shell script "sysctl -w net.inet.ip.forwarding=0 net.inet.ip.fastforwarding=0" with administrator privileges) with title "IP Forward — eexit.net" with icon note buttons {"Done"} default button 1 giving up after 10
end if
on error the error_message number the error_number
beep
display dialog "Error: " & the error_number & return & the error_message with title "IP Forward — eexit.net" with icon stop buttons {"Quit"} default button 1
end try
Open Source Licence
IP Forward uses the MIT Licence.
Copyright © 2010-2018, Joris Berthelot.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.