need help with wifi script

tkimpton
Valued Contributor II

Hi guys

I am tryin to blocked some certain SSIDs.

I was wondering if someone ca help me with variable for all the SSIDs.

so far this works

#!/bin/sh

# Prevent Access to RLSPOT001
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
| grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "RLSPOT001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLAVID001
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
| grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "RLAVID001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLSHEE001
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "RLSHEE001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLGUES001
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
| grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "RLGUES001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLBGAS001
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "RLBGAS001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# open networks control
# Prevent Access to BTFON
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [ $SSID = "BTFON" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

As you can see it makes my whole script very long.

I would appreciated if someone might be able to help me to create a variable for all of them

1 ACCEPTED SOLUTION

tkimpton
Valued Contributor II

Thanks Jared i just got round to adding in your variables and this is what i am using now :)

#!/bin/bash
################################################################################################################################################
#
# HISTORY
#
# Version: 2.8
#
# - Created by Tim Kimpton on November 29th, 2012
# - Assisted by Jared Nichols and Mike from JAMFNATION to clean up and simplify the blocked ssid case statement and network interface variables
#
# Stops network bridging turning the relevant network interface off and on
#
################################################################################################################################################


# SETTING THE ENVIRONMENT VARIABLES

# Get the ethernet hardware port (ehwport)
ehwport=`networksetup -listallhardwareports | awk '/.Ethernet/,/Ethernet Address/' | awk 'NR==2' | cut -d " " -f 2`

# Get the wireless network service (wservice)
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(Wi-Fi|AirPort)'`

# Get the wireless hardware port (whwport)
whwport=`networksetup -listallhardwareports | awk "/$wservice/,/Ethernet Address/" | awk 'NR==2' | cut -d " " -f 2`

# Find the ALL network hardware ports (hwports)
hwports=`networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/,/Ethernet/' | awk 'NR==2' | cut -d " " -f 2`

# Get the wireless network (wirelessnw)
wirelessnw=`networksetup -getairportnetwork $hwports | cut -d " " -f 4`

# Get the SSID
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
| grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

# Current Logged in User
consoleuser=`ls -l /dev/console | cut -d " " -f4`

# Carry out an OS version check
OS=`/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,4)}'`

# Work SSID
WorkSSID=XXX

# Authentication to use eg WPA2 Enterprise
Auth=WPA2E

# Index for SSID
Index=0

# Check to see if the JSS is available and if yes, then submits the current IP
checkjss=`/usr/sbin/jamf checkJSSConnection -retry 0 | grep "The JSS is available"`

# Department allowed to bypass SSID restrictions
Dept=XXX

# SSIDs to Block
Block1=XXX

Block2=XXX

Block3=XXX

Block4=XXX

####################################################################################

# See if ethernet if active and if it is then we need to turn OFF the wirelesss interface!
if ifconfig "${ehwport}" | grep inet; then
/usr/sbin/networksetup -setairportpower $whwport off

# There is also a bug where wireless network interfaces are caching DNS and causes problems when switching networks, so we need to clear them!
/usr/sbin/networksetup -setdnsservers $wservice "empty"

# if Ethernet is not active then...
elif ifconfig "${ehwport}" | grep inactive; then

# Clear the DNS cache for the wireless network service
/usr/sbin/networksetup -setdnsservers $wservice "empty"

# Do not ask to join new networks
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport prefs joinmode=automatic joinmodefallback=donothing

# Set the preferred wireless network to WorkSSID
/usr/sbin/networksetup -addpreferredwirelessnetworkatindex $whwport $WorkSSID $Index $Auth

# Turn the wirless hardware port on
/usr/sbin/networksetup -setairportpower $whwport on
fi

# Prevent 169 IP Address problem for  Work SSID
if [ $SSID = $WorkSSID ]; then
if ifconfig "${whwport}" | grep 169;
then

# If APIPA turn wireless hardware port off
/usr/sbin/networksetup -setairportpower $whwport off

# turn wireless hardware port on
/usr/sbin/networksetup -setairportpower $whwport on
fi
fi

# Get the wireless network (wirelessnw)
wirelessnw=`networksetup -getairportnetwork $hwports | cut -d " " -f 4`

# Block  wireless networks
case $wirelessnw in
$Block1)
networksetup -setairportpower $whwport off
;;
esac

# If logged in user is in I.S allow access to SSIDs but block everyone else!
if
dscl . -read /Users/"${consoleuser}" | grep "$Dept"
then echo "$Dept Allowed!"
else

# Block the restricted wireless networks with a case statement below
case $wirelessnw in
$Block2|$Block3|$Block4)

# Turn off wifi
networksetup -setairportpower $whwport off

# Set the preferred wireless network to WorkSSID
/usr/sbin/networksetup -addpreferredwirelessnetworkatindex $whwport $WorkSSID $Index $AuthE

# Remove Wireless networks
/usr/sbin/networksetup -removeallpreferredwirelessnetworks $whwport

;;
esac
fi

# Check to see it the jss is ping-able and if so submit the ip change to the jss. 
# This is useful when using Casper Remote and users are switching between wired and wireless

if [ "$checkjss" == "The JSS is available." ]; then
/usr/sbin/jamf log
fi
exit 0

View solution in original post

68 REPLIES 68

mm2270
Legendary Contributor III

A 'case' statement might do the trick here, although I'm not so good at writing those.

Another way may be to use the 'or' operand in your conditional statement. Something like this, though I can't test this out, so I'm not certain this will work-

#!/bin/sh

SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

if [[ $SSID = "RLSPOT001" || "RLAVID001" || "RLSHEE001" || "RLGUES001" || "RLBGAS001" || "BTFON" ]]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

There are likely much more elegant ways of doing this though.

jarednichols
Honored Contributor

First, finding your SSID is way easier with networksetup. Before that though, you're going to need to detect which interface is your Wi-Fi interface. On a MacBook Air, it's going to be en0. On anything with built-in ethernet it's going to be en1 (or even en2 on a Mac Pro with dual ethernet NICs)

Detect your wi-fi interface with this:

wifi=`networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/,/Ethernet/' | awk 'NR==2' | cut -d " " -f 2`

Then find your SSID with:

SSID=`networksetup -getairportnetwork $wifi | cut -d " " -f 4`

Lastly, case statement for the SSIDs you want to restrict. Here's your full script:

#!/bin/sh

#Detect our Wi-Fi interface
wifi=`networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/,/Ethernet/' | awk 'NR==2' | cut -d " " -f 2`

#Detect our connected SSID:
ssid=`networksetup -getairportnetwork $wifi | cut -d " " -f 4`

case $ssid in
   RLSPOT001|RLAVID001|RLSHEE001|RLGUES001|RLBGAS001)
     networksetup -setairportpower $wifi off
     ;;
esac

I haven't tested a lick of it so test test test.

mm2270
Legendary Contributor III

Didn't think of it, but Jared is correct. If you have a mix of Mac types you need to make sure you know which interface WiFi is mapped to for your script to work. If, on the other hand you have all MacBook Pros or all iMacs, e.g, and it will stay that way, the way you have it is fine. Its probably still safer to detect the WiFi interface though.

tkimpton
Valued Contributor II

Thanks guys

i also need to allow for a dns bug and need it to work for 10.6 "airport" and wi-fi 10.7+

airport=/usr/sbin/networksetup -listallnetworkservices | grep -E '(Wi-Fi|Airport)'

jarednichols
Honored Contributor
airport=`/usr/sbin/networksetup -listallnetworkservices | grep -E '(Wi-Fi|Airport)'`

All I got back was "Wi-Fi" (on 10.8.1). I would think you're trying to return the actual interface (en0 vs en1) or am I misunderstanding something?

mm2270
Legendary Contributor III

In 10.6.x it was listed as "AirPort", not "WiFi". I think that's what he's referring to.

tkimpton
Valued Contributor II

Thanks this is what i have below and works for me.

I think i will just leave it

#!/bin/bash

##################################################################################
#
# HISTORY
#
# Version: 2.2
#
# - Created by Tim Kimpton on September 12th, 2012
#
# Stops network bridging turning the relevant network interface off and on
#
#
#
###################################################################################

# SETTING THE ENVIRONMENT VARIABLES

# Get the wirless or airport hardware port
  airport=`/usr/sbin/networksetup -listallnetworkservices | grep -E '(Wi-Fi|Airport)'`

# Current Logged in User
  consoleuser=`ls -l /dev/console | cut -d " " -f4`

# Get the SSID
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

####################################################################################

# See if ethernet if active and if it is then we need to turn OFF the wirelesss interface!
# There is also a bug where wireless network interfaces are caching DNS and causes problems when switching networks, so we need to clear them!

if ifconfig en0 | grep inet; then
/usr/sbin/networksetup -setairportpower en1 off
/usr/sbin/networksetup -setdnsservers $airport "empty"


# Otherwise if Ethernet is not active we need to turn ON the wireless interface!
# There is also a bug where wireless network interfaces are caching DNS and causes problems when switching networks, so we need to clear them!

elif ifconfig en0 | grep inactive; then
/usr/sbin/networksetup -setdnsservers $airport "empty"
/usr/sbin/networksetup -setairportpower en1 on
fi

# Pause 10 seconds to allow for enough time for the network interface to intiate and get an ip address!
sleep 10

# Open AutoMount Script to mount network shares
su - "${consoleuser}" -c 'open /Applications/AutoMountScript.app'

# Prevent 169 IP Address problem for SSID RLCORP001
if [ $SSID = "RLCORP001" ]; then
if ifconfig en1 | grep 169;
then
/usr/sbin/networksetup -setairportpower en1 off
/usr/sbin/networksetup -setairportpower en1 on
fi
fi

# Prevent Access to RLINNO001
if [ $SSID = "RLINNO001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLSPOT001
if [ $SSID = "RLSPOT001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLAVID001
if [ $SSID = "RLAVID001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLSHEE001
if [ $SSID = "RLSHEE001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLGUES001
if [ $SSID = "RLGUES001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to RLBGAS001
if [ $SSID = "RLBGAS001" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# open networks control

# Prevent Access to BTFON
if [ $SSID = "BTFON" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

# Prevent Access to BTFOpenzone
if [ $SSID = "BTFOpenzone" ]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

exit 0

jarednichols
Honored Contributor

Alrighty... I just think it's way longer than it needs to be...

tkimpton
Valued Contributor II

Me too i tried shortening it with below but wifi kept turning off and on again constantly so i changed it back :(

if [[ $SSID = "RLSPOT001" || "RLAVID001" || "RLSHEE001" || "RLGUES001" || "RLBGAS001" || "BTFON" ]]; then
/usr/sbin/networksetup -setairportpower en1 off
fi

mm2270
Legendary Contributor III

Did you try Jared's case statement? My method was just a random shot and i honestly didn't know if it would work right. Apparently it doesn't Try out jared's script. I also think your script is too long for what my opinion is worth.

tkimpton
Valued Contributor II

Not properly. I tried adding to the wifi variable the hardware port Airport to also cover 10.6 machines but got stuck on it and had to go cos it evening here :(

mm2270
Legendary Contributor III

OK, if I'm not mistaken in 10.6 it returns as "AirPort" (note the capital "P") so make sure you grep or awk for that or you won't get proper results.

Anyway, give the case statement script Jared posted a try when you can. That should work.

tkimpton
Valued Contributor II

Thanks guys will have a go in the morning. Sweet case statements... I've never done that before :)

tkimpton
Valued Contributor II

morning guys

just stuck on one last command

I need to get the hardware port of Ethernet whether it is active or not. This to allow for different harware models etc

so some how to networksetup -listhardwareports but to only return the en0 etc of the Ethernet hardware port and another to get the wireless

As you can see below its nearly there but as you guys rightly said i cannot always be sure that ethernet is going to be en0 and wireless is en1.

I also tried setting a variable for the blocked ssids but i messed that up and stopped.

i changed some variable names for clarity

#!/bin/bash

##################################################################################
#
# HISTORY
#
# Version: 2.4
#
# - Created by Tim Kimpton on September 13th, 2012
# - Assisted by Jared Nichols and Mike from JAMFNATION to clean up and simplify the blocked ssid case statement and network interface variables
#
# Stops network bridging turning the relevant network interface off and on
#
#
#
###################################################################################

# SETTING THE ENVIRONMENT VARIABLES

# Get the ethernet hardware port (ehwport)
ehwport=`networksetup -listallhardwareports | awk '/Hardware Port: Ethernet/' | awk 'NR==2' | cut -d " " -f 2`

# Get the wireless hardware port (whwport)
whwport=`networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/,/AirPort/' | awk 'NR==2' | cut -d " " -f 2`

# Find the ALL network hardware ports (hwports)
hwports=`networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/,/Ethernet/' | awk 'NR==2' | cut -d " " -f 2`

# Get the wireless network service (wservice)
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -E '(Wi-Fi|AirPort)'`

# Current Logged in User
  consoleuser=`ls -l /dev/console | cut -d " " -f4`

# Get the SSID
SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
 | grep ' SSID:' | cut -d ':' -f 2 | tr -d ' '`

####################################################################################

# See if ethernet if active and if it is then we need to turn OFF the wirelesss interface!
# There is also a bug where wireless network interfaces are caching DNS and causes problems when switching networks, so we need to clear them!

if ifconfig en0 | grep inet; then
/usr/sbin/networksetup -setairportpower $whwport off
/usr/sbin/networksetup -setdnsservers $wservice "empty"


# Otherwise if Ethernet is not active we need to turn ON the wireless interface!
# There is also a bug where wireless network interfaces are caching DNS and causes problems when switching networks, so we need to clear them!

elif ifconfig en0 | grep inactive; then
/usr/sbin/networksetup -setdnsservers $wservice "empty"
/usr/sbin/networksetup -setairportpower $whwport on
fi

# Pause 10 seconds to allow for enough time for the network interface to intiate and get an ip address!
sleep 10

# Open AutoMount Script to mount network shares
su - "${consoleuser}" -c 'open /Applications/AutoMountScript.app'

# Prevent 169 IP Address problem for SSID RLCORP001
if [ $SSID = "RLCORP001" ]; then
if ifconfig en1 | grep 169;
then
/usr/sbin/networksetup -setairportpower $whwport off
/usr/sbin/networksetup -setairportpower $whwport on
fi
fi

# Get the wireless network (wirelessnw)
wirelessnw=`networksetup -getairportnetwork $hwports | cut -d " " -f 4`

# Block the restricted wireless networks with a case statement below
case $wirelessnw in
RLSPOT001|RLAVID001|RLSHEE001|RLGUES001|RLBGAS001)
     networksetup -setairportpower $whwport off
;;
esac

exit 0

jarednichols
Honored Contributor

Give me a bit... I'll work this out.

carlo_anselmi
Contributor III

Very interesting topic, Thank you.
Me too I would be interested in a "universal"- hardware-independent script (10.6+). I would just use it to turn off Airport/WiFi when connected with Ethernet.
Ciao
Carlo

jarednichols
Honored Contributor

Okay so to detect your Wi-Fi interface, use this:

#Detect the wireless service name
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(wi-fi|airport)'`
#Detect our Wi-Fi interface
wifi=`networksetup -listallhardwareports | awk "/$wservice/,/Ethernet Address/" | awk 'NR==2' | cut -d " " -f 2`

To detect Ethernet use this:

ethernet=`networksetup -listallhardwareports | awk '/.Ethernet/,/Ethernet Address/' | awk 'NR==2' | cut -d " " -f 2`

This will first detect what your wireless interface is called (AirPort or Wi-Fi) - I changed your grep to include a -i to ignore case on your 'wi-fi' or 'airport' matching. I want to say that I recall that at one point it was 'AirPort' and then shortly before going to 'Wi-Fi' it was 'Airport.' At any rate, including the -i flag will catch all of the case permutations.

Warning
I haven't yet accounted for instances where you have more than one Ethernet interface (active or not). For instance, you're going to have issues if you've got a Mac Pro or a MacBook Air that's got two wired interfaces.

For instance, I've got mine plugged into a Thunderbolt display. The Display Ethernet is en3. If I plugged in a USB or Thunderbolt Ethernet adapter, I'd end up with another *Ethernet adapter - that "/.Ethernet/" bit in the awk command is a wildcard. The period before Ethernet matches anything before Ethernet. Thus it'll match Built-In Ethernet, Display Ethernet (from a Thunderbolt Display), Thunderbolt Ethernet and USB Ethernet.

If you want, you could take the result of having two *Ethernet interfaces and throw it through some logic to figure out which one is active. But, it looks like with your script, you're really more interested in nailing down which interface is the Wi-Fi. As I don't see your $ehwport called anywhere.

rmanly
Contributor III

Mostly as an exercise to see if I could do it...I got rid of some of the pipes from the wifi command substitution. Also, used $() notation just because it is easy to confuse backticks and single quotes.

wifi=$(networksetup -listallhardwareports | awk "/$wservice/,/Ethernet/"' getline { print $2 }')

tkimpton
Valued Contributor II

Apologies I'm not at work because its evening and I can't test anything.

I forgot I had $ehwport not being used. Forgive me but this still looks like it doesn't provide the ethernet en and wireless en.

I'm tryin to account for an eithernet en? plugged in and don't care which one it is. If ethernet isn't on i want wireless en? on.

Hope that makes sense. It still unfortunately looks like it will return service names.

tkimpton
Valued Contributor II

Thanks guys I will have a look in the morning and things will hopefully be clearer :)

rmanly
Contributor III

for checking for active ethernet you can do this, should be a little better than grep'ing the output of ifconfig...

[[ ipconfig getifaddr en0 ]] && some commands

OR

if ipconfig getifaddr en0; then
    some commands
else
    some other commands
fi

I will work on the whole script after/during lunch if I can.

NOTE: for grep the way you are using it, when you NEED to, you usually want "grep -q" Then you are just checking for success or failure without any output etc.

rmanly
Contributor III

I remembered while driving over to a different building that the last time someone wanted to do some fancy stuff that required accounting for Mac Pros, MacBooks Air, etc. etc. was when I decided I should learn Python.

Parsing all this via shell script sucks so bad... :(

It would be really nice if Apple followed the other nixes and BSDs and started using wlan0, eth0, etc for interface names. Or at least something different like ura0 for a ralink chipset or whatever.

rmanly
Contributor III

@tkimpton going back to your original question about blocking certain SSIDs why don't you just

  1. clear out the preferred network list
  2. add the network you want to the list
  3. require admin password to change
  4. then join the specific network.

Is this not an option?

tkimpton
Valued Contributor II

Unfortunatly not we use certificates and for us in it we need access to those other ssids for other reasons unknown to the normal user.

Thanks for the grep -q advise. I don't intend to ever get say macbookairs in her but hey never know what management will just go. And buy then throw it on my desk to set up, just like the ceo did yesterday!

Hmmmm there just no gurantee that ethernet is en0 etc.

Possibly only other was is system profiler info our outputting the en? For Ethernet to a hidden file at startup and referencing that.

Not sure if it possible but for it to work properly for all models then some sort of referincing needs to take place.

Night guys I'm resting my brain for a bit.

rmanly
Contributor III

I was thinking this might be cleaner in straight up awk...

turns out not so much. at least with my proficiency :D

But at more than 5 or so lines this is the biggest thing I have EVER tried to do in awk and I learned a LOT!, so not all bad.

I give you tkimpton.awk ;) All it really does is turn off Wi-Fi if an IP address is found on an Ethernet interface. Assuming of course there are no custom service names.

run like so:

networksetup -listnetworkservicesorder | ./tkimpton.awk

EDIT: see commented & updated code below

rmanly
Contributor III

EDIT: :P

tkimpton
Valued Contributor II

Wow thats amazing! Not sure how to allow for Airport service name though.

tkimpton
Valued Contributor II

excuse my ignorance. How do i run this?

i tried networksetup -listnetworkserviceorder | /Library/Management/Scripts/test.awk

jarednichols
Honored Contributor

nah nah, just run it like a script. the first line (the "she-bang") tells the system which interpreter to use).

In this case, it's saying "use awk for what follows. it's located at /usr/local/bin/awk"

jarednichols
Honored Contributor

nah nah, just run it like a script. the first line (the "she-bang") tells the system which interpreter to use).

In this case, it's saying "use awk for what follows. it's located at /usr/local/bin/awk"

tkimpton
Valued Contributor II

thought so

the first line confused me # run like...

unfortunately its not working for me

line 5: BEGIN: command not found
line 9: syntax error near unexpected token `}'
line 9: `}'

rmanly
Contributor III

EDIT: fixed

rmanly
Contributor III

EDIT: shebang is fixed in the code above

@tkimpton oh crap!

I see the problem!

I have gawk installed on my machine and it is symlinked to /usr/local/bin/awk - default OS X awk is at /usr/bin/awk

Change the shebang to

#!/usr/bin/awk -f and it works. I will edit the above

rmanly
Contributor III

EDIT: fixed

rmanly
Contributor III

Updated to handle both Airport and AirPort. Tested on 10.6.8.

Created feature request for two backslashes here:

https://jamfnation.jamfsoftware.com/featureRequest.html?id=799

tkimpton
Valued Contributor II

Thanks for looking at this

I will probably have to use the script then another to block my ssids I don't want them connected to.

I don't know how to add in there to set the dns to "empy" to get around the wirless dns caching bug and prevent apipa

bentoms
Release Candidate Programs Tester

Hey fella,

Have a look here: http://macmule.com/2011/09/09/how-to-turn-off-wireless-card/

Part of that script says how to clear DNS.

tkimpton
Valued Contributor II

Hi Ben

Yeah sorry. I meant I don't know how to add in in to the awk script to make it workable for me. :(

tkimpton
Valued Contributor II

Hi Ryan

Is it possible you can email me the script. Im having some problem understanding what to change to make it work.

Thanks