In my module, I want to compare my string with string in a list of strings, which is stored as a .txt file in the SD card of Android 11. If my string is found in that list, the module should return the "true" value. But I cannot access this .txt file, I met "Permission Denied". So, Is there any possible way to read that type of file in the EdXposed Module?
nthp999 said:
In my module, I want to compare my string with string in a list of strings, which is stored as a .txt file in the SD card of Android 11. If my string is found in that list, the module should return the "true" value. But I cannot access this .txt file, I met "Permission Denied". So, Is there any possible way to read that type of file in the EdXposed Module?
Click to expand...
Click to collapse
you can use objectinputsteam for read that file and after read that file you can check anything which you want and make sure make takget sdk 27 for bypass any aditional read or write security.
AndroidX said:
you can use objectinputsteam for read that file and after read that file you can check anything which you want and make sure make takget sdk 27 for bypass any aditional read or write security.
Click to expand...
Click to collapse
I tried in sdk27 and it doesn't work, so I used a broadcast receiver and send myString to MainActivity.java, this class will read the file which I stored in the SD card.
Related
I misspelled my first name when I registered my NC. So when I went to Settings -> Device Info -> About Your NOOKcolor, my name in the Owner field was misspelled. I was able to correct it online via BN.com but the NC wouldn't correct itself. It's a minor annoyance but wanted it corrected.
What you need:
Rooted NC with Superuser access
Root Explorer or equivalent
SQLite Editor or equivalent
What to do:
Use Root Explorer and navigate to /data/system to find the accounts.db file
Copy the file to the root of your SDCard (I was unable to make edits to the accounts.db file while it was located in /data/system)
Locate the copied file and open it using SQLite Editor
Open the "extras" table
CLICK AND HOLD the name field you want to edit. In my case it was the firstname field
Select "Edit Record"
Correct your name in the Value field
Click Save
You should receive a confirmation that the update was successful
Use the back button (soft key button on the bottom menu) to get back to Root Explorer
Copy the newly edited accounts.db file
Navigate back to /data/system
BEFORE YOU PASTE, rename the existing accounts.db file to accounts.db.old (just a precaution in case you don't want to lose the original file)
PASTE the newly edited accounts.db file into /data/system
NOTE: the r/w permissions are different between the original accounts.db.old file and the newly edited file Update the permissions of the newly edited file to match that of old file
Reboot
Once it's up, you should see your corrected name. I was able to successfully download a book using the NC Shop so all should be well.
** DISCLAIMER: Do at your own risk. I assume no responsibility if this doesn't work for you or causes issues with your NC. I can't imagine it will as it's a very minor database modification. ***
Yikes I goofed up my accounts.db file by editing it with the text editor (just didn't read the instructions carefully. Moving too fast.). Also didn't back up the file before editing (I know I'm an idiot ). Any idea how I can restore this file? Thanks.
Ok, I just managed to restore the file and all is ok, and my name is corrected. Next time I will read instructions better!
Phew! Glad to hear it worked out for you.
Sent from my rooted Nook Color using XDA App
I have a rooted NT, and i start to notice the owner/account name becomes "unavailable". I went to the location specified above, but couldn't find the entry. Would anybody happen to know how i can change it?
Thanks.
rvr350 said:
I have a rooted NT, and i start to notice the owner/account name becomes "unavailable". I went to the location specified above, but couldn't find the entry. Would anybody happen to know how i can change it?
Thanks.
Click to expand...
Click to collapse
This is the NC forum. You have a NT. Hop over to the NT forum and post question there.
In Windows Phone 8 Runtime component (C++/CX) we can use fopen or CreateFile2 to create/open a file. For example
Code:
fopen("hello.txt", "w");
You see, I don't explicitly specify any path. And I can't figure out where this hello.txt resides? It can't be in Installed Location, and it isn't in Local Folder. Where is it?
Well, you could try the following:
_fileno() to get the integer file descriptor from the FILE*
_get_osfhandle() to get the Win32 HANDLE from the fd
GetFileInformationByHandleEx() to get the file name from the HANDLE.
I *think* those are even all supported on WP8, though I haven't checked except for the last one.
APIs like GetFullPathName() would make it easy, but may not be supported. CreateFile2 would let you skip the first two APIs in that list, if it works.
I inspected the WP8 .vhd file, and saw that my file was created in the Install folder. It looks like native code does not conform to the rule (Install folder is read-only location)
Whaaaaaat?!? That's... um. Serious. I'll look into it.
onmyway133 said:
I inspected the WP8 .vhd file, and saw that my file was created in the Install folder. It looks like native code does not conform to the rule (Install folder is read-only location)
Click to expand...
Click to collapse
Are you sure it does not create it on the root of the isolated storage space? That's rather unexpected to have the file in a read-only folder...
The install location is read/write to the app.
What
the
hell?
I can send test code if anybody wants, but it's easy enough to check yourself. You don't even need native code to do it, the .NET APIs work well enough.
I am somewhat confused.
mcosmin222 said:
Are you sure it does not create it on the root of the isolated storage space? That's rather unexpected to have the file in a read-only folder...
Click to expand...
Click to collapse
You can create a simple project to test this. In the C++ WP Runtime Component project, just use fopen or CreateFile2
Then use Hyper-V manager and Disk Management to easily inspect the WP .vhd file (I'm using Emulator)
You can use some things like IsoStoreSpy to see that the newly created file does not reside in the Local Folder (in WP8, they rename Isolated Storage to Local Folder)
I wrote a small app to test it; I can share the source if you want. It's really simple. I used the native APIs to create the file and write to it, then used the managed APIs to confirm it was there and read it, then used the native APIs to delete it, and the managed ones to confirm it was gone. Very simple. I then used the managed APIs to create the file myself (await Package.Current.InstalledLocation.CreateFileAsync("hello.txt")) and it worked.
Have you tried to create a xap file in the Install folder and reboot?
My 8X is freezing after creating a xap...
@spikedviper: No, I haven't tried anything like that. I don't seem to have write access from my app to the folder where pre-installed / OEM XAPs reside.
I did try editing the manifest; I was able to edit it with no problems but changing the capabilities didn't *do* anything, so I'm pretty sure it's still only parsed at install time.
hm...so what is the default path if no path specified?
looks like it stores it here: ms-appdata:///Local/ anyway check out "Data for Windows Phone" at msdn
Hi,
I want to use sqlite in my xposed module but i don't have any activity or context to send the database constructor.
Is it possible to overcome this?
I tried to send null as a context, but i'm getting nullPointerException when i try to open the database.
Thanks,
Gidi
If you can't get a context from the method you're hooking, you could try the AndroidAppHelper.currentApplication method.
Code:
Context ctx = AndroidAppHelper.currentApplication();
Context myCtx = ctx.createPackageContext("com.developer.app");
pyler said:
Code:
Context ctx = AndroidAppHelper.currentApplication();
Context myCtx = ctx.createPackageContext("com.developer.app");
Click to expand...
Click to collapse
HI Guys,
I tried the AndroidAppHelper.currentApplication() option, but it returns NULL in my case...
shnapsi said:
HI Guys,
I tried the AndroidAppHelper.currentApplication() option, but it returns NULL in my case...
Click to expand...
Click to collapse
If you are editing a database using sqlite and the current process you are hooking as no context reference, you can use root to set the database file to readable, then have your own service running in the background with a file observer tracking changes to a file on the device. Inside xposed module you will write to the file with a command instructing the file observer what to do. Then your service will "hear" the command and execute the changes needed.
I plan on writing up a guide for this. Tomorrow
elesbb said:
If you are editing a database using sqlite and the current process you are hooking as no context reference, you can use root to set the database file to readable, then have your own service running in the background with a file observer tracking changes to a file on the device. Inside xposed module you will write to the file with a command instructing the file observer what to do. Then your service will "hear" the command and execute the changes needed.
I plan on writing up a guide for this. Tomorrow
Click to expand...
Click to collapse
Thanks, I'll be happy to read your guide and learn new stuff
Anyway, I read that it's possible to use Sqlite DB without using SQLiteOpenHelper, this way, i don't need context.
the problem is that when i do it i get exception:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
this is my code:
database = SQLiteDatabase.openOrCreateDatabase(DB_NAME,null);
database.execSQL(CREATE_TABLE);
Thanks.
shnapsi said:
Thanks, I'll be happy to read your guide and learn new stuff
Anyway, I read that it's possible to use Sqlite DB without using SQLiteOpenHelper, this way, i don't need context.
the problem is that when i do it i get exception:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
this is my code:
database = SQLiteDatabase.openOrCreateDatabase(DB_NAME,null);
database.execSQL(CREATE_TABLE);
Thanks.
Click to expand...
Click to collapse
You probably don't have the required permissions to read/write to that location.
GermainZ said:
You probably don't have the required permissions to read/write to that location.
Click to expand...
Click to collapse
Thanks GermainZ,
which permissions do i need?
I tried to do it this way too:
Code:
File db = new File("/data/data/com.example.mytest/databases/" + DB_NAME);
db.setReadable(true);
db.setWritable(true);
File path = new File("/data/data/com.example.mytest/databases/");
path.setReadable(true);
path.setWritable(true);
path.mkdirs();
database = SQLiteDatabase.openOrCreateDatabase(db,null);
Still same result...
Thanks!
shnapsi said:
Thanks GermainZ,
which permissions do i need?
I tried to do it this way too:
Code:
File db = new File("/data/data/com.example.mytest/databases/" + DB_NAME);
db.setReadable(true);
db.setWritable(true);
File path = new File("/data/data/com.example.mytest/databases/");
path.setReadable(true);
path.setWritable(true);
path.mkdirs();
database = SQLiteDatabase.openOrCreateDatabase(db,null);
Still same result...
Thanks!
Click to expand...
Click to collapse
Let's differentiate between two things: your module (normal code) and the hooked process (the Xposed code).
Remember that hooked code runs as the hooked process (that is, the app you're hooking — *not* your module), so you won't be able to write to your module's data directory.
I don't know if you can change that. Maybe you could create the database and use Context.MODE_WORLD_WRITABLE (from your module, when it firsts open), but I don't think you'll have any luck creating it from the hooked process directly.
GermainZ said:
Let's differentiate between two things: your module (normal code) and the hooked process (the Xposed code).
Remember that hooked code runs as the hooked process (that is, the app you're hooking — *not* your module), so you won't be able to write to your module's data directory.
I don't know if you can change that. Maybe you could create the database and use Context.MODE_WORLD_WRITABLE (from your module, when it firsts open), but I don't think you'll have any luck creating it from the hooked process directly.
Click to expand...
Click to collapse
So where is the best place to use AndroidAppHelper.currentApplication(); so it won't return null and i will be able to use it in my hooked method?
Hello gays, i read all post's . I've the same problem. I start develop a module for xposed for my thesis the goal of application is return fake data when some aplications want access features that they don't need. I all ready can save in sqlite database the restrictions that the user want to restrict, the package name of application and uid. Now i want to access to the database methods by the main class (with implements IXposedHookLoadPackage) and i allways getting nullPointerException when i try connect to database. Anyone can solve this problem?? I will attach my main class IdentitySpoofing and my DatabaseHelper Best Regards Joao Marques
So I'm writing my first Xposed module and I've hit another snag.
My module has a UI that can be opened from the launcher. My UI is simple and it just allows the user to increment/decrement the counter. The value of the counter is saved to the SharedPreferences file found at \data\data\com.appname\shared_prefs.
The Xposed portion of the module will read the value out of the shared_prefs file, decrement the counter, and save the decremented value back to the file...
How can this be done? I know that I shouldn't be reading/writing to the shared_prefs file from the Xposed activity... so if there is a better (read correct) way of doing what I need to do, can you point me in the right direction? The only part of the module I don't have working is this last part... My UI is already able to Read/Write to the shared_prefs file, so hopefully that helps... or at least shows that I'm not wasting anyone's time.
In xposed module send intent to your app to modify prefs.
Could you be a little more specific? I'm more of an embedded/C programmer... Android/Java is still a little new to me.
Define own intent sction in manifest - e.g. mymodule.intent.action.DESCREASE_COUNTER
Then in hook you have to get context (getObjectField("mContext") - in android, AndroidAppHelper.currentApplication - for other apps)
Then just run intent:
mContext.sendBroadcast(new Intent("mymodule.intent.action.DESCREASE_COUNTER"));
I use such way in my module - https://github.com/pylerSM/XInstaller/. Check it
I try to read a shared preferences file in the Xposed Bridge module and I cannot get anything. Can you please, provide some information on how to read the file. I would prefer to use shared preferences instead of a binder.
What's the difference between the two following directories and what's a difference when I save the text file in two dir:
(1) /data/data/package_name
(2) /data/data/packeage_name/file
So, I wanna read a text file in Andoird 11 through Xposed Module. I can read the file's content in the (1) dir, but it can't in the (2) dir, which I meet the "ACCESS: (Permission Denied)".
I wonder what's the difference when I save the text file in the above directories? And is there any way to read the file in /data/data/packeage_name/file directory?
First things, its wrong place for ask that and another thing its cause to selinux security you can easily fix by using new Xsharedpreference which will store your file in different path or you can try by fix folder permission of /data/data/packeage_name/file directory but i m not sure this one works or not in your condition.