How to avoid session dieing when exiting infected app - android

I'm trying to get into the world of android-cybersecurity. I've programmed my first payload with msf venom and put it into an apk of an app I've developed. After exploiting in metasploit I can say that It'works, but It's far from being at least useful. When I closed my application the meterpreter session dies (and I can understand the causes) but I'm here to ask if anyone can explain how can I avoid this disconnection when I exit the app. Unfortunately I don't have any ideas and like I said I'm new to cybersecurity (But not to android programming) so when you'll try to explain try also to be as clear as possible. Thanks for any help you can give me :)

Related

I am unable to include "code" into this system as part of a question. Anything I put into the "Body"

For example, I only have one "body" but have a description like:
I can understand that a non-BLE device will not respond to the BLE Client device (Android) using StartDiscovery but should respond to a Scan request. I believe that the AdaFruit is responding to a discovery event because I am getting discovery responses to devices within range with the Android device app in the Settings/Connections/Bluetooth display. This includes the Adafruit BLE device. Again, I believe this means that the problem is on the Android side. I have searched everything I can find but most of the information I get is years old. I have focused in on something called LeScanCallback and/or LeDeviceListAdapter as the potential problem. I can't even tell is my callback is being triggered. Any help would be GREATLY appreciated!
but when I try to insert a code block this system won't let me post the question. I have seen many other questions where the poster actually has different input blocks for the manifest, xms, and main Java script, but I don't see anything like that.
I didn't realize I had the formatting wrong. I needed to manually insert 4 spaces in front of every line, and use the "Code here". That will teach me for reading the instructions too fast! Thanks for the comment from Morrison Chang that put me in the right direction.

Remove the Unfortunately the app has stopped message in android(Not its cause, but message itself)

Is there any way I can get rid of this message despite the app being stopped due to any exception?
My app(background service) is designed in such a way that it always restarts itself within 1 mins in case it gets killed. So even if it gets stopped, it would be restarted again, with no negative impact. Hence that message would unnecessarily annoy/worry the users.
As the app works fine on my device, but on other's device, its giving that message once or twice a day. I have no way to read the logs and check whats going on. I have placed the try/catch block everywhere. And the code is too complex to dig into again and check whats wrong. In short, I don't want to get rid of the "cause" off the message. But the "message" itself. Is it at all possible?
So How do I get rid of android OS showing that message even if it has "stopped"?
So even if it gets stopped, it would be restarted again, with no negative impact
There is no way to know whether or not there is a "negative impact" until the source of the problem is found.
I have no way to read the logs and check whats going on. I
Use crash logging frameworks like ACRA to collect stack traces from production apps.
And the code is too complex to dig into again and check whats wrong.
Use the crash logs from crash logging frameworks like ACRA to identify the source of the problem.
Is it at all possible?
Read the documentation for your chosen crash logging framework and see what the options are for user notification regarding such crashes. Some, like ACRA, will offer a "silent" mode where the crash is logged but without informing the users of that crash.
Theoretically, you could set up your own Thread.setDefaultUncaughtExceptionHandler

Why app getting Hanged?

I am implementing Mobile application in android using phonegap plugin.
I have login option in my app. Once login and keep device idle for long time like 4 to 5 minutes then app becomes unresponsive.
Any one faced this issue before? or any suggestion to find the root cause of the problem.
Thanks in advance.
This is likely an ANR (Application Not Responding), there is a topic about it here:
Android - how do I investigate an ANR?
You can collect the ANR logs at: /data/anr/traces.txt
You should also check the logcat output to search for errors!

Send an sms during apk instalation or when finish it

I wrote an application and I need to send sms. I think that it is a good idea to do it during the application installation or when installation is finished.
It is correct? If it is correct, how can I do it?
Sorry, but you cannot get control during application installation.
This question asked how to intercept an intent during a download. I personally tried by getting the Android Market source code and working on a c2dm hijack, however because it verifies its c2dm transmission with the app signature, it is about impossible (and very much frowned upon) to spoof, and without rooting the phone, you cannot listen to packets coming in on the network interface. Your best bet is to send the text after your application has installed (as described here).

When did Application restart?

Sometimes I see my app in DDMS restart.As I see it's process id changed.(I'm not sure that,because I don't write log for application oncreate.)
That behaviour ofen happened when I mount SDCard to share USB mode.I'd like to see what happend after mount in my application.So I debug my App,but unfortunately.When mount to share USB mode,application's process id changed and debug been auto stopped.
Why?What happened?What's the strategy for android handle application restart?
And there is another question.Why does sometimes an activity occur an error,thrown an exception dialog,and restart it.Sometimes the android platform just kill the activity and exit.
Maybe it's not a very useful question for develop.But I'm really missing,I want to know the answer.Please help me,friends.Thank you very much.
I used to get into similar cases like yours, what I did to handle and detect is like:
1. Check Device: sometimes devices mal-functioning really cause problems, a bad USB cable will really do restart Android/application.
2. Collect Log: after application restarts, just collect the log from system/event/radio/dumpstate... remember the time when app started to restart then check in log files to look for the causes.
Well, that's my experiences and it works, not in all situations but most of the time.

Categories

Resources