Closed SilverFoxx closed 11 years ago
Hows this Eric? (I haven't run it yet but it reads OK)
f_macchange(){
while [[ -z "${VAR}" ]]; do read -p "Macchange ${MACFACE}? (y/n): " VAR; done case ${VAR} in y|Y) while [[ -z "${RAND}" ]]; do read -p "Random MAC? (y). Or manual (m): " RAND; done case ${RAND} in y|Y) ifconfig "${MACFACE}" down && macchanger -A "${MACFACE}" && ifconfig "${MACFACE}" up;; m|M) while [[ -z $ap_mac ]]; do read -p "Desired MAC Address for "${MACFACE}"?: " ap_mac; done if [[ echo "${ap_mac}" | egrep "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$" ]]; then ifconfig "${MACFACE}" down && macchanger -m $ap_mac "${MACFACE}" && ifconfig "${MACFACE}" up;; else echo -e "Invalid MAC address!" RAND="" VAR="" sleep 2 f_macchange fi;; ) RAND="" VAR="" f_macchange;; esac sleep 2;; #to allow interface to come up n|N) VAR="";; ) VAR="" f_macchange;; esac }
(Sorry, formatting lost in post)
Before calling function, set ${MACFACE}. Eg if calling from fakeAP,add
Same applies for IWFACE, dosmon, radwiface etc
There are some considerations in calling the function for IFACE: no legitimate reason to macchange, can cause NAT problems if in a VM, will disconnect from network. Might be best to leave the user to macchange this interface outside the script?
I notice you don't check whether all other tools are installed, so maybe no need to check macchanger? I think the worst that will happen is that the script will continue running but without the mac being spoofed.
I know - a few {} missing
I made some changes, please check the code and let me know if that is acceptable for you. It seems to be working as expected.
Eventually