I wanted to know that whether an app uses a specific Android API (e.g. that API can be getApkContentSigners()). So, is it possible that we can hide the Android API call without Reflections?
Because, if it is through reflections, then even the method which we will be invoking, we have to specify it as a string literal and store it in a variable. So, if we are decompiling the apk (through jadx-gui), we can still see the Android API call. Is there any other methodology, that can be used to hide the Android API calls?
Are commercial tools like dex-guard has the capability to hide the Android API calls, so that when we try to disassemble/decompile it, and we are doing a pattern-based search to find the API call, we won't be able to see it?
Thanks a lot for helping me
Related
Since I'm not strong in C++, is it possible in a native/hybrid app to use a P/Invoke call to call native APIs from C# code?
So far what I have seen is COM interop where you have to code the bulk of what you want to do in native C++.
Any possibility here and if so how?
No. At least not that we know of. You have to create COM wrappers for native functions.
Various Marshaling APIs, which makes P/Invoke tick, are off-limits.
WP7 apps run under silverlight - the best place to learn about the security model and why p/invoke is not possible is here:
http://msdn.microsoft.com/en-us/library/dd470128(v=vs.95).aspx
As you can see the restriction is quite deep routed in the framework.
It still might be possible to run proper .NET CF executables in the future though if we can get it installed.
pInvoke
I just met a guy today, who successfully published WP7 app, that uses pInvoke - he just filled the Technical Exception form and ... done
It's used for muting system volume when the phone is in range of specified WiFi network (using BG agent) - for example when in range of school Wifi, turn the speaker off.
http://www.windowsphone.com/en-US/apps/6813ea1f-8d71-4ad5-a6d2-f80c193c6ac9
Can anybody confirm this actually works? He haven't tested it, because it won't work in emulator and even not in default developer unlock.
Here's the code he used, disassembled from the app:
http://pastebin.com/PfFm9Wxg
Do you know about any other apps, except apps from OEMs and Microsoft, that use pInvoke?
This gave me an idea, what else could be possible using small use of pInvoke? Maybe even something lot of users are asking for, like battery status on the start screen, who knows?
Thread Moved To WP7 Q&A
This is a development section, not Q&A. Please post in the correct section!
OK, a few things:
P/Invoke not working is *very* well documented. The DllImport attribute *appears* to be available, but calling a function that uses it invariably fails. The work-around for native code access is to use COM. There's also a project to re-implement DllImport.
Native code access has been available to homebrew developers for about a year, now. There are many apps which use it, ranging from web servers to registery browsers to yes, even an app that shows your battery status as a live tile on your Start screen...
These apps are not, however, permitted by Microsoft's Marketplace rules. It may be possible to get an exemption (some Marketplace apps do use native code) but by default, all apps that try to use native APIs (either via COM or P/Invoke) are automatically detected and rejected during analysis of the app prior to its approval.
As for the code you linked, it doesn't even compile (WP7 doesn't include CharSet.None, apparently). If you remove the CharSet directive, or if you set it to CharSet.Auto, it will compile but fails when used. You also didn't include any of the #using directives (OK, without the # in C#). Better would have been to just send us the XAP directly (yes we can get it, but a copy/pasted smidge is a lot less useful)
Downloaded the XAP. It's a paid app, so many tools won't find it.
Examining now. Nothing exotic so far. Possibly P/Invoke only works on signed apps?
The actual message signature that I see:
[PreserveSig]
[DllImport("coredll.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int waveOutGetVolume(IntPtr device, out uint volume);
Note that CharSet.Ansi still doesn't seem to exist. That said, this might simply be due to an outdated interop library that shipped with NoDo, and the Mango one does support this? More investigation...
"Possibly P/Invoke only works on signed apps?"
That's the question! If this actually works, it's possible we can get exception for more pInvoke calls and it might be even possible to certify app in marketplace for showing battery status or similar goodies. It won't be possible using that dllImport project, that's more than sure, but if we use only well defined set of safe pInvoke calls, we might get submission exception. It's definitely worth finding it out, what's possible here
dear devs, i was wondering if there could be any registry tweak to light up the led when sms come just like what the phones do when low battery
I guess not. It really a shame that MS couldnt implement a message, email, missed call reminder. The implemented missed call reminder only works for a few minutes after the missed call.
Agreed. The LED is actually a non-trivial battery drain, even on a short duty cycle (plus the slight increase in CPU needed to wake up and drive it) but it should be the user's choice, even if off by default.
Unfortunately, I don't think MS included any such functionality, hidden or otherwise. Doing it with homebrew might be possible, but wouldn't be easy; you'd need an app that could access SMS (or call, or whatever) activity, drive the LED state, and do it from the background long-term without crippling the battery life. Frankly, it's the ideal kind of thing for a native app... but we still haven't managed to make those work.
What you would need, in order to implement this in a homebrew app:
Access to the history/activity of the behavior you want to indicate (SMS, whatever).
Access to the LED, either through an official API to control it or by sending IOCTLs to the driver.
The ability to run long-term in the background - I don't know if this is feasible right now, though you might be able to savagely abuse the background audio decoder agent (the only official API that allows long-term third-party code execution in the background).
APIs for SMS (and I think for notification LEDs?) are on MSDN.
http://msdn.microsoft.com/en-us/library/ee498239.aspx
http://msdn.microsoft.com/en-us/library/ee481040.aspx
Those are for Windows Embedded Compact (CE7), which is not exactly the same as WP7 even after you strip away the WP7 UI and application model. Nonetheless, they've been useful references to me when developing native code in the past, and might work here.
If you're not familar with native code development, search this forum for Heathcliff74's great how-to on the subject. If nothing else, it would be worth it to find out if those APIs can be used.
GoodDayToDie said:
Agreed. The LED is actually a non-trivial battery drain, even on a short duty cycle (plus the slight increase in CPU needed to wake up and drive it) but it should be the user's choice, even if off by default.
Unfortunately, I don't think MS included any such functionality, hidden or otherwise. Doing it with homebrew might be possible, but wouldn't be easy; you'd need an app that could access SMS (or call, or whatever) activity, drive the LED state, and do it from the background long-term without crippling the battery life. Frankly, it's the ideal kind of thing for a native app... but we still haven't managed to make those work.
What you would need, in order to implement this in a homebrew app:
Access to the history/activity of the behavior you want to indicate (SMS, whatever).
Access to the LED, either through an official API to control it or by sending IOCTLs to the driver.
The ability to run long-term in the background - I don't know if this is feasible right now, though you might be able to savagely abuse the background audio decoder agent (the only official API that allows long-term third-party code execution in the background).
APIs for SMS (and I think for notification LEDs?) are on MSDN.
http://msdn.microsoft.com/en-us/library/ee498239.aspx
http://msdn.microsoft.com/en-us/library/ee481040.aspx
Those are for Windows Embedded Compact (CE7), which is not exactly the same as WP7 even after you strip away the WP7 UI and application model. Nonetheless, they've been useful references to me when developing native code in the past, and might work here.
If you're not familar with native code development, search this forum for Heathcliff74's great how-to on the subject. If nothing else, it would be worth it to find out if those APIs can be used.
Click to expand...
Click to collapse
Thx. Is's very kind and patient of you tell me so much about that.
on my hTc 7 pro the green led blinks on sms and missed calls. but only for 5 minutes than it goes off... i would like to have it on till i look on the screen what is the notification... that would be cool. but i haven't found any tips how to tweak that.
recently i look in the registry and found a /notification/ led path. that could be to the path of the green and red led. and there is some things like "blackout time" custom timer... etc. but i don't understand the timing they are in binary code written and i'm not sure if this is for the LED on top of the handset. i found this registra on windows mobile devices too. (and there it is for the blinking led)
The LED on the handset is certianly the "notification LED" if you phone has one (not all do). It lights up or blinks to "notify" you of certain things (missed calls, low battery, charging complete, etc.)
There may be some registry values that can control its behavior. Otherwise, I'd suggest trying with the native APIs. I'd like to help with this but you'll have to wait quite a while if you want me to do so; I've got a lot that I'm working on right now.
Moved to WP7 Q&A
This is a development section, it is not for questions. As highlighted in the read before posting stick
H,
Currently in the process of trying to edit the NFC source files of Java to change some of the functionality of the HCE feature of Android versions 4.4 and above.
I've downloaded the source and installed a custom version of AOSP to my Nexus 7, and am now looking to start adding my own code. However, when looking at how these source files are used/called i'm running into some trouble.
Are there any Kernel Trace programs available, to see what files/functions are being called and in which order, so I can start looking to add my own modifications to the source?
Any help is appreciated,
Thanks - Jay
XPosed
If the Java part of HCE is all you are interested in you may want to give a try to the Xposed framework [1].
The framework will allow your app to hook into any JAVA system call on a rooted device. You can e.g. hook into HostEmulationManager.notifyHostEmulationData and log or even manipulate any APDU received. You will find a short tutorial at [2]. At [3] you will find a small Xposed module targeting HCE. It is a new framework but no big deal after all.
I'm interested in HCE too and gained some experience over the last weeks so what exactly are you trying?
[1]
http://repo.xposed.info/
[2]
http://forum.xda-developers.com/showthread.php?t=2709324
[3]
http://forum.xda-developers.com/showthread.php?t=2573430
Hi Thomas
Essentially at my university, we have student cards that are MiFare Classic 1/4k RFID cards, that when placed up against a scanner outside of buildings/labs, scans the UID of the card and checks if the student is allowed access.
When Emulating a tag on an Android device, the UID (Not the AID) is randomly set. This is (I believe) set in the libnfc-nci code at the lower levels of Android, and so will require modifications at that level, and the levels above to allow me to pass a specific UID down the Android stack that will then be set.
I asked a similar question on Stackoverflow and got the following response:
http://stackoverflow.com/questions/28409934/editing-functionality-of-host-card-emulation-in-android
Essentially i'm looking for a way to find out what code is called when HCE is turned on, to find where the UID is set - after that I can look at passing down my own ID down from an app to set it myself.
I have an Human Machine Interface from an European producer called Exor.
The device have an embedded version of Javascript which does not support Xmlhttprequest nor Fecth.
I wish to use these two functions to perform an API call.
If I try to use one of these two functions the system return an error "Can't find variables".
I am struggling in order to find a possible function (alternative to Xmlhttprequest or Fecth) to be able to allow the API call to work in Javascript.
Any idea which could be a function to be used?
Andrew
As the title say pretty much it all, i need help with SELinux.
I do not quite understand it's purpose and why it got introduced.
My main problem right now is i cant use some very apps like before (Android 8 or less) since i'm now in Android 11 or more.
Also i've been warned that we cant record our calls now in android since Android 9 ( i may be wrong) but i know that even before you couldn't record normally calls. To bypass it you had to use the loudspeaker and record hands-free. I read somewhere that how the modem firmware was coded wich prevented to record calls both ways and to record normally calls you had to flash the modem firmware...
I live in a jurisdiction that allow to record calls both way and allow recording between two persons being one of them in the discussion, ex: you can't record other people discussion if you're not part of it.
So that's pretty what help i'm looking for and would like to have some help with other things mentioned above.
I have a Motorola Moto One 5G ACE witch custom rom Havoc Os and also an old Samsung Galaxy S4 also with a custom rom.
Thank you.
P.S. Sorry for bad english, it ain't my first language.
SELinux ( Linux ) in the world of Android devices is SEAndroid, it got implemented wiith Android 4.3. Some SELinux concepts aren't implemented in Android, hence we correctly have to speak of SEAndroid.
As part of the Android security model, SEAndroid enforces mandatory access control (MAC) for all processes, even processes running with root/superuser ( AKA su - switch user ) privileges. With SEAndroid, Android can better protect and restrict system services, control access to application data and system logs, reduce the impact of malicious software, and protect users from potential bugs in code on mobile devices.
IMO SEAndroid is somehow comparable to UAC known from Windows OS.
SEAndroid by default operates on the principle of default denial: anything that is not explicitly allowed is denied.
To change SEAndroid permissions on a per app basis Android must be rooted.
More info here:
Protecting Android with more Linux kernel defenses
News and insights on the Android platform, developer tools, and events.
android-developers.googleblog.com