yashsingh1/xdaforums huggingface dataset:
[Magisk] J0gurt:
Knox patch class not found v. 6.5

Hi all,

I´m facing following error when i try to patch the knox class. for the secure folder.

ERROR: Knox patch class not found

Samsung Galaxy a5 2016 (SM-A510F) - Stock ROM Android 7.0 rooted with Magisk.

i had to download secure folder from google playstore couse its not preinstalled on this devices.

Secure folder is supported on this device, regarding to the official Samsung Website. I tried to pull the smali-module before and after the secure folder installation.

What can I do ? :)

is my Android version outdated ? any help is appreciated :)

kind regards

J0gurt
[Magisk] Gooday1313:
hi sir is it okay to use the smali module you uploaded in the threads if the phone and android version is same??
[Magisk] ErriK89:
fOmey, if you want I can test whatever you want on a xiaomi mi 8 with android Q and miui11. I use it only for mock locations so it's available for test :)

Actually the only method that works, combined with smali patcher, is the jps joystick app with indirect mocking and process time reduced below 50ms in order to avoid rubberbanding.

I can try any idea we had in the previous post.
[Magisk] ultimatepichu:
Fomey, I have a Google Pixel 3XL, stock but rooted. I can help if you need testers
[Magisk] cmstew:
It "might" work, but it's probably not the best idea. Just use the tool and make one designed specifically for your phone.
[Magisk] pogo-airsupport:
Delete the additional folders that were downloaded by SmaliPatcher.

Sometimes the extraction doesn't work quite right, and it can't find the necessary files.

Had it happen to me once yesterday with a different class.
[Magisk] J0gurt:
unfortunately this did not work :(

thanks in advance.

J0gurt
[Magisk] seburton:
Used to patch magisk reboot on my S10 ASII firmware -> Works perfect
[Magisk] memnochlv:
I'm using Android 10 on an Essential PH-1 and use 120408 play services, neither PoGo, nor hpGo worked properly. Once I downgraded to 19.5.30 (120408-275531062), all was well.

It's a boy annoying, with download manager disabled, the pllay store doesn't function, unless that's unnecessary and overboard?
[Magisk] ErriK89:
I read in fake gps app from incorporatedapps to send following commands via adb to solve this issue:

adb shell settings put global hidden_api_policy_pre_p_apps 1

adb shell settings put global hidden_api_policy_p_apps 1

adb shell settings put global hidden_api_policy 1

I found these commands also in android sdk page, but I got some error from adb when I try this. Did you tried?
[Magisk] pogo-airsupport:
I tried some commands (this was back in august).

Didn't prevent app from instantly crashing, so I dunno
[Magisk] fOmey:
If you are running android 10 and having issues spoofing, try this xposed module & report back: https://repo.xposed.info/module/com.brandonnalls.mockmocklocations

It looks like it should work just fine, it hooks most of the required functions.
[Magisk] rawika:
I tested it on Android 10 and it also gets error 11 and fused location discards the spoofer GPS. So it looks like it does the same your mock location module does.

---

It actually works when I enable indirect mocking in GPS Joystick. GPS Joystick then is able to override location from fused location. The only downside I see here that it actually uses the real GPS too, so it might consume more power. And setting up edxposed without tripping safetynet is a bit messy...

----

Another downside is that it introduces rubberbanding because fused location gets fed by the real GPS at the same time.

To sum it up: The xposed module fails like the smali patcher module until you enable "indirect mocking" (inside GPS Joystick settings). But then you will suffer rubberbanding.
[Magisk] ammmze:
So it's similar, though that module basically fakes the output of isFromMockProvider rather than the input. So it could potentially work if there is something in here that is flipping that flag to true outside of where smali patcher is patching it. Though it does also fake checks to see if a mock provider is enabled in the device. I doubt that play services is using this in some way to do the filtering because afaik there is no way to link determine if any given Location object is a mock location based on whether or not the system has a mock provider enabled. By that logic alone all locations would be considered mock locations. There has to be something either in the Location object itself that ties to a mock provider, or perhaps something in the location manager that the MockLocationProvider reports the location to.

Anyways, I'll have to see if I can get xposed on my phone to test it out.
[Magisk] fOmey:
Were you using the xposed module, along with the smali patcher module by any chance?
[Magisk] rawika:
I tested with and without smali patcher module.
[Magisk] ammmze:
I've got EdXposed installed and installed the Mock Mock Locations module...or at least it shows as being installed and enabled. HOWEVER, it doesn't appear to actually be taking effect. I've got an app that i've patched together a thing that can request location updates directly from the LocationManager for the "gps" provider and when I examine the Location objects with the smali patcher module disabled, the isFromMockProvider flag is coming through as TRUE. I also have it setup to pull from the play services fused location api and still only get real positions from there. Not sure if it matters, but I used the SandHook variant of EdXposed. I'll try the YAHFA one next to see if it is able to make it take effect.

Also the EdXposed Manager app keeps crashing on me, so i'm not really all that confident that its working properly, though the manager reports it is installed.

Edit: YAHFA variant also is still reporting isFromMockProvider as TRUE

Edit 2: Looking at the module logs in edxposed manager, I see this...

11-13 22:00:11.614 884 884 E EdXposed-Bridge: Cannot load any modules because /data/user_de/0/org.meowcat.edxposed.manager/conf/modules.list was not found
--------- beginning of crash
11-13 22:00:30.728 885 885 E EdXposed-Bridge: Cannot load any modules because /data/user_de/0/org.meowcat.edxposed.manager/conf/modules.list was not found

So yea... sounds like the module wasn't loaded
[Magisk] rawika:
On my side the module is loading fine. (Sandhook)

11-14 06:18:32.626 711 711 I EdXposed-Bridge: Loading modules from /data/app/com.brandonnalls.mockmocklocations-YKmSrQi3XmolUesZYRn6Bw==/base.apk
11-14 06:18:32.629 711 711 I EdXposed-Bridge: Loading class com.brandonnalls.mockmocklocations.OverrideSettingsSecure
11-14 06:18:39.712 712 712 I EdXposed-Bridge: Loading modules from /data/app/com.brandonnalls.mockmocklocations-YKmSrQi3XmolUesZYRn6Bw==/base.apk
11-14 06:18:39.715 712 712 I EdXposed-Bridge: Loading class com.brandonnalls.mockmocklocations.OverrideSettingsSecure

Do you use EdXposed v0.4.6.0_beta, EdXposedManager v4.5.2 and the custom magisk build which is needed? https://github.com/solohsu/magisk_files/tree/master/custom_builds

I am pretty sure you didn't install the right EdXposed manager by looking at the changelog here: https://github.com/ElderDrivers/EdXposedManager/releases

Fix "cannot load any modules because modules.list not found" when enabled Instant module list
[Magisk] ammmze:
I got it working (but yes those are the versions I'm using) ... I had to change SELinux to permissive and then it was able to access that file. So now that the module is actually enabled, I can see that isFromMockProvider is now FALSE, but still doesn't make it through the play services fused loader.

Edit: though looks like when selinux is set to permissive, then safety net fails
[Magisk] fOmey:
Dump the location extras, see if you can find one named "mockLocation".

The more I think about it, the more I like the idea of a "man in the middle" app idea someone suggested earlier.. detect all the location updates, if it detects a location update tagged as a mock location.. it could generate a new location envelope and just push it without the extra mock location identifier junk.
[Magisk] joluke:
That's a great idea actually [emoji106]
[Magisk] ammmze:
I had looked in the extras earlier. Only thing it has is "satellites" with a value of 10 I think. I had compared that to a real location. The real location has a "maxCn0" and "meanCn0". Maybe play services is dropping anything without those?
[Magisk] pogo-airsupport:
Might be worth a shot to create a quick and dirty patch to add fake "maxCn0" and "meanCn0" values to all mock locations. If it doesn't fly, then maybe the man in the middle attack would be the future-proof plan moving forward.
[Magisk] mythdroid1:
cant found the smali patcher app

already completed all the step, smali on module check , hide magisk check, but where the smali patcher apps? is it not needed?thx
[Magisk] pogo-airsupport:
If you see the module enabled under magisk manager, then you're done.

You don't need any other additional patcher apps
[Magisk] PatoSublime:
Hi.

I have a problem with smalipatcher: whenever I patch services.jar it gives me this error:

!!! ERROR: Magisk module template download failed.

I used 0.0.3.2, 0.0.3.7 and 0.0.4.0.

I manually deodexed services.jar (can't do it the other way, OTG is not supported on my device).

Can anyone patch my services.jar file for me?

I would appreciate it.

Greetings

drive#google#com/open?id=1islrolt_Gz3Y3u053XqK5KP8tWYugZg8 this is my services.jar (please change # to . )
[Magisk] pogo-airsupport:
What do you mean by "I used 0.0.3.2, 0.0.3.7 and 0.0.4.0."? You should be on Smali 6.5 aka 0.0.6.5

I believe there was changes made to the required magisk template over the past year, and the new updates of smali took care of it.

I'm unclear of the way things were coded in earlier versions of smali, but if the location of the template changed, that would explain why older version of the patcher don't work.
[Magisk] Flint2:
Hi, Im receiving error:

W: Could not find resources

==> Magisk template download complete

!!! ERROR: Magisk module template download failed.

This is with last version and also 0.8

OnePlus 5T OOS 4.7.2 ROM extracted from OnePlus5TOxygen_43_OTA_004_all_1711152324_9a7ca8ad1c7d.zip
[Magisk] zianvanka:
newbie

can you make video step by step
[Magisk] wiQbold:
thanks for the patcher. great work.

I use KLWP and there it is a 5sec delay restrictions knowing problem, if you want to open something.. I gave a working xposed module for that or the use of Nova Launcher, but now I come to my question, is this something your patcher maybe can handle?

"

What does "5 secs delay see FAQ" mean?

When you press "home" Android will introduce a 5 secs delay to any app and service trying to execute an intent unless the app sending that intent is the current launcher. This prevents Kustom Wallpaper to launch apps whithout delay since it is running as a service. To avoid this you need to either use the "back" button or use a compatible Launcher such as Nova. If your Launcher is not supported you can send...
[Magisk] qood:
What does signature spoofing mean in laymans terms? How does this affect the ability to hide spoofing?
[Magisk] stbt:
im new in xda

i cant attached link, anyone please help me to patch my deodex service.jar, my pc always failed if update .net framework so my smali patcher can't be open

please help me, (sorry for my bad English)
[Magisk] Eng.Raman:
Upload your deodexed services.jar
[Magisk] kacaksevgilim:
it does not work when I do all the stuff(miui9 global beta)

waste of time
[Magisk] tom.android:
SmaliPatcher Global Beta Miui9 v.7.12.1
[Magisk] stbt:
sorry im new in xda,i can't attached link please read private message

thanks before
[Magisk] kacaksevgilim:
I am using MIUI. I am absolutely no shadow bans or red warning modules. I still get shadow bans.

(sorry for the bad english)
[Magisk] Eng.Raman:
Your patched services.jar module zip.
[Magisk] stbt:
thank you so much bro, I try to flash with magisk :cheers
[Magisk] DeniTx:
Did spoofing signature issue get fixed or its still in process? Been waiting for this update.
[Magisk] Defforest:
Hi [MENTION=5818781]Eng.Raman[/MENTION] or Anyone can you help me make this module, because i always get error updating my net framework, already did clean install but same error, 64bit core i3 idk why.. :confused:

I have attached my services.jar file below i took from /system/framework.

My device is Xiaomi Mi 4c with Xiaomi.eu 8.2.1.0 rom based on 5.1.1 Lolipop also from their website xiaomi.eu, they say its already deodexed.

Thank you.
[Magisk] tom.android:
Here--->https://mega.nz/#!4rR0EbhK!DIeOSHZuDvRtunad18jvoFJO1RlmnbVwBB7oDmt1SJM
[Magisk] Eng.Raman:
[MENTION=7586138]tom.android[/MENTION]

Bro, Use the latest version of the SmaliPatcher v1.1 because the signature spoofing in v1.0 may causing bootloop for some users, read the change log.
[MENTION=5073927]Defforest[/MENTION], below your module zip
[Magisk] Defforest:
Thank you so much ;)

But if i'm using xposed module like Forbid Apps or Sudo Hide which prevent app A detecting from app B, example Fake My GPS hidden from primary used app, is it will crash?
[Magisk] Eng.Raman:
You don't need an xposed module to hide a fake gps status from any other app because the SmaliPatcher do that already ( it will hide mock locations status ).
[Magisk] ghostENVY:
I'll be eternally happy if someone can help me patch. I get error messages. Not sure if its because I'm on 7.1.2

I'm on Essential Phone running Ressuruction Remix 7.1.2 deodex

Error:

!!! ERROR: Mock location path not found.
[Magisk] Eng.Raman:
Your uploaded framework.zip contain only framework.jar which cannot be patched with the SmaliPatcher tool. If you have an deodexed rom, use only the deodexed services.jar with the patcher. It will generate a module zip for you then flash it via magisk manager or recovery.
[Magisk] PatoSublime:
Well as I said I can't use the lastest version as it requires the device to be connected (it doesn't support OTG). Can anyone patch it for me? I already have the JAR deodexed.
[Magisk] pogo-airsupport:
Why do you need OTG? All you have to do is plug via USB to a PC and enable developer mode.

Unless of course you are misusing the term OTG (allowing phones to host other usb devices such as mice, keyboard), which is not necessary.

If your phone doesn't allow for connecting to the PC, how did you root your phone and unlock bootloader to begin with?
[Magisk] PatoSublime:
That's what I can't do.

The nintendo switch doesn't support usb debugging

period

I would need to just patch the JAR without any device connected.
[Magisk] ammmze:
Agreed! I'd try it out if I knew how to manually do the patching. I'm still trying to figure it out :) I can pull it apart to see the smali so I can do diff's to see what we are actually patching, but I still need to look at putting it back together and ideally figure out how to use dexpatcher to make patching easier rather than manually editing the smali.
[Magisk] fOmey:
I wouldn't patch something like that.. it would make much more sense for this to be done on the spoofer side when generating the mock locations (it would be much easier coding a very simple spoofer to test this theory, rather then creating patches on a whim).

Instead I suggest we all look for evidence in the play services and narrow down exactly what is triggering the location filtering.
[Magisk] ammmze:
Sure ... I just meant in the context of experimentation to see if having those attributes makes any difference. From what I've seen with DexPatcher, it should be fairly easy to patch in something like that for experimentation sake. If it did, then we can reach out to the devs of the spoofing apps to get them to add it. FWIW, I do not see any instances of `maxCn0` or `meanCn0` in the play services apk, so honestly my confidence of that being it is rather low.
[Magisk] fOmey:
Don't be discouraged... I don't think we can rule out your theory completely yet.

It appears as tho play services is actually checking the location extras.. not specifically for the entries "maxCn0" & "meanCn0".

If it finds extras, it simply returns true.. as if acknowledging the location is valid? Otherwise it will verify the location is not from a mock provider (however if the location wasn't from a mock provider, it would returned false right?).

I came across these snippets of code:

public static boolean k(Location location) {
Bundle extras = location.getExtras();
if (extras != null && extras.getBoolean("mockLocation", false)) {
return true;
}
thv.a();
return location.isFromMockProvider();
}

public static void l(Location location) {
Bundle extras = location.getExtras();
if (extras == null) {
extras = new Bundle();
}
extras.putBoolean("mockLocation", true);
a(location, extras);
Method method = a;
if (method != null) {
try {
method.invoke(location, new Object[]{Boolean.valueOf(true)});
} catch (Exception e) {
}
}
}

I mean its worth testing at the very least... but I would still suggest going the spoofer route, rather than the patch.
[Magisk] ammmze:
That static method looks interesting...good find. Unfortunately still hasn't led to any discoveries for me yet. I can see that both versions of play services i'm comparing (19.5.30 and 19.6.29) both have that same method...

From 19.5.30

/* renamed from: l */
public static void m53146l(Location location) {
Bundle extras = location.getExtras();
if (extras == null) {
extras = new Bundle();
}
extras.putBoolean("mockLocation", true);
m53126a(location, extras);
Method method = f61858a;
if (method != null) {
try {
method.invoke(location, new Object[]{Boolean.valueOf(true)});
} catch (Exception e) {
}
}
}

From 19.6.29

/* renamed from: l */
public static void m53098l(Location location) {
Bundle extras = location.getExtras();
if (extras == null) {
extras = new Bundle();
}
extras.putBoolean("mockLocation", true);
m53078a(location, extras);
Method method = f62254a;
if (method != null) {
try {
method.invoke(location, new Object[]{Boolean.valueOf(true)});
} catch (Exception e) {
}
}
}

So then I looked for usages of that method in both and the methods that contain the code that invoke that method that marks the location as mock are also the same. So I guess I'll need to keep going up from there.
[Magisk] ErriK89:
If I well understood how "indirect mocking" works, it simple make external apps (in our case play services) to doesn't recognize that mock lockations are enable. Is it possible to patch this in order to hide to play services that mock locations are enabled and fake gps apps are using this?
[Magisk] pogo-airsupport:
Well, what indirect mocking does from my understanding is it updates GPS as network location (aka triangulating from cell towers) vs satellite.

Making external apps not recognize that mock locations are enabled is done through the Smali Patch (checkbox #1)

Right now play services isn't detecting mock locations to be on and filtering, rather it's filtering locations that pass through it and has certain attributes/properties that are different from real locations.

Hence, what Fomey is saying is we can try and dig through play services to find the exact code that is being used to filter out the mocked location based on (?missing) properties. We can then make sure we pass the correct properties via our mocked locations so it doesn't get filtered out. This will then either be addressed by the spoofing app itself (unfortunate that many are not regularly updated and developed), or the man in the middle approach where all the mocked locations get the correct attributes applied.
[Magisk] ammmze:
So IMO, it doesn't appear that the detection of whether mock locations is enabled or disabled is a factor. If they were simply looking to see if mock locations were enabled or disabled, then you would have no location coming from the fused location api. Instead we are seeing only real locations come through, which means they are some how identifying which location reports are real vs mocked despite the patch that is setting the 'isFromMockProvider' flag to false and then from there they filter out any mocked locations.
[Magisk] fOmey:
Are we 100% certain isFromMockProvider is false tho?

Because both the location provider AND the location update itself can have that flag... we need to verify both are false.

EDIT: Strange, I just finished taking a look at the AOSP mock provider source it doesn't appear to use any type of "isMock" flag.. I think certain manufactures must add it, because I do recall seeing it recently in someone's provided files.
[Magisk] pogo-airsupport:
It's odd no that Pixels would have this problem, given that they're google's own phones. Why wouldn't they code it directly into AOSP rather than add it after?

Or are we barking up the wrong tree, and it's not checking for the isMock flag?
[Magisk] ammmze:
I can't verify what play services can see. All I can verify thus far is in my app, I do this...

((LocationManager) getSystemService(Context.LOCATION_SERVICE)).requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);

and then in the `onLocationChange`, i debug it and can see my fake location coming through and `isFromMockProvider` is false as long as I have the Smali Patcher module or the Mock Mock Location Xposed module installed.

When I do this...

LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);

then all I see are real location reports. So maybe the next best thing is gonna be to see if I can unpack the play services apk, edit the manifest to make it debuggable, pack it back up, sign it and see if I can install it. Then see if I can attach a debugger and see if I can find the entry where play services picks up location updates and examine it.
[Magisk] pogo-airsupport:
From what I recall, google play services and google apps have to be signed by google's signature token, so i'm not sure you will be able to resign it and install.
[Magisk] ammmze:
Yea...I'm pretty that is correct which is why I hadn't actually tried it yet.
[Magisk] pogo-airsupport:
Try with LocationServices.getFusedLocationProviderClient and see what results you get.

LocationServices.FusedLocationApi.requestLocationUpdates was deprecated since 2017.

I wonder whether it's the deprecated code causing problems?
[Magisk] fOmey:
I don't think its checking "isMock", I might have come across that flag while browsing through one of the third party manufactures (Xiaomi or the like).. I don't think its something we need to worry about.

OK, cool.. just wanted to make sure we weren't chasing our tails.

I would expand on your test app to allow for mock locations, create a crude spoofer.. don't use fuselocation to spoof tho, use "addTestProvider".

Try to generate a "valid" location update by also spoofing the extras we discussed before.

EDIT:

Some more interesting data:

boolean r0 = [B][U]defpackage.afbv.k[/U][/B](r12)
if (r0 != 0) [B][U]goto L_0x011a[/U][/B]
goto L_0x0143

Which is referencing a newly added function (which I mentioned in my previous message)

public static boolean k(Location location) {
Bundle extras = location.getExtras();
[B][U]if (extras != null && extras.getBoolean("mockLocation", false)) {[/U][/B]
[B][U]return true;[/U][/B]
[B][U]}[/U][/B]
thv.a();
return location.isFromMockProvider();
}

[B][U]L_0x011a:[/U][/B]
java.lang.String r0 = java.lang.String.valueOf(r12)
java.lang.String r1 = java.lang.String.valueOf(r0)
int r1 = r1.length()
java.lang.StringBuilder r7 = new java.lang.StringBuilder
int r1 = r1 + 25
r7.<init>(r1)
[B][U]java.lang.String r1 = "Filtering mock location: "[/U][/B]
r7.append(r1)
r7.append(r0)
java.lang.String r0 = r7.toString()
defpackage.bhfr.a(r11, r0)

What I don't understand tho, if extras are found "k" returns "true".. if "true", it filters as a "mock location"? huh? Misread, disregard.