How to overwrite system file with script - Android Software/Hacking General [Developers Only]

This script creates another file in the same directory, with the *same* name as the desired target file:
There are now two files in the same directory with the same name (???). The original file has an Android icon, and the new file has a text icon (Total Commander).
#!/bin/bash/sh
...
echo $RANDMAC > /config/wifi/mac.txt
I'm trying to create a script, and maybe eventually an app, to randomize the MAC address and host name.
Changing the MAC on my rooted Nextbook Ares 8 requires editing the mac.txt file. (The normal methods fail.)
Android 5.1.

John_83 said:
This script creates another file in the same directory, with the *same* name as the desired target file:
There are now two files in the same directory with the same name (???). The original file has an Android icon, and the new file has a text icon (Total Commander).
#!/bin/bash/sh
...
echo $RANDMAC > /config/wifi/mac.txt
I'm trying to create a script, and maybe eventually an app, to randomize the MAC address and host name.
Changing the MAC on my rooted Nextbook Ares 8 requires editing the mac.txt file. (The normal methods fail.)
Android 5.1.
Click to expand...
Click to collapse
may be you can post your whole script so that someone knowledgeable can help you

JumboMan said:
may be you can post your whole script so that someone knowledgeable can help you
Click to expand...
Click to collapse
Hi. The only part left out is what sets $RANDMAC, and it isn't relevant. If you echo to the screen, the format of the MAC address is the same as in the original mac.txt file.

I'm looking for an active Android tablet forum, if anybody knows of one.
I also posted this question at android.stackexchange.com. The post has gotten 16 views in two days - and most of those are mine, from visiting the page when I'm not logged in.

Related

[How to] Update time zone data / tzdata / zoneinfo (day saving time changes)

If your country has recently changed time zone rules, then your time information (summer/winter time switching) may be incorrect. News about time zone changes in different countries.
To update your time zones you need to update tzdata system files. You need to have root access to continue.
tzdata package is located here: /system/usr/share/zoneinfo/. Take a look at file zoneinfo.version, it contains version. I'll use version 2011n as an example below, but you can upgrade to any version. See current version.
So, you need:
1. Build or download ready zoneinfo files for Android,
2. Replace current files with updated using any file explorer (with root access).
I have attached files for version 2012b for Android (zoneinfo2012b.zip).
If you want to build it yourself, follow instructions:
1. You need any Unix-like OS with JDK.
2. Download latest tzdata.
3. Download attached archive (generate.zip) with source files generate, ZoneCompactor.java and ZoneInfo.java.
4. Create new folder tzdata2011n and unpack tzdata archive to it.
5. Update tzdata version name in file generate, for example: version=tzdata2011n
6. Run ./generate.
If you have troubles on step 6, check:
1. tzdata archive contents should be unpacked to folder tzdata2011n, see variable version in script generate;
2. Java Developer Kit (javac), like OpenJDK, should be installed to compile .java files.
Now you have three files: zoneinfo.dat, zoneinfo.idx, zoneinfo.version. Same files are attached to this post.
1. Upload three files to Android with any file manager in root mode to this path: /system/usr/share/zoneinfo/ and replace old files.
2. Reboot device.
Now timezones are updated and should change correctly during day saving time.
Alternative: Android application TimeZone Fixer. Notice, that it may be more dangerous, and had reported issues (bricks, boot loops, etc).
Just replaced files you provided in the attachment and now my phone is not booing.
I have rooted SGS II with stock 2.3.3 Android.
Any ideas?
Seems you did something wrong. I've tested this solution on Galaxy SII Android 2.3.5 without issues.
You need to flash stock firmware now: http://forum.xda-developers.com/showthread.php?t=1075278
As alternative, you can use application http://market.android.com/details?id=com.force.timezonefixer, but it does the same (and can be dangerous too).
I've altered script Vanav provided to work around possible directories with spaces in path to script, also made script to unpack tzdata<version>.tar.gz from directory user runs it and embedded java files in script.
Also added checks for tools needed for script to work at all, it is hard coded that zic is in /use/sbin/zic, because it's only in path for root, I do not know if zic is installed in this place in every Linux distribution, if not please post where it is in yours and I'll alter the script accordingly.
To use just unpack in directory with tzdata-file make executable and run it.
!NEVER run this script as ROOT!​It doesn't need root to work.
And big thanks to Vanav for his work on this script!
hashnon, please, post full source code of your script without embedding binary data.
This is a bad style, because hard to review code prior to execution. I can't execute code without review.
This is a script, for scripting program language there is no such thing like "source code" because scripts are it self source code.
The technique is really common in Linux world reliable and simple.
You wright the script and in it you place instruction like this:
Code:
tail -n +<number of script strings> | tar -xzC ./
After your script ready you replace <number of script strings> with actual number and attach all data you need to be shipped with your script this way:
Code:
tar -czf ./<file or files you need to attach> >>"/path/and/name/of/your/script"
After this your script is basically is your script + content of your data in tar.gz.
So if you want to "review" my script, download it and view it, if you so un-trusty to me that you think that I some how altered your *.java files just read the script, find the line which start with command "tail" and execute it by hand outside the script, little hint, number of lines is in one of the first variables.
Updated tzdata to version 2011n.
All tzdata I loaded and used do not have all needed city. For example for Russia there are no OMST timezone and cities, like Novosibirsk, Omsk, etc. Is it possible to add city to tzdata files? Currently I use 2011n version. Does the newest tzdata version (like 2012x) have new cities? How can I check what cities are inside tzdata files?
tigor.nsk, tzdata itself contains this data: see file "europe", zone "Asia/Omsk" and "Asia/Novosibirsk". But what to display in Android settings is defined in other Android database (with names only). E.g. SGS2 shows "Omsk" zone and doesn't show "Novosibirsk" zone.
If you want to select your zone, use any shown zone with UTC +0700 and no DST, such as:
Omsk
Novosibirsk
Novokuznetsk
Bangkok
Davis
Phnom Penh
Jakarta
Pontianak
Vientiane
Ho Chi Min City
Vanav said:
tigor.nsk, tzdata itself contains this data: see file "europe", zone "Asia/Omsk" and "Asia/Novosibirsk". But what to display in Android settings is defined in other Android database (with names only). E.g. SGS2 shows "Omsk" zone and doesn't show "Novosibirsk" zone.
If you want to select your zone, use any shown zone with UTC +0700 and no DST, such as:
Omsk
Novosibirsk
Novokuznetsk
Bangkok
Davis
Phnom Penh
Jakarta
Pontianak
Vientiane
Ho Chi Min City
Click to expand...
Click to collapse
Yes, I did that, I set the only available choice Bangkok. But my outgoing emails show "Malay Peninsula Standard Time" which I do not want Is it possible to update Android database with names?
tigor.nsk said:
Yes, I did that, I set the only available choice Bangkok. But my outgoing emails show "Malay Peninsula Standard Time" which I do not want Is it possible to update Android database with names?
Click to expand...
Click to collapse
I think there is some misunderstanding or your email client settings.
RFC 5322 specifies that email should contain "Date" field with your local date, and time zone offset in digital form, e.g.
Date: Sun, 19 Feb 2012 20:40:10 +0300
No other time zone information or text representation is added to email by email client.
So, it may be a local issue, if your email client on Android represents +0700 as "Malay Peninsula Standard Time", just for display purpose. This text is not added to emails. Check client settings if you can display timezone in digital form. Check your emails on other OS (Outlook, Thunderbird, Gmail).
Vanav said:
I think there is some misunderstanding or your email client settings.
RFC 5322 specifies that email should contain "Date" field with your local date, and time zone offset in digital form, e.g.
Date: Sun, 19 Feb 2012 20:40:10 +0300
No other time zone information or text representation is added to email by email client.
So, it may be a local issue, if your email client on Android represents +0700 as "Malay Peninsula Standard Time", just for display purpose. This text is not added to emails. Check client settings if you can display timezone in digital form. Check your emails on other OS (Outlook, Thunderbird, Gmail).
Click to expand...
Click to collapse
Thanks. Unfortunately I don't have control over email client, it's an app which allows to get to corporate emails.
But anyway I would like to see the timezone set to Asia/Novosibirsk in my Android settings. Is it possible to update the Android database to see the whole list of possible city choices?
tigor.nsk said:
But anyway I would like to see the timezone set to Asia/Novosibirsk in my Android settings. Is it possible to update the Android database to see the whole list of possible city choices?
Click to expand...
Click to collapse
Because this is just a cosmetic, not functional issue, I don't bother about it.
But here is instruction how to update Android internal database with time zones names (in Russian). In short, it is archive /system/app/Settings.apk, file timezones.xml.
I only have a Windows OS, can some create the files using 2012b? I would appreciate it greatly!
KMDonlon said:
I only have a Windows OS, can some create the files using 2012b? I would appreciate it greatly!
Click to expand...
Click to collapse
I've attached zoneinfo2012b.zip to the first post.
Thanks Buddy!
Vanav said:
But here is instruction how to update Android internal database with time zones names (in Russian). In short, it is archive /system/app/Settings.apk, file timezones.xml.
Click to expand...
Click to collapse
I followed the link and it looks doable but I could not find any timezone related files on my phone mentioned in this post ! No /etc/WPDB.zip, no /etc/timezones.db How could this be? I am using MIUI ROM, version 2.3.7c. Any place to get them or download?
tigor.nsk said:
I followed the link and it looks doable but I could not find any timezone related files on my phone mentioned in this post ! No /etc/WPDB.zip, no /etc/timezones.db How could this be? I am using MIUI ROM, version 2.3.7c. Any place to get them or download?
Click to expand...
Click to collapse
It may be HTC specific. Try to look in this file that I (and article) has mentioned:
archive /system/app/Settings.apk, files timezones.xml.
Here latest compiled tzdata2012h
It's odd, why it's 3 times larger than 2009 version?
Looks like "j" is the latest now.....

[Q] How can I change file path inside of a exe file?

Hi.
First of all, let me say that half of time took me to look for the right forum in XDA to post this message, and I'm still not sure I'm in the right place..
I think my Q is about modifying my OS, and this is why I post it here.
If the admin think there's better forum to this issue - I'd love to hear it..
Now, to business:
I have a GPS device, brand is X-GPS Navigation, Model GPS-S450B, that I will like to play with.
The OS is Windows® Embedded CE 6.0.
I just found out that at my GPS device, there is a file that resposible to a certain BMP that shown up at the shutdown process.
The filename is "PowerKey.exe", and it reffer to a file named "Notice_en.bmp".
I want to change that Notice-en.bmp file, to show that message in another langueage. I tried to overwrite the file with a similar bmp file, no luck. The file just re-created.
I've tried to edit the PowerKey.exe with a hex editor, and write a new path, to a file in NandFlash directory instead of the Notice_en that lays in Windows folder.
That also didn't go so well. "PowerKey has been preform illegal action and have to be shout down" or something like that, was the message. I could only put the device to sleep, until I recovered the old PowerKey file.
Any solution how to change the BMP file that resposible for the shutdown message?
(I guess the best idea is to write a registry entry to overwrite the BMP file in \Windows directory with the one in the \NandFlash directory every boot, only problem - I donno how to do it. )
Anyone?
There's no solution to my problem?
Recompile the exe.
Thank you.
Any chance to general guidlines in how is that done?

[TOOL] yaffs extractor, mmssms.db & contacts2.db converter

Some time ago I sold my old android phone and forgot to make a backup of SMS messages and call logs, but kept a complete image backup made by clockworkmod recovery (system.img, data.img, etc.). I wanted to import my SMS messages and call logs to a new phone, but without a reasonable backup this seemed to be impossible. Some quick search over the internet showed that a question about extracting/importing SMS messages from mmssms.db is not so uncommon, but there are no tools to do this. So I wrote one, and decided to share
Sources are available at github.com abbot/android-restore-tools.
It requires Python 2.6 and above to run.
I've also made compiled binaries for windows, attached to this post.
[Binaries last updated on 12.04.2011]
Thanks for the tools. Nice work.
Sent from my GT-I8150 using XDA
Hello,
I'm trying to use your tool to extract SMS from a nandroid backup.
I'm using the data.yaffs2.img file from the backup.
When I choose #2 for mmssms.db and then "s" to extract SMS I get the following error:
Failed to extract messages: file is encrypted or is not a database
DatabaseError('file is encrypted or is not a database',)
Warning: failed to remove temporary file...
What does this mean, and is there a solution?
Hi,
This may be caused by two things: either my tool can't properly read/extract the image file, or it can't read the database.
Please try to extract the image (extract -x data.yaffs2.img). If this does not produce any errors, find the mmssms.db file in the extracted data, it will probably be in data/com.android.providers.telephony/databases/mmssms.db. Then try to run extract -s mmssms.db. Please post if you get any errors doing these steps.
There was an error while extracting the image...it got through partway, but then failed at some bluetooth directory with colons in the path.
So I used a different tool to extract it, which went successfully.
Then I ran extract -s mmssms.db which came with the same error.
I'm pretty sure there isn't some weird encryption since I opened it up with Notepad ++ and I could read bits and pieces of conversations.
Anything else to try?
This might be caused by an older sqlite3 version bundled with binaries. I have updated the binaries in the first message to a newer version, could you download it and try again, extract -s mmssms.db?
Different error this time:
Failed to extract messages: no such column: failure_cause
OperationalError('no such column: failure_cause',)
Warning: failed to remove temporary file...
FYI the first thing at the top of the file when I open in Notepad++ is SQLite format 3 and this is from an HTC device running Android 4.x does that help at all?
This is much better and now makes sense: android 4.0 usually has sqlite 3.7.x, previous binary build of this tool had sqlite 3.6.21, and that was the reason for the 'file is encrypted or is not a database' error.
Now it looks like mmssms.db format in Android 4.0 has changed a little bit. I will have a look on these changes and update the app accordingly. Hope it will not take too much time
abbot2 said:
This is much better and now makes sense: android 4.0 usually has sqlite 3.7.x, previous binary build of this tool had sqlite 3.6.21, and that was the reason for the 'file is encrypted or is not a database' error.
Now it looks like mmssms.db format in Android 4.0 has changed a little bit. I will have a look on these changes and update the app accordingly. Hope it will not take too much time
Click to expand...
Click to collapse
That would be awesome, perhaps keep the old version available for other folks too though
If you can get this working I'll be sure to send a couple bucks your way. Thanks!
I have updated the extractor again, did some limited testing with android 4.0.3 on the emulator - seems to work. This database has a number of fields removed on android 4 compared to android 2, however everything required for xml dump is still there - just had to remove some unused stuff. Download the new version and try again.
Regarding the older versions, no reason to keep them - new one works fine with old database formats.
Awesome works perfectly! Send me a PM where to donate.
Sent from my GT-I9000 using xda premium
Thanks! It really works perfectly. Any plans to include MMS?
Sorry for the noobish question but I'm not familiar with Python.
Installed newest version of Python and also got the extracted mmssms.db and contacts2.db (used Nandriod Browser to extract them), which command lines do I need/what do I have to do? :s
€dit: Downloaded the zip from github and got as far as opening mmssms2xml.py which gives me an error when opening the mmssms.db
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "D:\Downloads\abbot-android-restore-tools-bc8584d\abbot-android-restore-t
ools-bc8584d\mmssms2xml.py", line 99, in open_file
self.messages = read_messages(filename)
File "D:\Downloads\abbot-android-restore-tools-bc8584d\abbot-android-restore-t
ools-bc8584d\mmssms2xml.py", line 33, in read_messages
c.execute("SELECT _id, thread_id, address, person, date, protocol, read, pri
ority, status, type, callback_number, reply_path_present, subject, body, service
_center, failure_cause, locked, error_code, stack_type, seen, sort_index FROM sm
s ORDER BY date DESC")
OperationalError: no such column: priority
Click to expand...
Click to collapse
€dit2: No problems with contacts2.db?!
€dit3: Well..this should be the last, found this explanation of rani2001 over here (http://forum.xda-developers.com/showpost.php?p=25173166&postcount=7). That did it for me!
Dude you just made my day
Can you please compile a new windows version with the latest files from github?
Or give us a manual how to use the .py files.
I think this will help many of us.
Thank you very much.
BTW: Your tool worked perfectly with my mmssms.db but failed with contacts2.db. Maybe the new files requested above will help me.
Got all my sms back thanks to you.
Amazing script, Thanks for sharing and explaining and updating.
60% There
I was just wondering if there was anything special I had to do to merge my old SMS list and the ones from the new list. I didn't see an option there for it and I don't want to just paste it in there and load it. Many thanks ahead of time
Hi I want to extract the data.yaffs2.img from my HTC Desire nandroid backup but get the error message:
> extract.exe -s data.yaffs2.img
Failed to extract messages: file is encrypted or is not a database
Any ideas?
I tried this tool yesterday evening and I'm truly grateful for your work!
I was ready to spend the whole night to work with these damn tables when I found your work. Many thanks! :highfive:
Where is the file stored after i run it? This is what I got.
Code:
C:\Users\Damastah>C:\Users\Damastah\Downloads\yaffs-mmssmsdb-calls-extractor\ext
ract.exe -s D:\S3_recovery\mmssms.db
Read 1782 messages
Save as (empty=sms-20130330111807.xml): y

[Q] How to modify any android apk file?

I use Bluestacks 0.9.11.4119 . I Install android applications and games, from root folder (i.e. device/android/data/data) i copy all the folders to windows directory (i.e. publicfolder/pictures), now many of the apps or games have two type of similar files and i need to see what's inside of the files,
1st.- .so files and database files
2nd.- some of the files have no extension so if i open it on notepad then it comes in Alphanumeric symbolic format,i think its encrypted so i am not able to see even i have tried many language decrypter but failed
3rd.- how to dissemble the apk file and how to modify it.
4th.- how to read XML file of android apps, when i open it on notepad or Microsoft XML it shows error.
I want to learn something so please help me with these issues, and thank you for previous help
To edit any apk is necessary Apktool. Look this guide and try edit:
http://www.xda-developers.com/decompile-edit-and-recompile-in-one-tool-with-apk-studio/
gamer22881 said:
I use Bluestacks 0.9.11.4119 . I Install android applications and games, from root folder (i.e. device/android/data/data) i copy all the folders to windows directory (i.e. publicfolder/pictures), now many of the apps or games have two type of similar files and i need to see what's inside of the files,
1st.- .so files and database files
2nd.- some of the files have no extension so if i open it on notepad then it comes in Alphanumeric symbolic format,i think its encrypted so i am not able to see even i have tried many language decrypter but failed
3rd.- how to dissemble the apk file and how to modify it.
4th.- how to read XML file of android apps, when i open it on notepad or Microsoft XML it shows error.
I want to learn something so please help me with these issues, and thank you for previous help
Click to expand...
Click to collapse
In addition to apktool (thanks, @kaiodduarte), you're also going to need a good text editor (I use Notepad++), an archive manager (like 7zip or WinRAR), and the ZipSigner app for your device.
ИΘΘK¡€ said:
In addition to apktool (thanks, @kaiodduarte), you're also going to need a good text editor (I use Notepad++), an archive manager (like 7zip or WinRAR), and the ZipSigner app for your device.
Click to expand...
Click to collapse
thank you for the advice but i have 1 worries
if the text file or a file is encrypted the how is notepad++ is going to help me..??
gamer22881 said:
thank you for the advice but i have 1 worries
if the text file or a file is encrypted the how is notepad++ is going to help me..??
Click to expand...
Click to collapse
It will help you with actually being able to make edits to text files without screwing up all of the line endings and encoding.

Add APK - repack system.img

I was looking for a similar topic but I did not find one. Refers to problems with running applications added to "system.img".
I bought UMIDIG S for my father-in-law. It is based on a mediatec chipset. Unfortunately, soft is tragic, and there is no full translation, so I decided to bury it a bit in "system.img".
I can easily install the file in Linux and make changes in it. I can delete applications, I can make changes in configuration files and "buikd.prop".
Unfortunately, all APK files were uploaded to "system.img" even though I set permissions 755 for directories, and 644 for directories. Although the files are root: root, after uploading such "system.img" none of these applications works for the phone. The system sees them and tries to load. Unfortunately, applications hang because of errors. The system informs that the application hangs, and does not load its window. The icons of these applications and the names do not appear either (applications have green robocik as icon, and domain name, e.g. com.android.clock ....)
I am asking for advice. How to add APK files to the unzipped "system.img" so that after packing and uploading to the phone there were no errors ???
Do you have found how add app in system.img?
It's all around, but you can replace apps with others. In the linux system, unpack the img, and mount them. Then you can freely rename files as well as move files within the .img mount point
I chose the applications or other files I did not need, and moved them to the directories (which I named my applications). If the application needed libraries, you also had to get files in a similar way, and place them in arm or arm64 directories.
Then prepared files "stuffed" with data, using the command DD. That is, dd if = (source file) of = (the recipient file at the system.img mount point).
Thanks for reply, so this only on Linux? For Windows there is something?
Markosv76 said:
Thanks for reply, so this only on Linux? For Windows there is something?
Click to expand...
Click to collapse
I do not know, I do not use Windows. Certainly you can in a similar way from BSD systems, probably from Android and MacOS. I read something that Microsoft can somehow support linux shell, but I do not know the details. You can always use some distribution that works with a pendrive.
Thanks, I will try again
Markosv76 said:
Thanks, I will try again
Click to expand...
Click to collapse
You can use Virtual Box to run a Linux distro inside Windows or you can try using Cygwin.
Sent from my LGL84VL using Tapatalk
jaroslawstrauchmann said:
I was looking for a similar topic but I did not find one. Refers to problems with running applications added to "system.img".
I bought UMIDIG S for my father-in-law. It is based on a mediatec chipset. Unfortunately, soft is tragic, and there is no full translation, so I decided to bury it a bit in "system.img".
I can easily install the file in Linux and make changes in it. I can delete applications, I can make changes in configuration files and "buikd.prop".
Unfortunately, all APK files were uploaded to "system.img" even though I set permissions 755 for directories, and 644 for directories. Although the files are root: root, after uploading such "system.img" none of these applications works for the phone. The system sees them and tries to load. Unfortunately, applications hang because of errors. The system informs that the application hangs, and does not load its window. The icons of these applications and the names do not appear either (applications have green robocik as icon, and domain name, e.g. com.android.clock ....)
I am asking for advice. How to add APK files to the unzipped "system.img" so that after packing and uploading to the phone there were no errors ???
Click to expand...
Click to collapse
did you find a solution to this? please reply if yes, I am having the same problem

Categories

Resources