Giter VIP home page Giter VIP logo

Comments (27)

JonnyTech avatar JonnyTech commented on June 20, 2024 1

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.

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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 #

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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".

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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?

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

(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:

  • different separation characters (" ", ":", "-", etc.)
  • storing the whole mac address as hex instead of ascii that contains the hex digits (see Samsung layout)

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/"?

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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?

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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/?

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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?

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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!

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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

screenshot_20171026-072241

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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?

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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 😄

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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.

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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!

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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?

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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.

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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.

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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.

from nmac.

ViRb3 avatar ViRb3 commented on June 20, 2024

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 :)

from nmac.

JonnyTech avatar JonnyTech commented on June 20, 2024

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

from nmac.

almazov159 avatar almazov159 commented on June 20, 2024

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?

from nmac.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.