-
Notifications
You must be signed in to change notification settings - Fork 0
/
MacSpoof.applescript
82 lines (70 loc) · 3.86 KB
/
MacSpoof.applescript
1
2
3
4
5
6
7
8
9
10
11
-- MacSpoof ver. 2.0 by FŽlix An (NOW WITH GUI!-- Dedicated to Matthew Ma and Erika Schoenebeckon makeUpper(inString) return (do shell script "awk '{ print toupper($0) }' <<< \"" & inString & "\"")end makeUpperon getInterfaceName() return do shell script (POSIX path of (path to resource "getinterface.sh"))end getInterfaceNameon getMACAddress() return do shell script (POSIX path of (path to resource "getmac.sh"))end getMACAddresson randomMAC(oldMAC) return do shell script ("python " & (POSIX path of (path to resource "randommac.py")) & " " & oldMAC)end randomMACon changeMAC(interface, MACIn) return do shell script ((POSIX path of (path to resource "changemac.sh")) & " " & interface & " " & MACIn) with administrator privilegesend changeMACon welcome() return display dialog "Welcome to MacSpoof.
Your Wi-Fi interface: " & getInterfaceName() & "
Your MAC address: " & getMACAddress() & "
Click \"Spoof!\" to have the program detect your Wi-Fi interface automatically and generate a random MAC address.
Click \"Custom...\" to choose the interface and MAC address manually.
Click \"Quit\" to cancel and exit the program without making changes.
NOTE: You will need to enter an administrator's password. The Wi-Fi will be disabled briefly while the MAC address is being spoofed." with title "MacSpoof" buttons {"Quit", "Custom...", "Spoof!"} default button "Spoof!" cancel button "Quit" with icon noteend welcomeon autospoof() set currentInterface to getInterfaceName() set currentMAC to getMACAddress() set MACToSet to randomMAC(currentMAC) if changeMAC(currentInterface, MACToSet) is "0" and getMACAddress() is MACToSet then set finishAction to the button returned of (display dialog ("MAC address of interface " & currentInterface & " successfully spoofed to " & MACToSet & "!") with title "Success" buttons {"Back", "Quit"} default button "Quit" with icon note) else set finishAction to the button returned of (display dialog ("Failed to spoof MAC address of interface " & currentInterface & " to " & MACToSet & ".") with title "Failure" buttons {"Back", "Quit"} default button "Quit" with icon caution) end if if finishAction is "Quit" then quit end ifend autospoofon customspoof() set ifaceToSetManually to display dialog "Type in the name of your Wi-Fi interface. If you are not sure, the default option is probably right." with title "Enter Interface" default answer getInterfaceName() buttons {"Cancel", "Next"} default button "Next" cancel button "Cancel" set ifaceToSetManually to text returned of ifaceToSetManually set currentMAC to getMACAddress() set MACToSetManually to display dialog "Type in the MAC address you would like to spoof to.
NOTE: Changing the first three octets of the address may not be possible on some computers." with title "Enter MAC Address" default answer randomMAC(currentMAC) buttons {"Cancel", "Spoof!"} default button "Spoof!" cancel button "Cancel" set MACToSetManually to makeUpper(text returned of MACToSetManually) if changeMAC(ifaceToSetManually, MACToSetManually) is "0" and getMACAddress() is MACToSetManually then set finishAction to the button returned of (display dialog ("MAC address of interface " & ifaceToSetManually & " successfully spoofed to " & MACToSetManually & "!") with title "Success" buttons {"Back", "Quit"} default button "Quit" with icon note) else set finishAction to the button returned of (display dialog ("Failed to spoof MAC address of interface " & ifaceToSetManually & " to " & MACToSetManually & ".") with title "Failure" buttons {"Back", "Quit"} default button "Quit" with icon caution) end if if finishAction is "Quit" then quit end ifend customspoof-- Main program on run repeat while true set action to the button returned of welcome() if action is "Spoof!" then try autospoof() end try else if action is "Custom..." then try customspoof() end try end if end repeatend run