Skip to content

Commit

Permalink
Merge pull request #4 from RickyCook/mac-change
Browse files Browse the repository at this point in the history
Add output for mac spoof/iface bounce
  • Loading branch information
ps-jay committed May 7, 2015
2 parents 60efabe + d83f280 commit d5f1782
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pguest
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ DEFAULT_WIFI_SERVICE = 'Wi-Fi'
DEFAULT_WIFI_SSID = 'PGuest'
DEFAULT_SPOOF_TIMEOUT = 60 # 1min

CHR_SPOOF = unichr(10558)
CHR_WIFI_DOWN = unichr(10597)
CHR_WIFI_UP = unichr(10595)

AIRPORT_PATH = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'

# User data
Expand Down Expand Up @@ -128,6 +132,8 @@ def spoof_mac(interface_name):
command_call = ['ifconfig', interface_name, 'ether', new_mac]
try:
subprocess.check_call(command_call)
sys.stdout.write(CHR_SPOOF)
sys.stdout.write(' ')
return True
except subprocess.CalledProcessError, e:
print "Unable to spoof MAC address: %s" % e
Expand All @@ -137,8 +143,11 @@ def spoof_mac(interface_name):
def bounce_wifi(interface_name):
command_call_prefix = ['networksetup', '-setairportpower', interface_name]
try:
for wifi_status in ('off', 'on'):
for wifi_status, char in (('off', CHR_WIFI_DOWN), ('on', CHR_WIFI_UP)):
subprocess.check_call(command_call_prefix + [wifi_status])
sys.stdout.write(char)
sys.stdout.write(' ')

except subprocess.CalledProcessError, e:
print "Unable to turn Wi-Fi %s: %s" % (wifi_status, e)
return False
Expand Down Expand Up @@ -316,6 +325,9 @@ if __name__ == "__main__":
print u" \u2717: PGuest authentication required"
print u" !: PGuest authentication failed (non-200 HTTP response)"
print u" ?: Couldn't reach google.com, or the PGuest login page"
print u" %s: MAC address spoofed" % CHR_SPOOF
print u" %s: Wi-Fi interface turned off" % CHR_WIFI_DOWN
print u" %s: Wi-Fi interface turned on" % CHR_WIFI_UP
print u" -: Not connected to PGuest SSID"
print ""
elif (
Expand Down

0 comments on commit d5f1782

Please sign in to comment.