Sebkinne Posted November 7, 2013 Share Posted November 7, 2013 I hadn't changed MACs this way actually, we did it at a different place. I like the simplicity of this though, we will include mac changing like this in the upcoming network tile update! Quote Link to comment Share on other sites More sharing options...
jjd Posted November 7, 2013 Author Share Posted November 7, 2013 (edited) I hadn't changed MACs this way actually, we did it at a different place. I like the simplicity of this though, we will include mac changing like this in the upcoming network tile update! And someone said you didn't want the ability to change macs and that you were deleting posts lol Thanks Seb would love to see this ability in the network tile. Edited November 7, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
jjd Posted November 7, 2013 Author Share Posted November 7, 2013 jjd: So just to clarify. Where do you copy the files _MACOSX folder, changemac and maclist.lst files to exactly? And the script above should be as simple as inputting it and executing under configuration > advanced > execute commands. ? ya sorry about that I forgot about _MACOSX I'll re upload without that to avoid confusion. you can put the changemac and maclist.lst files anywhere you like but if you put them in say /root then you will only be able to run them from there (not sure where the web gui executes from).... if you put it in say /usr/bin you will be able to run it from anywhere. and if you do copy the maclist.lst file remember to install bc before running it (instructions in post 25). then you should be able to run it from configuration > advanced > execute commands Quote Link to comment Share on other sites More sharing options...
BAHansen.us Posted November 7, 2013 Share Posted November 7, 2013 I hadn't changed MACs this way actually, we did it at a different place. I like the simplicity of this though, we will include mac changing like this in the upcoming network tile update! Thank You Seb! True opensource collaboration on this one!! Quote Link to comment Share on other sites More sharing options...
jjd Posted November 9, 2013 Author Share Posted November 9, 2013 (edited) until changing mac addresses is part of the ui here is an easier way to install the change mac script so it will run from any directory or dip switches simply run the following via ssh or through execute command from the web gui wget -P /tmp/ http://trtsgc.com/changemac/install.sh; chmod +x install.sh; sh /tmp/install.sh Personally I set two dips for mac addresses for now WiFi Pineapple MK5 mac address changer. Usage: changemac [options] changemac -r Set random mac addresses changemac -c Set mac addresses back to default changemac -m [wlan0 mac] [wlan1 mac] Set specific mac addresses changemac -reset Reset wireless config to default changemac -d Install changemac dependencies* changemac -u Update changemac* *Needs internet access Edited November 9, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
514senica Posted November 9, 2013 Share Posted November 9, 2013 Nice work! Thanks However, I am not sure if its due to your script, or something with the pineapples client mode, but after running "changemac -r" I cannot get wlan1 to connect to my home access point. It did a great job changing the macs, and it did work the first time, but somethings wrong. When I connect through wlan0, and click on the client tab, it seems to have a hard time recognizing ssids. It will eventually detect ssids if i click the recognize ssids button a few time, but it will not connect to my access point. I have tried rebooting, and clearing the dhcp list on my access point. Your script might not be the problem! (I have been having issues with wlan1 internet connection sharing, and connecting to my home access point previously). Thanks again for the script! I really appreciate the time you put into making it, as well as the steps to simplify the instillation. Quote Link to comment Share on other sites More sharing options...
jjd Posted November 9, 2013 Author Share Posted November 9, 2013 Hmm that does sound weird. Can you post the output of "cat /etc/config/wireless" after running changemac -r I have also had to hit refresh ssid's a few times since getting my mk5 but after it lists them I have had no issues connecting since the first network tile update Quote Link to comment Share on other sites More sharing options...
xrad Posted November 9, 2013 Share Posted November 9, 2013 Thank you jjd for all the hours you spent working on this. If I change (changemac -r) the mac's, it does say it changes, but in the "Network" tile it still shows the true Mac. I would guess it is working, and that tile is wrong? Quote Link to comment Share on other sites More sharing options...
514senica Posted November 9, 2013 Share Posted November 9, 2013 Just hit a factory reset, and am out the door. Tonight I will re-nstall the script, and see if I can replicate the problem, and post the output. Thanks Quote Link to comment Share on other sites More sharing options...
jjd Posted November 9, 2013 Author Share Posted November 9, 2013 (edited) Wireless manager does not show the changed Mac if that's where your looking. I believe it gets it's info from the wrong location and Not from ifconfig. If you click the system's network infusion it shows an ifconfig on the first page and under wlan0 and wlan1 it should show the changed Mac addresses not the default 00:13:##:##:##:## ones Edited November 9, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
514senica Posted November 9, 2013 Share Posted November 9, 2013 Here is my /etc/config/wireless config wifi-device 'radio0' option type 'mac80211' option channel '11' option hwmode '11ng' option macaddr '00:13:37:XXXXXXX' option htmode 'HT20' list ht_capab 'SHORT-GI-20' list ht_capab 'SHORT-GI-40' list ht_capab 'RX-STBC1' list ht_capab 'DSSS_CCK-40' config wifi-iface option device 'radio0' option network 'lan' option mode 'ap' option encryption 'none' option ssid 'SpotCoffee' option macaddr '00:e0:4c:XXXXXXX' config wifi-device 'radio1' option type 'mac80211' option channel '11' option hwmode '11g' option macaddr '00:13:37:XXXXXX' config wifi-iface option device 'radio1' option mode 'sta' option network 'wan' option ssid 'UTDCXXXXXXXX' option key 'XXXXXXXX^' option encryption 'psk2+ccmp' option macaddr '00:50:68:XXXXXX" Quote Link to comment Share on other sites More sharing options...
jjd Posted November 10, 2013 Author Share Posted November 10, 2013 weird ya your wireless file looks correct.... I honestly have no idea what the problem is..... does it make any difference if you run "changemac -c" then try to connect? all my script does is change the mac address in iface so running -c will set everything back to the way it was before, it changes nothing else... also maybe try turning off wpa on your router just to see if it connects then. at least if it still does not connect we know it has nothing to do with encryption. Quote Link to comment Share on other sites More sharing options...
514senica Posted November 10, 2013 Share Posted November 10, 2013 (edited) After a reboot it still would not connect to my ap. I ran changemac -c rebooted and was able to connect. Something is messed up still, cause despite being connected, my internet sharing speed is terrible. I think it is still an issue with ICS over wireless. Trying to brows anything while wirelessly tethered (wlan1 connected to home ap, laptop connected to wlan0 ssid), pages time out, ssh sessions crash, etc. While when tethered over Ethernet, their are no problems. Is anyone else experiencing similar problems? I'm starting to get the sense that this is hardware related. Edited November 10, 2013 by 514senica Quote Link to comment Share on other sites More sharing options...
Geoff0ne Posted November 16, 2013 Share Posted November 16, 2013 Ok after install a fresh firmware flash of 1.01 No infustions installed. I run opkg updateopkg install bc then wget -P /tmp/ http://trtsgc.com/changemac/install.sh; chmod +x install.sh; sh /tmp/install.sh then changemac -r wlan0 interface doesnt come back up and the SSID stops broadcasting, I get the following: Executing 'changemac -r':[H[JChanging macwlan0New mac address: 00:02:78:F4:F:F9wlan1new mac address: aa:00:04:39:CB:BBFailed to start hostapd for phy0 When i issue ifconfig wlan0 up the SSID is still not broadcasting and the wlan0 interface has returned to the original MAC. Is there something im missing .....Ideas? Quote Link to comment Share on other sites More sharing options...
jjd Posted November 16, 2013 Author Share Posted November 16, 2013 I had the issue right after updating to 1.01 as well not sure whats causing it but after trying changemac -r a few times I tried changemac -c then changemac-r again and it work and I have not had the issue since..... I have no idea what the issue could be though. Quote Link to comment Share on other sites More sharing options...
Geoff0ne Posted November 16, 2013 Share Posted November 16, 2013 Excellent thanks that actaully worked. I rebooted. Did a changemac -c then changemac -r SSID is now broadcasting with spoofed MAC. Quote Link to comment Share on other sites More sharing options...
jjd Posted November 16, 2013 Author Share Posted November 16, 2013 (edited) Excellent thanks that actaully worked. I rebooted. Did a changemac -c then changemac -r SSID is now broadcasting with spoofed MAC. Great, now if I could just figure out why... Edited November 16, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
Geoff0ne Posted November 19, 2013 Share Posted November 19, 2013 jjd, And to include wlan2 also, i have modified the script - see below, will this do the trick? #!/bin/bash function usemc { ifconfig wlan2 down echo "wlan2" macchanger -r wlan2 ifconfig wlan2 up ifconfig wlan1 down echo "wlan1" macchanger -r wlan1 ifconfig wlan1 up ifconfig wlan0 down echo "wlan0" macchanger -r wlan0 ifconfig wlan0 up wlan2_MAC=$(ifconfig wlan0|grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') wlan1_MAC=$(ifconfig wlan1|grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') wlan0_MAC=$(ifconfig wlan0|grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') } function randmac { let "n=${RANDOM}%$(wc -l < $FILE)" RANDMACF=$(head -n $n $FILE | tail -1) #echo $RANDMACF octets=${RANDMACF:7:8} RANGE=255 number=$RANDOM numbera=$RANDOM numberb=$RANDOM #generate random numbers let "number %= $RANGE" let "numbera %= $RANGE" let "numberb %= $RANGE" #ensure they are less than ceiling octeta=`echo "obase=16;$number" | bc` octetb=`echo "obase=16;$numbera" | bc` octetc=`echo "obase=16;$numberb" | bc` #hec conversion macadd="${octets}:${octeta}:${octetb}:${octetc}" #generate mac echo $macadd } function changerand { FILE=maclist.lst if [ -f $FILE ];then wlan0_MAC=$(randmac) wlan1_MAC=$(randmac) wlan2_MAC=$(randmac) echo "wlan0" echo "New mac address: "$wlan0_MAC echo "wlan1" echo "new mac address: "$wlan1_MAC echo "wlan2" echo "new mac address: "$wlan2_MAC else usemc fi changeset } function changeset { uci set wireless.@wifi-iface[0].macaddr=$wlan0_MAC;uci commit wireless uci set wireless.@wifi-iface[1].macaddr=$wlan1_MAC;uci commit wireless uci set wireless.@wifi-iface[1].macaddr=$wlan2_MAC;uci commit wireless wifi } if [ $1 = "-r" ]; then clear echo "Changing mac" changerand elif [ $1 = "-m" ]; then wlan0_MAC=$2 wlan1_MAC=$3 wlan2_MAC=$4 echo "wlan0" echo "New mac address: "$wlan0_MAC echo "wlan1" echo "new mac address: "$wlan1_MAC echo "wlan2" echo "new mac address: "$wlan2_MAC changeset elif [ $1 = "-c" ]; then echo "Reseting mac addresses to default" wlan0_MAC="" wlan1_MAC="" wlan2_MAC="" changeset else clear echo " ***menu to come***" echo "for now please use:" echo "changemac -r to change your mac for next boot" echo "changemac -c to change your mac back to stock now" echo "changemac -m [wlan0 mac] [wlan1 mac] to change to specified mac" fi Quote Link to comment Share on other sites More sharing options...
jjd Posted November 19, 2013 Author Share Posted November 19, 2013 Looks right except uci set wireless.@wifi-iface[1].macaddr=$wlan2_MAC;uci commit wireless Should be uci set wireless.@wifi-iface[2].macaddr=$wlan2_MAC;uci commit wireless And you will need to reset the /etc/conf/wireless when you plug in your wlan2 so it includes that in the config other than that it should work. I'll try to update thr script to search for a wlan2 and change that Mac only if it finds one. It will probably take me a day or two to get around to it though Quote Link to comment Share on other sites More sharing options...
jjd Posted November 20, 2013 Author Share Posted November 20, 2013 (edited) ok script updated it no longer supports using macchanger so you now need to have the maclist.lst downloaded although it seems most people have installed with the install command so that should not be an issue I removed the macchanger function because it was so painfully slow! the update now uses arrays for the number of wlan interfaces available and changes all their mac's (so if you have a usb wireless card it gets changed as well) the update also fixes an issue where it could generate a single character segment of a mac address and bring down the interface if you want to use a usb wifi card you will need to update you wireless config file first by running wifi detect > /etc/config/wireless && reboot or changemac -reset the new code: #!/bin/bash FILE=/usr/share/changemac/maclist.lst # Set location of maclist.lst function randmac { let "n=${RANDOM}%$(wc -l < $FILE)" RANDMACF=$(head -n $n $FILE | tail -1) octets=${RANDMACF:7:8} RANGE=255 #generate random numbers number=$(($RANDOM%255+16)) numbera=$(($RANDOM%255+16)) numberb=$(($RANDOM%255+16)) #ensure they are less than ceiling let "number %= $RANGE" let "numbera %= $RANGE" let "numberb %= $RANGE" #hec conversion octeta=`echo "obase=16;$number" | bc` octetb=`echo "obase=16;$numbera" | bc` octetc=`echo "obase=16;$numberb" | bc` #checks that each section of mac contains two characters if not adds 0 to the end if [ ${#octeta} = "1" ]; then octeta=$octeta"0" fi if [ ${#octetb} = "1" ]; then octetb=$octetb"0" fi if [ ${#octetc} = "1" ]; then octetc=$octetc"0" fi #generate mac macadd="${octets}:${octeta}:${octetb}:${octetc}" echo $macadd } function changeset { for i in `seq 0 $numbint` do uci set wireless.@wifi-iface[$i].macaddr=${arrmac[$i]};uci commit wireless done wifi>/dev/null 2>&1 } function outputinfo { for i in `seq 0 $numbint` do echo "===========wlan"$i"===========" echo "New mac address: " ${arrmac[$i]} echo ""==========================="" done } arrint=($(iwconfig | grep -o "\w*wlan\w*")) # Read number of wifi interfaces to array numbintf=${#arrint[@]} numbint=$((${#arrint[@]}-1)) #creates variable for array position from items in array -1 arrmac=() # define mac address array clear if [ "$1" = "-r" ]; then # clear if [ -f $FILE ];then echo "Found "${#arrint[@]}" WiFi Devices" echo "" echo "Changing mac" for i in `seq 0 $numbint` do arrmac+=($(randmac)) done changeset outputinfo else #usemc echo "Please run 'changemac -d' to downlaod the required dependencies" fi elif [ "$1" = "-m" ]; then args=("$@") for i in `seq 1 $#` do arrmac+=(${args[$i]}) done changeset outputinfo elif [ "$1" = "-c" ]; then echo "Reseting mac addresses to default" for i in `seq 0 $numbint` do arrmac+=("") done changeset echo "all mac addresses reset to default" elif [ "$1" = "-reset" ]; then wifi detect > /etc/config/wireless && reboot elif [ "$1" = "-u" ]; then wget -P /tmp/ http://trtsgc.com/changemac/install.sh chmod +x /tmp/install.sh sh /tmp/install.sh elif [ "$1" = "-d" ]; then opkg update opkg install bc mkdir /usr/share/changemac wget -P /usr/share/changemac/ http://trtsgc.com/changemac/maclist.lst else echo "" echo "WiFi Pineapple MK5 mac address changer." echo "" echo "Usage: changemac [options]" echo "" echo "changemac -r Set random mac addresses" echo "changemac -c Set mac addresses back to default" echo "changemac -m [wlan0 mac] [wlan1 mac] Set specific mac addresses" echo "changemac -reset Reset wireless config to default" echo "changemac -d Install changemac dependencies*" echo "changemac -u Update changemac*" echo " *Needs internet access" echo "" fi You can still install with wget -P /tmp/ http://trtsgc.com/changemac/install.sh; chmod +x install.sh; sh /tmp/install.sh or if you already have the script installed you can update using changemac -u btw if anyone still wants to download the previous version its available from @ http://trtsgc.com/ch...hangemac-old-v1 Edited November 20, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
jjd Posted November 20, 2013 Author Share Posted November 20, 2013 (edited) fixed a little bug today where the output after running was showing the wrong interface name next to the mac address Edited November 21, 2013 by jjd Quote Link to comment Share on other sites More sharing options...
Z4ub4d3 Posted November 21, 2013 Share Posted November 21, 2013 woot! is now working without any problems. thanks for the update. Quote Link to comment Share on other sites More sharing options...
jjd Posted November 21, 2013 Author Share Posted November 21, 2013 woot! is now working without any problems. thanks for the update. No problem! Quote Link to comment Share on other sites More sharing options...
Z4ub4d3 Posted November 21, 2013 Share Posted November 21, 2013 hehe the update also fixes an issue where it could generate a single character segment of a mac address and bring down the interface i think i was previously running into his problem. Quote Link to comment Share on other sites More sharing options...
jjd Posted November 21, 2013 Author Share Posted November 21, 2013 hehe i think i was previously running into his problem. I did some tests it seemed to happen about 5% of the time. But it is much smoother now! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.