#!/bin/sh # # example shell script for setting up # on the fly your OpenBSD wifi # # zogs # http://www.autistici.org/c0de # # # # wifi-home is static configuration # wifi-work is dynamic (dhcp) configuration evil_chk_root(){ if [ $(whoami) != "root" ] ; then evil_usage fi } evil_usage(){ echo -e "you must be root: \n root ~ # $0 $1\n or \n user ~ \$ sudo $0 $1 \n" exit } case $1 in wifi-home) evil_chk_root echo "wifi-home..." echo "insert wifi interface : " read wifi echo "insert IP : " read iph echo "insert ssid : " read sih echo "insert key : " read kh ifconfig $wifi up ifconfig $wifi $iph netmask 255.255.255.0 nwid $sih nwkey $kh echo "Setting nameserver..." echo "nameserver 212.216.112.112" > /etc/resolv.conf cat /etc/resolv.conf echo "Setting route..." echo "insert route : " read rh route add default $rh echo "Done." ;; wifi-work) evil_chk_root echo "wifi-work..." echo "insert wifi interface : " read wifi echo "insert ssid : " read siw echo "insert key : " read kw ifconfig $wifi up ifconfig $wifi nwid $siw nwkey $kw echo "Start dhclient..." dhclient $wifi echo "nameserver 212.216.112.112" > /etc/resolv.conf echo cat /etc/resolv.conf ifconfig $wifi echo "done." ;; *) echo "args: [wifi-home | wifi-work]" ;; esac # zogs - zogs@anche.no http://www.autistici.org/c0de