ViRb3 / nMAC

📱 An Android device MAC changer
Other
56 stars 13 forks source link

Wileyfox Spark #4

Closed JonnyTech closed 6 years ago

JonnyTech commented 7 years ago

There are 3 things I need in order to add support for a new device. If you provide them to me, nMAC should soon work on your device.

Your device's name and model.

Please add support for Wileyfox Spark (codename Porridge) running Cyanogenmod 13

The location of your MAC file. This is the trickiest part as it can completely vary by device. The file is usually stored under persistent, system partitions, where it will stay unaltered across re-installs and resets.

I cannot find the MAC file, here is a file listing:

root@porridge:/ # cd /
root@porridge:/ # ls -la
total 3328
drwxr-xr-x  20 root   root         0 2016-11-21 23:07 .
drwxr-xr-x  20 root   root         0 2016-11-21 23:07 ..
dr-xr-xr-x  83 root   root         0 2016-11-21 23:07 acct
drwxrwx---   5 system cache     4096 2016-11-21 01:36 cache
lrwxrwxrwx   1 root   root        13 1970-01-01 01:00 charger -> /sbin/healthd
dr-x------   2 root   root         0 2016-11-21 23:07 config
lrwxrwxrwx   1 root   root        17 2016-11-21 23:07 d -> /sys/kernel/debug
drwxrwx--x  34 system system    4096 2016-11-22 14:43 data
-rw-r--r--   1 root   root       596 1970-01-01 01:00 default.prop
drwxr-xr-x  15 root   root      3400 2016-11-21 23:07 dev
lrwxrwxrwx   1 root   root        11 2016-11-21 23:07 etc -> /system/etc
-rw-r--r--   1 root   root      1933 1970-01-01 01:00 factory_init.project.rc
-rw-r--r--   1 root   root     17411 1970-01-01 01:00 factory_init.rc
-rw-r--r--   1 root   root      2329 1970-01-01 01:00 factory_init.usb.rc
-rw-r--r--   1 root   root     25813 1970-01-01 01:00 file_contexts
-rw-r-----   1 root   root      3120 1970-01-01 01:00 fstab.mt6735
-rw-r-----   1 root   root       113 1970-01-01 01:00 fstab.porridge
-rwxr-x---   1 root   root   1199848 1970-01-01 01:00 init
-rwxr-x---   1 root   root     10139 1970-01-01 01:00 init.cm.rc
-rwxr-x---   1 root   root       983 1970-01-01 01:00 init.environ.rc
-rwxr-x---   1 root   root      3001 1970-01-01 01:00 init.mt6735.modem.rc
-rwxr-x---   1 root   root     20408 1970-01-01 01:00 init.mt6735.rc
-rwxr-x---   1 root   root     28011 1970-01-01 01:00 init.mt6735.usb.rc
-rwxr-x---   1 root   root     27498 1970-01-01 01:00 init.rc
-rwxr-x---   1 root   root       319 1970-01-01 01:00 init.superuser.rc
-rwxr-x---   1 root   root       588 1970-01-01 01:00 init.target.rc
-rwxr-x---   1 root   root      2091 1970-01-01 01:00 init.trace.rc
-rwxr-x---   1 root   root      9283 1970-01-01 01:00 init.usb.configfs.rc
-rwxr-x---   1 root   root      5339 1970-01-01 01:00 init.usb.rc
-rwxr-x---   1 root   root       342 1970-01-01 01:00 init.zygote32.rc
-rwxr-x---   1 root   root       614 1970-01-01 01:00 init.zygote64_32.rc
-rw-r--r--   1 root   root      1012 1970-01-01 01:00 meta_init.modem.rc
-rw-r--r--   1 root   root      1630 1970-01-01 01:00 meta_init.project.rc
-rw-r--r--   1 root   root     15474 1970-01-01 01:00 meta_init.rc
drwxr-xr-x   9 root   system     180 2016-11-21 23:07 mnt
drwxrwxrwx   7 root   system    4096 2010-01-01 00:00 nvdata
drwxr-xr-x   2 root   root         0 1970-01-01 01:00 oem
drwxrwx--x   2 system system       0 2016-11-21 23:07 persist
dr-xr-xr-x 334 root   root         0 1970-01-01 01:00 proc
-rw-r--r--   1 root   root      4920 1970-01-01 01:00 property_contexts
drwxrwx---   4 system system    4096 2010-01-01 00:00 protect_f
drwxrwx---   5 system system    4096 2010-01-01 00:00 protect_s
drwxr-xr-x   3 root   root         0 1970-01-01 01:00 res
drwx------   2 root   root         0 2016-11-18 08:42 root
drwxr-x---   2 root   root         0 1970-01-01 01:00 sbin
lrwxrwxrwx   1 root   root        21 2016-11-21 23:07 sdcard -> /storage/self/primary
-rw-r--r--   1 root   root      1070 1970-01-01 01:00 seapp_contexts
-rw-r--r--   1 root   root        67 1970-01-01 01:00 selinux_version
-rw-r--r--   1 root   root    178642 1970-01-01 01:00 sepolicy
-rw-r--r--   1 root   root     11220 1970-01-01 01:00 service_contexts
drwxr-xr-x   5 root   root       120 2016-11-21 23:07 storage
dr-xr-xr-x  17 root   root         0 2016-11-21 23:07 sys
drwxr-xr-x  20 system system    4096 2016-11-21 23:07 system
-rw-r--r--   1 root   root      4489 1970-01-01 01:00 ueventd.mt6735.rc
-rw-r--r--   1 root   root      4592 1970-01-01 01:00 ueventd.rc
lrwxrwxrwx   1 root   root        14 2016-11-21 23:07 vendor -> /system/vendor
root@porridge:/ # ls -la /persist/                                             
total 0
drwxrwx--x  2 system system 0 2016-11-21 23:07 .
drwxr-xr-x 20 root   root   0 2016-11-21 23:07 ..
root@porridge:/ # mount
rootfs on / type rootfs (ro,seclabel)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,seclabel,relatime,mode=755)
none on /acct type cgroup (rw,relatime,cpuacct)
none on /sys/fs/cgroup type tmpfs (rw,seclabel,relatime,mode=750,gid=1000)
tmpfs on /mnt type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
pstore on /sys/fs/pstore type pstore (rw,seclabel,relatime)
none on /sys/fs/cgroup/bfqio type cgroup (rw,relatime,bfqio)
/dev/block/mmcblk0p20 on /system type ext4 (ro,seclabel,relatime,data=ordered)
/dev/block/mmcblk0p21 on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)
/dev/block/mmcblk0p3 on /protect_f type ext4 (rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered)
/dev/block/mmcblk0p4 on /protect_s type ext4 (rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered)
/dev/block/mmcblk0p18 on /nvdata type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
tmpfs on /storage type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
/dev/block/dm-0 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)
/dev/fuse on /mnt/runtime/default/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /storage/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /mnt/runtime/read/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /mnt/runtime/write/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/block/vold/public:179_128 on /mnt/media_rw/41DE-63B3 type fuseblk (rw,dirsync,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/fuse on /mnt/runtime/default/41DE-63B3 type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /storage/41DE-63B3 type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /mnt/runtime/read/41DE-63B3 type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)
/dev/fuse on /mnt/runtime/write/41DE-63B3 type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)

Using 'find / -type f -iname mac' only shows stuff in /proc/

The content of your MAC file. I have to know the exact content of this file to know how to change your MAC and also to ensure things are safe. White spaces and new lines included! It is easiest if you just send me your MAC file, but make sure to mask/replace your MAC address first!

I would if I could find it - any ideas?

JonnyTech commented 7 years ago

I found the mac address in a file if that helps (contents obscured for security):

root@porridge:/ # cd /sys/devices/soc/180f0000.wifi/net/wlan0
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # ls -la
total 0
drwxr-xr-x  6 root root    0 2016-11-22 18:55 .
drwxr-xr-x  4 root root    0 2016-11-22 18:55 ..
-r--r--r--  1 root root 4096 2016-11-22 19:07 addr_assign_type
-r--r--r--  1 root root 4096 2016-11-22 19:07 addr_len
-r--r--r--  1 root root 4096 2016-11-22 18:55 address
-r--r--r--  1 root root 4096 2016-11-22 19:07 broadcast
-rw-r--r--  1 root root 4096 2016-11-22 19:07 carrier
-r--r--r--  1 root root 4096 2016-11-22 19:07 carrier_changes
-r--r--r--  1 root root 4096 2016-11-22 19:07 dev_id
-r--r--r--  1 root root 4096 2016-11-22 19:07 dev_port
lrwxrwxrwx  1 root root    0 2016-11-22 19:07 device -> ../../../180f0000.wifi
-r--r--r--  1 root root 4096 2016-11-22 19:07 dormant
-r--r--r--  1 root root 4096 2016-11-22 19:07 duplex
-rw-r--r--  1 root root 4096 2016-11-22 18:55 flags
-rw-r--r--  1 root root 4096 2016-11-22 19:07 ifalias
-r--r--r--  1 root root 4096 2016-11-22 18:55 ifindex
-r--r--r--  1 root root 4096 2016-11-22 19:07 iflink
-r--r--r--  1 root root 4096 2016-11-22 19:07 link_mode
-rw-r--r--  1 root root 4096 2016-11-22 19:07 mtu
-r--r--r--  1 root root 4096 2016-11-22 19:07 name_assign_type
-rw-r--r--  1 root root 4096 2016-11-22 19:07 netdev_group
-r--r--r--  1 root root 4096 2016-11-22 19:07 operstate
lrwxrwxrwx  1 root root    0 2016-11-22 19:07 phy80211 -> ../../../../virtual/ieee80211/phy0
-r--r--r--  1 root root 4096 2016-11-22 19:07 phys_port_id
drwxr-xr-x  2 root root    0 2016-11-22 19:07 power
drwxr-xr-x 10 root root    0 2016-11-22 18:55 queues
-r--r--r--  1 root root 4096 2016-11-22 19:07 speed
drwxr-xr-x  2 root root    0 2016-11-22 19:07 statistics
lrwxrwxrwx  1 root root    0 2016-11-22 19:07 subsystem -> ../../../../../class/net
-rw-r--r--  1 root root 4096 2016-11-22 19:07 tx_queue_len
-r--r--r--  1 root root 4096 2016-11-22 19:07 type
-rw-r--r--  1 root root 4096 2016-11-22 19:07 uevent
drwxr-xr-x  2 root root    0 2016-11-22 19:07 wireless
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # cat address           
00:11:22:33:44:55
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # 

So I tried to change the contents but it did not seem to work:

root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # chmod 644 address     
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # ifconfig wlan0      
wlan0     Link encap:Ethernet  HWaddr 00:11:22:33:44:55
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # ifconfig wlan0 down
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # echo "00:11:22:33:44:FF" > address
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # ifconfig wlan0 up
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 # ifconfig wlan0      
wlan0     Link encap:Ethernet  HWaddr 00:11:22:33:44:55
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
root@porridge:/sys/devices/soc/180f0000.wifi/net/wlan0 #
ViRb3 commented 7 years ago

Great job so far! However, I am pretty sure that the MAC file won't be located in /sys. Look for it in /persist, /vendor, /system /dev (?), /oem (?), etc. If you find the right file, changing its content should have a result. Also try using airplane mode instead of "ifconfig wlan0 up/down".

JonnyTech commented 7 years ago

Would it be named as anything else, as I said:

Using 'find / -type f -iname mac' only shows stuff in /proc/

File listings show no "mac" files:

root@porridge:/ # ls -laR /persist/                                                                                                        
/persist/:
total 0
drwxrwx--x  2 system system 0 2016-11-23 12:48 .
drwxr-xr-x 20 root   root   0 2016-11-23 12:48 ..

root@porridge:/ # ls -laR /vendor/                                                                                                         
/vendor/:
total 32
drwxr-xr-x  4 root shell 4096 2009-01-01 08:00 .
drwxr-xr-x 18 root root  4096 1970-01-01 01:00 ..
drwxr-xr-x  4 root shell 4096 2009-01-01 08:00 lib
drwxr-xr-x  3 root shell 4096 2009-01-01 08:00 lib64

/vendor/lib:
total 33176
drwxr-xr-x 4 root shell     4096 2009-01-01 08:00 .
drwxr-xr-x 4 root shell     4096 2009-01-01 08:00 ..
drwxr-xr-x 2 root shell     4096 2009-01-01 08:00 drm
-rw-r--r-- 1 root root   2467280 2009-01-01 08:00 libWVStreamControlAPI_L3.so
-rw-r--r-- 1 root root  11304948 2009-01-01 08:00 libavcodec.so
-rw-r--r-- 1 root root   1833840 2009-01-01 08:00 libavformat.so
-rw-r--r-- 1 root root    419472 2009-01-01 08:00 libavutil.so
-rw-r--r-- 1 root root     55120 2009-01-01 08:00 libffmpeg_extractor.so
-rw-r--r-- 1 root root     54912 2009-01-01 08:00 libffmpeg_omx.so
-rw-r--r-- 1 root root     34384 2009-01-01 08:00 libffmpeg_utils.so
-rw-r--r-- 1 root root    116300 2009-01-01 08:00 libswresample.so
-rw-r--r-- 1 root root    517704 2009-01-01 08:00 libswscale.so
-rw-r--r-- 1 root root     87524 2009-01-01 08:00 libwvdrm_L3.so
-rw-r--r-- 1 root root     54896 2009-01-01 08:00 libwvm.so
drwxr-xr-x 2 root shell     4096 2009-01-01 08:00 mediadrm

/vendor/lib/drm:
total 136
drwxr-xr-x 2 root shell  4096 2009-01-01 08:00 .
drwxr-xr-x 4 root shell  4096 2009-01-01 08:00 ..
-rw-r--r-- 1 root root  59008 2009-01-01 08:00 libdrmwvmplugin.so

/vendor/lib/mediadrm:
total 2952
drwxr-xr-x 2 root shell    4096 2009-01-01 08:00 .
drwxr-xr-x 4 root shell    4096 2009-01-01 08:00 ..
-rw-r--r-- 1 root root    38584 2009-01-01 08:00 libdrmclearkeyplugin.so
-rw-r--r-- 1 root root  1460180 2009-01-01 08:00 libwvdrmengine.so

/vendor/lib64:
total 29480
drwxr-xr-x 3 root shell     4096 2009-01-01 08:00 .
drwxr-xr-x 4 root shell     4096 2009-01-01 08:00 ..
-rw-r--r-- 1 root root  11846016 2009-01-01 08:00 libavcodec.so
-rw-r--r-- 1 root root   2022744 2009-01-01 08:00 libavformat.so
-rw-r--r-- 1 root root    415576 2009-01-01 08:00 libavutil.so
-rw-r--r-- 1 root root     67776 2009-01-01 08:00 libffmpeg_extractor.so
-rw-r--r-- 1 root root     67392 2009-01-01 08:00 libffmpeg_omx.so
-rw-r--r-- 1 root root     42816 2009-01-01 08:00 libffmpeg_utils.so
-rw-r--r-- 1 root root     91968 2009-01-01 08:00 libswresample.so
-rw-r--r-- 1 root root    509752 2009-01-01 08:00 libswscale.so
drwxr-xr-x 2 root shell     4096 2009-01-01 08:00 mediadrm

/vendor/lib64/mediadrm:
total 120
drwxr-xr-x 2 root shell  4096 2009-01-01 08:00 .
drwxr-xr-x 3 root shell  4096 2009-01-01 08:00 ..
-rw-r--r-- 1 root root  51088 2009-01-01 08:00 libdrmclearkeyplugin.so

root@porridge:/ # ls -laR /oem/                                                                                                            
/oem/:
total 0
drwxr-xr-x  2 root root 0 1970-01-01 01:00 .
drwxr-xr-x 20 root root 0 2016-11-23 12:48 ..

root@porridge:/ # ls -laR /system/dev/                                                                                                     
ls: /system/dev/: No such file or directory

Do you have it working on any other phones running CM13?

ViRb3 commented 7 years ago

(Check EDIT2 before trying the other things I suggested)

Keep in mind that there are a number of ways to store a MAC address, including:

Also the file's name doesn't necessarily contain the word "mac", for an example the OnePlus One stores it under "/persist/WCNSS_qcom_cfg.ini". You can try searching for "wifi", though.

Regarding CM13, I have neither tested it nor received any feedback that it works. In fact, a few other people had trouble finding their MAC on CM13 as well, even on different devices. It could very well be a different implementation that the CM team are using. Sadly I won't be able to find time to flash CM13 any time soon. Have you tried doing a linux-style MAC change: "ifconfig wlan0 hw ether {mac}"?

Last thing I can think of: Perform a "clean" change in the file you have found.

  1. Turn on airplane mode.
  2. Change one of the last digits (to avoid OUI issues).
  3. Enable airplane mode and/or restart phone.

What happens in that scenario?

EDIT: I just checked that your device uses a MediaTek chip. I will investigate a little since I haven't worked with this chip yet. EDIT2: Do you have any part of this directory: "/data/nvram/APCFG/APRDEB/"?

JonnyTech commented 7 years ago

I will try - what is the best way to find out if the address has actually changed?

JonnyTech commented 7 years ago

Have you tried doing a linux-style MAC change: "ifconfig wlan0 hw ether {mac}"?


root@porridge:/ # ifconfig wlan0                                                                                                         
wlan0     Link encap:Ethernet  HWaddr 00:xx:xx:xx:xx:xx
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:0 TX bytes:0 

root@porridge:/ # ifconfig wlan0 hw ether 00:11:22:33:44:55                                                                                
ifconfig: ioctl 8924: Operation not supported on transport endpoint
ViRb3 commented 7 years ago

Did you see if the directory in EDIT2 exists on your device?

JonnyTech commented 6 years ago

Sorry for the very long delay in replying

/data/nvram is a symbolic link to /nvdata

Looking there I found /nvdata/APCFG/APRDEB/WIFI

Examining the contents of that file with a hex editor revealed my Wi-Fi mac address at bytes 5 to 10 (6 bytes total)

I hope that helps, what shall I try next?

ViRb3 commented 6 years ago

No worries, apologies on my end as well. Can you please upload the file here or send it to me via Gitter: https://gitter.im/nMACAndroid/?

JonnyTech commented 6 years ago

File attached: WIFI.txt - removed

I masked my mac address like so

printf '\x88\x88\x88\x88\x88\x88' | busybox dd of=WIFI bs=1 seek=$((0x04)) count=6 conv=notrunc

Note that I had to add .txt to the filename to allow Gihub to accept it.

ViRb3 commented 6 years ago

Thank you! One last thing before I add support for it, can you please confirm that changing the MAC in the file actually changes your MAC?

JonnyTech commented 6 years ago

It does indeed:

# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 88:88:88:88:88:88
          inet addr:192.168.0.19  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::8a88:88ff:fe88:8888/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:256 errors:0 dropped:0 overruns:0 frame:0
          TX packets:278 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:111320 TX bytes:47194

Good luck!

ViRb3 commented 6 years ago

I hope I didn't mess anything up this late in the evening. You will have to uninstall the old version first, since I lost my original sign keys & also this is a test build. Please report back when you test it! virb3e.nMAC.Test.apk.zip

JonnyTech commented 6 years ago

Looks like something is amiss, are any logs generated in order to assist?

screenshot_20171026-072241

ViRb3 commented 6 years ago

I knew I had forgotten something, sorry about that. Try this one: virb3e.nMAC.Test2.apk.zip

JonnyTech commented 6 years ago

This one runs, then asks to backup current binary, then crashes.

Opening up again it starts up and crashes at getting current MAC address.

Even if I force stop and clear app data, it still crashes at getting current MAC address.

Can I try anything else?

ViRb3 commented 6 years ago

I just re-checked the code and simulated it using the file you sent me -- everything worked fine. I pushed the newest changes, so could you please take a look if you see something wrong? https://github.com/ViRb3/nMAC/blob/master/nMAC/Devices/WileyfoxSpark.cs

If you have Xamarin set up or if you feel like installing it, feel free to build and debug the app -- this will most definitely show you the issue.

I'll be away for the next few days, but we'll continue this after I am back 😄

JonnyTech commented 6 years ago

Thanks, I shall try to make sense of it at the weekend. Having never built an Android app, can you provide a quick how-to? I am a Linux user and can hack away at most things given some guidance.

ViRb3 commented 6 years ago

After a quick research it seems like Xamarin isn't officially supported on Linux (yet). Here's a guide to build Xamarin apps under Linux, but I see no way to debug them. If you don't find a solution you might have to run Windows under a VM. You can then just install Visual Studio Community, check Xamarin to be included during installation, and finally open this project's .sln file. Good luck!

JonnyTech commented 6 years ago

Thanks - I do not have Widows so persevered with Linux - what a tedious process that was!

OK, the problem lies with SetMACViews() in MainActivity.cs. If I comment out the line MACArray[u++] = @byte; then the error disappears. I shall investigate further when I have more time.

PS, I noticed that sometimes the MAC address does not change, does the value have to be a particular format?

JonnyTech commented 6 years ago

Well, I could not sleep until I worked it out:

The MAC address was received in the format XX-XX-XX-XX-XX-XX (yes, dashes in the string).

The fix in my case was to add i++ at the end of the else block of the 2nd digit concatenation:

See my PR for details. You will probably find a more elegant solution, but I hope this helps.

JonnyTech commented 6 years ago

I noticed that the RANDOMIZE function is also broken because of the non-hex characters. I am updating my PR to use IsHexDigit. This seems to work in all cases.

ViRb3 commented 6 years ago

Hey again, thanks so much for testing! The problem was the device model should have returned a MAC without dashes, but I forgot to trim them, so bad things happened. This has been fixed now. Can I ask you about the purpose of changing the hostname? It's been implemented in the test version as well, but I want to know for sure before releasing it.

All being said, here's a test that should hopefully work: virb3e.nMAC.Test3.zip

JonnyTech commented 6 years ago

Welcome back, hope you had a good time. The latest build works perfectly - many thanks. I enjoyed testing and learning. The host name change was because a network that I tested blocked me after some time and only changing both MAC and name allowed me to reconnect. Plus I liked the challenge of doing it! Maybe have it as an option as it does not survive a reboot.

ViRb3 commented 6 years ago

Thanks for the explanation! I have implemented hostname changing in the MAC changing sequence. An official release will be out in a few minutes.

One last time, thanks for all the help. I can now smilingly close this issue :)

JonnyTech commented 6 years ago

The new release also works flawlessly - many thanks to you for your patience and efforts. Hopefully this change adds compatibility for other devices too. Big smiley too :D

almazov159 commented 3 years ago

Hi! Can you help me? My device Alcatel 1T 7" wi-fi (android 8.1.0). I found the file WIFI in the following path: /vendor/nvdata/APCFG/APRDEB Examining the contents of that file with a hex editor revealed my Wi-Fi mac address at bytes 5 to 10 (6 bytes total). Can you make changes to your program to make it work on my device?