How to add script onto android phone - General Questions and Answers

Hi every one, i want to need support
I want to add script on my phone, and how to run this script?
thanks

run script to android
I put the script in EMMC and load SManager or scripter of rom toolbox lite

It depends on what the script does, and when you want it to execute. 1st, the script must be marked with executable permissions, or it will be treated as a text file. If you want it to run once on startup, put it in the init.d folder (your ROM must support this). If you want it to run manually, you can put it anywhere, and execute it manually through a file manager; there are also apps to make this easier. If you want it to run automatically based on certain events, you can use an app like Tasker or Locale to run the script whenever certain pre-set requirements are met.

Related

Fix permissions???

I see this in the theme and development section at times...but have no idea what it means and how to use it correctly if you will.
Everything I found gave smartass answers, so hoping to get some straight answers here.
It does exactly what it says... Repairs permissions. You're supposed to do it whenever you modify the Android System. It repairs file permissions to access what they need to access.
In Android, each app runs as its own UID (user ID) just like multiple people would have their own UID on a big UNIX system. The reasoning is the same, to prevent apps (people) from messing with each other's data. The data for each app has to be 'owned' by the UID the app runs as, and additionally the app itself (.apk file) has to be that same UID. Unlike big UNIX systems, these IDs are stored in the packages.xml file in /data/system. This file, in addition to storing UIDs, stores the android permissions of each program as described in its manifest (permissions like writing to the sdcard, monitoring phone state, turning wifi on and off, accessing bluetooth, etc). If the file is damaged, deleted, or otherwise unreadable, it is regenerated. The app UIDs are assigned initially in the order you install them (10001, 10002, etc.). When the packages.xml regenerates, it grabs the Android permissions from the .apks but doesn't know what the old UIDs were. That's where fix_permissions comes in. Whether run from recovery or a booted system, fix_permissions reads through the packages.xml file and performs a chown/chmod command (which changes owner/change read-write-execute permissions) on each .apk and the data directory for it. It doesn't fix Android permissions (e.g. if phone.apk lost the ability to make calls, fix_permissions wouldn't help)
To execute the fix_permissions script from your G2x:
Open the "Terminal" app from the application drawer type
Code:
su
fix_permissions
In ADB
Code:
adb shell fix_permissions
You can also do it as an option in CWM and when booted into recovery mode.
So basically you want to do it whenever you're flashing something in CWM?
Not really, unless you get a random FCs when trying to access your apps. But it's good practice I guess.

[Q] Dynamic symlinking/mounting (Multi user roms)

Hello,
On "old" roms we can use directory bind app to easily mount external storage's folder and make the apps think they are internal (move game's data somwhere else)
Directory bind is unsupported since some time, means it won't handle multi user from latest version of Android, is there anything we can do to dynamicly mount/symlink a folder depending on current user, or at least make it work for main(or all) users ? (it can be with an app, or with a script, if possible a script running on it own, by the system, and not an app that will afterward run the script)
Regards

{APP}Modified Apktool

Ive made a few changes the the apktool for android. First off it will be installed to they system partition. The apktool data folder will also be in system partition, so don't forget to set it when you start the app. Reason being is the emulated SD doesn't allow executing of files. If you want to use the app to unpack/repack and tweak your boot.img. Make a working directory in the apktool folder and place the boot.img in it then unpack and tweak. You have to options so choose the "common" unpack and repack when it asks.
I wanted to make this a universal system install. So before you flash just mount your system partition because the script will not. Won't hurt nothing it just simply won't install unless system is mounted.
It will work on whatever ROM you're using to save any questions. here's the link flash it and modify some apps right on your phone. Its fully tested and it works great
https://docs.google.com/file/d/0B0xIhMfx77oQVlJVY0J0bHJFRFE/edit?usp=docslist_api
Sent from my One Mini

Can a hacker copy prefs from one device to another to hijack a user session/state?

Hi all,
I need to test a scenario in which a hacker will try to copy the shared prefs file (or files) from one Android device to another in order to have the same state that the original user has and use the app as if he is the original user (hijack his existing sessions for instance).
I tried to copy the shared prefs file from one device to another (where I had installed a fresh copy of the app with an empty shared prefs file). Copied the file from the original device using adb , copied it to the sd card of the target device and move it to the right shared prefs directory using a file management app with root privileges. This didn't work.
When I start the app on the target device - I can see that the shred prefs file get "rolled-back" to its initial form. Maybe Android has some kin of mechanism to prevent manipulation of an app's files/data.
So my question is - how can I test this scenario in other ways? any way to transfer the shares prefs from one device to another without Android knowing about it?
Thanks!
This is interesting. To get the second app access the original prefs file it would have to run with the same UID than the application that originally created the preference file.
I do not know how you can change the UID however. I am pretty sure that you would need a rooted device.
VilleI said:
This is interesting. To get the second app access the original prefs file it would have to run with the same UID than the application that originally created the preference file.
I do not know how you can change the UID however. I am pretty sure that you would need a rooted device.
Click to expand...
Click to collapse
Indeed you need to fake the UID, you could do this through XPosed. You could develop a method that hooks the https://developer.android.com/reference/android/content/pm/ApplicationInfo.html#uid call. You hook and return the UID value that you want. Under the assumption that this is the call that the Android system uses to load/reset the preference file. I think however, the system uses some low level access through a kernel call to determine the uid of the application. So you would need to hook the kernel which is not that easy. Your best bet then is to edit and recompile the kernel source.

[Tutorial] [Root] [Samsung] How to stop apps being closed automatically on Samsung devices

Hello,
I recently discovered a way to disable automatically closing apps on Samsung Galaxy devices. This is especially useful for apps such as battery monitoring or fake GPS location apps.
I tested this on my Samsung Galaxy A52 5G, it should work on other models, however I cannot guarantee this. Despite this, it doesn't hurt to try!
First off let's talk a little why this happens. If you have multiple apps open at once, the OS will attempt to close some to free up resource when not currently in use, especially if the apps have not been interacted with for a while since they were last opened. This is normal behaviour, however you may have something like a battery monitoring app (e.g. AccuBattery) that you never want to be terminated. So let's try achieve this.
There's two core parts to this process. You need root for both of these (Magisk).
Part 1
Requirements:
Root file explorer (e.g. Total Commander)
A text file editor (PC is easiest. If you decide to use PC, use a USB transfer cable)
Guide:
On the root file explorer, navigate to /system/etc
Make a copy of floating_feature.xml. Make a second copy to preserve original contents in case things go wrong. If this file doesn't exist, you can't use this method.
Open it in the text editor of your choice (transfer to PC if needed)
Search for this in the file: <SEC_FLOATING_FEATURE_DWB_CONFIG_UNSUSPENDABLE_PACKAGE_NAME>
If it doesn't exist, create it like this: <SEC_FLOATING_FEATURE_DWB_CONFIG_UNSUSPENDABLE_PACKAGE_NAME> </SEC_FLOATING_FEATURE_DWB_CONFIG_UNSUSPENDABLE_PACKAGE_NAME>
Add your app's Package Name inside this tag. For example AccuBattery would be 'com.digibites.accubattery' so the result value would be <SEC_FLOATING_FEATURE_DWB_CONFIG_UNSUSPENDABLE_PACKAGE_NAME>com.digibites.accubattery</SEC_FLOATING_FEATURE_DWB_CONFIG_UNSUSPENDABLE_PACKAGE_NAME> assuming it didn't already exist. If it does exist, add a semi colon ; to the last entry and append the value to the end
Save the file and use your root file explorer to replace the original floating_feature.xml file
Reboot your phone
Part 2
Requirements:
Magisk
Command line interface with root (e.g. Termux)
Guide:
Download and install the App Systemizer Magisk Module
Reboot your phone
Open your command line interface and enable Superuser mode (in Termux this is 'su')
Enter 'systemize' in your command line interface and follow the instructions to systemize the desired app
Reboot your phone
Summary
You'll need to reapply this process whenever you update your phone software. It's a relatively simple process though. I'll be interested to see how successful this is for others so feel free to provide feedback and findings.
Hope this helps!

Categories

Resources