Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use output for Android 11 ? #9

Open
rregn opened this issue Aug 14, 2024 · 28 comments
Open

cannot use output for Android 11 ? #9

rregn opened this issue Aug 14, 2024 · 28 comments

Comments

@rregn
Copy link

rregn commented Aug 14, 2024

This works fine from Android 6 to an Samsung A7 with Android 10

But now i have another movement from Android 6 (Sony Z3) to Android 11 (Realme X2).
The script produces around 800 KB .
Then i copy the output to /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml with wifi off and reboot

But when i now enable Wifi, i can see in the total commander, how the file shrinks down to about 50kB. Nearly all entries are lost. S

Couldn't it be because the Android 11 doesn't fit the format?

In the native wificonfigstore the 3rd line says version value=3
while the version generated by this script is version=1

@mnalis
Copy link
Owner

mnalis commented Aug 16, 2024

Its hard to tell @rregn, but I'd guess from what you wrote that some of the wireless networks got transferred successfully. My (blind) guess would be that phone accepted networks from start of the file up to some point where it stumbled upon something it couldn't understand, and then import aborted and all wifi networks after that line did not get processed.

Then it saved new (version3) file over (with just the information that it managed to import so far, thus losing most of the networks).

You could verify that theory by comparing wifi networks that did manage to get imported with original file. If the theory is correct, you should be able to find network which cased import to abort (i.e. the first network that didn't get imported). My guess is that something will be special about that network - some custom parameters, different authentication types, strange (non-ASCII) name etc. When you have found it, then you could:

  • remove just that network from the input file, run conversion again, and see if all networks got imported
  • also anonymize information in that wifi network, and send it over here, so perhaps such problematic networks can be at least detected (or even better autocorrected) with this tool.

@rregn
Copy link
Author

rregn commented Aug 17, 2024

thank you for the fast reply and the ideas. So I had a closer look to the networks which are finally on the phone. It comes out, that it was the last 20 of the list in the wpa_supplicant. So i thought, there is a problem with the entry just before. I removed the last 22 entries in the wpa_supplicant. and tried again. Again just the last 20 (and my home network) remain
Also I could see - after switching wifi on again - with the total commander how the file in ...apexdata/com.android.wifi shrinks and from time to time there is a wpa_supplicant.conf.new - so some process does a copy for rewriting.
I did this a 3rd time, cut again 22 entries from wpa_supplicant.conf, and again: the last 20 entries survive + my network.
i really like to attach the file here (bt you need an Adroid 11 or somewhat phone to test the import

@rregn
Copy link
Author

rregn commented Aug 20, 2024

wpa_supplicant.conf_8_24_era.txt
here my wpa_supplicant.conf - note: whereever key_mgmt is "WPA-PSK .... " i cut after WPA_PSK, otherwise the script stops with error

@rregn
Copy link
Author

rregn commented Aug 20, 2024

I have come one step further - a problem was the cut of the characters behind WPA-PSK!
i removed the "$" in line 58 of the script, now i have many Networks in the new phone. But the xml file has 383 ssids

after restart the 826k wpa_supplicant file shrinks to 372k , switching wifi on - i count around 155 networks
BUT after adding one more network, the shrinking process start again (with the .new file) and 21 networks are remaining!!

@mnalis
Copy link
Owner

mnalis commented Aug 23, 2024

It comes out, that it was the last 20 of the list in the wpa_supplicant

That is strange that those are last 20 entries; it would mean my guess was probably wrong and something else is at work. Unfortunately, I don't know what 🤷. Is your wifi on or off when you try doing the import?

Could you try keeping only first 30 entries and removing all other, and trying to import that? What is on the phone then (can you list exact network names that remain on the phone)?

i really like to attach the file here (bt you need an Adroid 11 or somewhat phone to test the import

Unfortunately I don't have rooted Android 11 device, sorry.

mnalis added a commit that referenced this issue Aug 23, 2024
e.g. key_mgmt=WPA-PSK FT-PSK WPA-PSK-SHA256 as in #9
@mnalis
Copy link
Owner

mnalis commented Aug 23, 2024

here my wpa_supplicant.conf - note: whereever key_mgmt is "WPA-PSK .... " i cut after WPA_PSK, otherwise the script stops with error

I've just made some changes to avoid problems with that. Can you try that new version?

@rregn
Copy link
Author

rregn commented Aug 23, 2024

i tried, (again wifi is off, when i insert the file, and after i reboot quickly) but the result is the same. shrinking takes around 10 sec, and i could see the .new file agein. i think, the problem is in the xml file.

Now i found out that ALL "surviving entries" are open wifis - without key!

@rregn
Copy link
Author

rregn commented Aug 23, 2024

I added here
WifiConfigStore_realme_xml.txt
a entry in the final xml "made" by my realme

@mnalis
Copy link
Owner

mnalis commented Aug 23, 2024

Now i found out that ALL "surviving entries" are open wifis - without key!

Aha, that is very useful information!

Can you manually create one password-protected entry via normal Android UI, and extract from WifiConfigStore.xml (with replaced password with dummy value) how that correct & working entry looks on your Android?

Then we can compare how it looks compared to the output that script generates...

@rregn
Copy link
Author

rregn commented Aug 23, 2024

WifiConfigStore_realme_xml.txt

here

@rregn
Copy link
Author

rregn commented Sep 24, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Sep 29, 2024

yeah, sorry, I have some backlog to go through... I'll send you something to try in a few days

@mnalis
Copy link
Owner

mnalis commented Oct 8, 2024

Ok, here is test WifiConfigStore.xml for you @rregn. It should have 50 networks (named from demo1_01 to demo1_50).

WifiConfigStore_demo1_xml.txt

Does that work? Do all 50 networks survive? Or do some remain, but some get truncated?

@rregn
Copy link
Author

rregn commented Oct 8, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 8, 2024

And how about this one? It should also have 50 networks (but named from demo2_01 to demo2_50).

WifiConfigStore_demo2_xml.txt

@rregn
Copy link
Author

rregn commented Oct 9, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 9, 2024

it does grow a little bit from 130 to 135 kB (after switching wifi on) and :

Was there supposed to be some more information after that "and :" ? Because it didn't make it to GitHub 😢

I have still the old demo01_xx networks in my stored listMessage ID: @.***>

So, what is the end result? Only 50 demo1_xx networks? Or some demo2_xx also (how many and which numbers)?


But that looks very promising so far - when you answer this question, I'll have to send you few more test to try to isolate exactly what directive is problematic; but so far it looks it should be possible to devise some fix when all data is collected!

@rregn
Copy link
Author

rregn commented Oct 9, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 9, 2024

there no demo2_xx networks in the list.

Ok, great; how about this demo3_xx:

WifiConfigStore_demo3_xml.txt

@rregn
Copy link
Author

rregn commented Oct 9, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 9, 2024

Only the old demo01_xx networks are in my stored list

OK, how about demo4_xx:
WifiConfigStore_demo4_xml.txt

@rregn
Copy link
Author

rregn commented Oct 9, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 13, 2024

And demo5-xx?
WifiConfigStore_demo5_xml.txt

@rregn
Copy link
Author

rregn commented Oct 14, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Oct 14, 2024

OK, it seems culprit is BSSID field format. I've changed it now, new script is up. Can you test if it works for you @rregn ?

If it does work on Android 11 (Realme X2)., I'd appreciate if you could test if new script still works for conversion "Android 6 to an Samsung A7 with Android 10" (because if Samsung A7 only works with old script, I'll have to add some options which version to use...)

Have fun on your vacation! 😸

@mnalis
Copy link
Owner

mnalis commented Oct 14, 2024

(and if that regular script from master branch does not work, you can try one from realme_x2_test_hadcoded_fields_dontuse branch as a last resort before vacation. Other than that @rregn , I probably won't see your reply before you have to go... )
Good luck!

@rregn
Copy link
Author

rregn commented Oct 14, 2024 via email

@mnalis
Copy link
Owner

mnalis commented Nov 1, 2024

in a 2nd try, it shrinks to 53 kB and has no demo04, but around 20 from my entries, !

Anyway, if you're back from vacation and would like to try to debug this more, let me know... It is a good progress that some entries are imported now, but it seems some entry is problematic and making it fail.

But it probably would take several tries to try to pin down the culprit before the solution can be devised...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants