[Tutorial] How to Modify Android AutoBacklight Characteristics - Android Software/Hacking General [Developers Only]

I know, there are some hints about how to modify the terrible behaviour of AutoBacklight already existing in this forum. But they are all hidden deep inside some device specific ROM threads. So I like to cross post here, what I already partly posted in the Saga ROM dev section.
Androids AutoBacklight on most devices has a habit to not quite reasonably adapt to environmental light conditions. Especially in dark environment, the screen is usually not getting dark enough. You need to manually set the backlight value for ebook reading in a dark room e.g.
To overcome this issue is not exactly easy. But it's manageable.
What you need is a ROOTED DEVICE (!!) and APK-Manager.
The task is to modify the AutoBacklight values within arrays.xml, which is located inside framework.res.apk
I did this on my HTC Desire S. It should work for all HTC Androids and all other devices as long as you find the arrays.xml after decompiling the framework.res.apk. No garantie though for other devices. Just have a look to your files to see if it's there.
And here's the step by step procedure:
on Phone:
copy framework.res.apk from \system\framework to SD-Card (use e.g. RootExplorer)
on PC within APK-Manager folder:
1. place framework.res.apk into folder "place-apk-here-for-modding"
2. clear old files in projects folder if necessary
3. run Script.bat
4. Option 22 - select project --> select framework.res.apk
5. Option 9 - Decompile apk
6. apk is beeing decompiled and extracted to the projects folder now
7. keep APK-Manager script window open in background
8. go to \projects\framework-res.apk\res\values\
9. edit arrays.xml in editor accordingly, this is the interesting section:
Code:
<integer-array name="config_autoBrightnessLevels">
<item>11</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>
Keep the "config_autoBrightnessLevels" untouched. Just modify the "config_autoBrightnessLcdBacklightValues", "config_autoBrightnessLcdBacklightValuesDown" and "config_autoBrightnessLcdBacklightValuesUp".
10. back to APK-Manager Script - Option 11 - compile apk
11. after a while of compilation, you will be asked if you want to keep unmodified files from original apk --> answer Y
12. content from original framework.res.apk is beeing extracted to folder \keep
13. now you will be asked to delete all the files you modified in \projects to delete in \keep (think a while, it makes sense!)
14. in our case, you only need to delete resources.arsc (as we only modified a XML)
15. hit Enter in script window and the compilation will finish
16. look at \place-apk-here-for-modding, there's an unsignedframework.res.apk beside your original framework.res.apk
17. Option 12 - sign apk
18. look at \place-apk-here-for-modding, unsignedframework.res.apk will now be renamed to signed...
--> this is your new framework.res.apk to be uploaded to UOT-Kitchen. Copy it somewhere and rename it back to framework.res.apk
19. You can not simply copy it back to \system\framework. It has to be cooked and flashed.
20. Go to UOT-Kitchen website (http://uot.dakra.lt/kitchen/), open a new kitchen and do nothing but upload your new framework.res.apk. You don't need to upload all the other files as long as you do not want to apply any other modification.
21. submit the kitchen work and wait to be cooked
22. get your UOT-***.zip from the kitchen once it's available in the pickup section
23. put the zip to your phone an flash it through eighter Recovery or ROM-Manager as any other flashable update.zip
Done.
The values you see in the code section above are the ones that work best for me on the Desire S. Your milage may vary. Here's a characteristics comparison between my values and the ones that came with stock ROM.
Attached find the Excel file to do your own characteristics calculation.

Related

[Modding an android app] [easiest way] [noobs friendly]

Here we are not going to make an android app but its just MODDING
Tools REQUIRED
-APKTOOL
-Notepad++
-An Apk to work
first just decompile a apk by Apktool.. Then
Find These files
-> res
->smali
->apktool.yml
->androidmanfiest.xml
Now open apktool.yml and search for these lines
Apk file name- Snigdho.apk
PackageInfo
Cur_package: com.bel.android.snigdho
Orig_Package: com.bel.android.snigdho
For Example change them to:-
Apk file name- mynew.apk
PackageInfo
Cur_package: com.mynew.app
Orig_Package: com.mynew.app
Now save it and open AndroidManfiest.xml
And search for these lines
package="com.bel.android.snigdho "
Change it to for Example
package="com.bel.android.mynew"
Now open smali>com>snigdho
And rename “snigdho” to “mynew
It will look like "com.mynew.app
And save
Your Package Name is Changed
Now to change app name open AndroidManfiest.xml and search for these lines –
<application android:label =”@string/appname” android:name= “.SnigdhoApplication”
Rename It to –
<application android:label=”mynew" android:name= “.SnigdhoApplication”
And save it now!!
Now open res>values>strings.xml
And Search for these lines –
string name="app_name">Snigdho</string>
Rename it to for example
- string name="app_name">mynew</string>
And save it!!
Now if you want to customize it open res>drawable nodpi and there you will see some pngs customize them according to your wish
Now recompile and Sign The apk!!!
WARNING: DO NOT DO APP STEALING!!!
Hit thanks button if I helped you.. It encourages me..

[Completed] How to enable hide features LG L5II/L5X (QSlide, Eco Mode, Silente Mode)

Hello Guys,
I want to learn you how to enable hides features in you LG OPTIMUS L5II / L5X:
- QSlide (Calculator, Calendar, Browser, Note and Video)
- Timer-off button.
- Eco mode
- Silence mode
YOU NEED:
- To know how descompile and compile with apktool.
- BackUp of your device and BackUp of the next files. You never ever must delete original files. Because is posible that you need replace again the process.
IN YOUR PHONE:
- Root
- App: SuperSU
- App: Root Explorer
- App: Build Prop Editor (PlayStore)
- Files from you device:
> framework-res.apk (System/framework/)
> lge-res.apk (System/framework/)
> LGSystemUI.apk (System/app/)
> Build.prop (System/)
IN YOUR PC:
- Notepad++ (Edit XML)
- Java JDK (Driver)
- Apktool (Compile and Descompile)
- 7z938.exe (Sign)
-------The next step is to enable the QSlide ------ We going to active the Buttons hides in apps: Calculator, Calendar, Browser Internet, Note and Video). --------------
1. Open the app BUILD PROP EDITOR and do click in the pencil
2. down to find the lines that begin with: ro.lge.capp.........
3. add or replace the next texts:
ro.lge.capp_themeicon=true
ro.lge.capp_touch_Idi=true
ro.lge.capp_ghost_finger=true
ro.lge.capp_quickclip=true
ro.lge.capp_move_sdcard=true
ro.lge.capp_qwindow=true
ro.lge.capp_quickclip=true
ro.lge.capp_wfd=true
ro.lge.capp_smf=true
ro.lge.capp_qctwfd=true
ro.lge.capp_mdm=true
4. Save and exit. Reboot your phone. Now Open the apps: Calculator, Calendar, Browser Internet, Note and Video and you will find a New button to use Qslide.
---------- IF YOU DON´T KNOW HOW TO COMPILE AND DESCOMPILE APK IS BETTER THAT YOU STOP HERE THE TUTORIAL AND ENJOY THE FEATURE QSLIDE -------------
THE NEXT STEPS ARE TO ENABLE THE QSLIDE BAR
1. Firstly you need have installed the programs Notepad++ y Java JDK in your PC.
2. Next you must extract the folder to the program apktool in C:\ (Example: C:\apktool)
3. Put the files framework-res.apk and lge-res.apk in the folder C:\apktool
4. Install framework-res.apk and lge-res.apk in apktool:
COMANDS TO INSTALL IN APKTOOL
| C:\apktool>apktool if framework-res.apk Click: ENTER and wait
| C:\apktool>apktool if lge.res.apk Click: ENTER. It´s all.
5. Descompile the LGSystemUI.apk.
COMAND TO DESCOMPILE
| C:\apktool>apktool d LGSystemUI.apk Click: ENTER and wait some seconds... Going to appear a folder named: LGSystemUI
6. Open the file: LGSystemUI\res\values\boots.xml
7. Change the lines::: false for true
FLOATING LAUNCHER (QSLIDE BAR)
EXAMPLE
<bool name="config_systemui_feature_floating_launcher">false</bool>
Change false for true:
<bool name="config_systemui_feature_floating_launcher">true</bool>
and do the same with
ECO MODE: find the name "eco_mode"
SILENCE MODE: find the name "silence_mode"
TIME OFF: I don´t remember, I supose that is "display_timeoff"... really I don´t remember.
NOTE: You must not active the funtions: QREMOTE, QVOICE, NFC and MIRACAST beause the device haven´t the apps.
8. Save and exit.
8. Now compile the folder again with apktool.
COMAND TO COMPILE
| C:\apktool>apktool b LGSystemUI LGSystemUI-edited.apk Click ENTER and wait...
9. Next open the new LGSystemUI-edited.apk and LGSystemUI.apk (Original), doing click right in each one files and click on Open with 7z938. Copy the folder META-INF and the file AndroidManifest.xml from LGSystemUI.apk >> to >> LGSystemUI-edited.apk.
Ready, your APK is signed.
:::::::::: if you know how to align the APK teach us!!!! ::::::::::::::
10. Replace the file in your phone and change the permitions, now reboots your device.
It´s all guys, now enjoy you new smartphone with features just enabling in LG G Pro.
Thanks, Excuse me I do not speak English very well. :good:
Hi there,
Thanks for your share but here isn't the right place for that.
Please post your thread here:
Optimus L3 II, L5 II, L7 II, L9 II Themes and Apps
Thread closed

Add one or more fonts to your system easily

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
My English is a little weak, drafting errors may occur.
Hi there. Old dilemma on how to expand the number of Android phones into a pre-made fonts (4-6-8 pieces which normally used to be) just a piece of your favorite font, or even at 20-40. There are several possibilities for this already; flash recovery from flash zip from the XDA,fonts changer applications in the Play Store, etc, etc. Our current solution for our good, that we can not install the fonts chosen by the type and number of pieces of others, but what we want, and as much as we want. Lollipop and KitKat operating system as well, so far I have tested LG phones. I did not feel harmful slowdowns or system errors after 30-40 font. Finding the appropriate fonts on the Internet will take much more time than the change itself. TTF fonts look for.
What it needs for this operation:
1: Root
2: Root file manager
3: Notepad ++
4: A new font or fonts lack, and a few minutes of your life
By default it looks something like the font selection menu, depending on your phone / rom 4-10 pieces chosen from the letter:
After the change is then this:
Take the letter or letters you want to use a file manager to copy the system / fonts folder, and then modify the permissions to this: rw- r-- r--. If you enter more letters copying, modification group should be done faster. Feel free to highlight all the letters as well. Do not just folders, folder if the fonts folder.
Now, you can edit the file fonts_lge.xml, which is located in the system / etc folder. Because even copying the letters in the fonts folder, depending on the system still will not see it, but after editing this file.
Notepad ++ looks like the original xml file's:
​
After the change this way:
​
As you can see, but that's all that we need so that we insert name of copied letters:
<family name="Arial">
<font weight="400" style="normal">arial.ttf</font>
<font weight="700" style="normal">arialbd.ttf</font>
<font weight="400" style="italic">arialbi.ttf</font>
<font weight="700" style="italic">ariali.ttf</font>
</family>
Since the type arial four species were also found, (normal, bold, italic, bold italic) should therefore enter and inserted into the original xml file. But where there are only two (normal, bold), there's this:
<family name="Tahoma">
<font weight="400" style="normal">tahoma.ttf</font>
<font weight="700" style="normal">tahomabd.ttf</font>
</family>
Which entries are nothing but a plain ttf, there is this:
<family name="Hwedding">
<font weight="400" style="normal">hwedding.ttf</font>
<font weight="700" style="normal">hwedding.ttf</font>
</family>
It may find that some letters than we can find only three kinds of (normal, bold, italic), the more so, enter:
<family name="Garamond">
<font weight="400" style="normal">GARA.ttf</font>
<font weight="700" style="normal">GARABD.ttf</font>
<font weight="400" style="italic">GARAIT.ttf</font>
</family>
The editing syntax pay attention to the layout, images and Notepad ++ help him. When you are done, you copy the modified xml file in the system / etc folder, but not before the original file, create a backup or just rename example fonts_lge.xm away. The new set fonts_lge.xml file permissions: rw-r--r--.
Here you only need to reboot the phone, and if everything went well, the letters appear. It is not hard on the whole, it can be done in a few minutes, and you can use any fonts out what we want .... enjoy ....
If you have root, you can use iFont from play store, it is much easier...
Mr.Nice.ba said:
If you have root, you can use iFont from play store, it is much easier...
Click to expand...
Click to collapse
True .... easier ... faster ...
But.....the iFont may contain errors and bootloop. Have I ever experienced. And in this way no matter how many fonts can be done ..... just one, or 200. And you can choose how the font should not have to choose a predefined blind. You just have to search the web you like the true type font, thousands of them.
But thanks for the tips and useful comments.
Meggyi said:
True .... easier ... faster ...
But.....the iFont may contain errors and bootloop. Have I ever experienced. And in this way no matter how many fonts can be done ..... just one, or 200. And you can choose how the font should not have to choose a predefined blind. You just have to search the web you like the true type font, thousands of them.
But thanks for the tips and useful comments.
Click to expand...
Click to collapse
Tried iFont on my H955 V15c , and no bootloop, everything work fine. iFont replace you default NewSmartGhotic font with one you chose. It is easy to restore to factory font because backup is created automaticaly. I have downloaded some TWRP flashable fonts zips from LG G3 forums, extracted and copied to internal storage, than from iFont you can select fonts from folder on phone storage. Before apply you can see a preview of your desired font. So far, helvetica light looks amazing
Meggyi said:
My English is a little weak, drafting errors may occur.
Hi there. Old dilemma on how to expand the number of Android phones into a pre-made fonts (4-6-8 pieces which normally used to be) just a piece of your favorite font, or even at 20-40. There are several possibilities for this already; flash recovery from flash zip from the XDA,fonts changer applications in the Play Store, etc, etc. Our current solution for our good, that we can not install the fonts chosen by the type and number of pieces of others, but what we want, and as much as we want. Lollipop and KitKat operating system as well, so far I have tested LG phones. I did not feel harmful slowdowns or system errors after 30-40 font. Finding the appropriate fonts on the Internet will take much more time than the change itself. TTF fonts look for.
What it needs for this operation:
1: Root
2: Root file manager
3: Notepad ++
4: A new font or fonts lack, and a few minutes of your life
By default it looks something like the font selection menu, depending on your phone / rom 4-10 pieces chosen from the letter:
After the change is then this:
Take the letter or letters you want to use a file manager to copy the system / fonts folder, and then modify the permissions to this: rw- r-- r--. If you enter more letters copying, modification group should be done faster. Feel free to highlight all the letters as well. Do not just folders, folder if the fonts folder.
Now, you can edit the file fonts_lge.xml, which is located in the system / etc folder. Because even copying the letters in the fonts folder, depending on the system still will not see it, but after editing this file.
Notepad ++ looks like the original xml file's:
​
After the change this way:
​
As you can see, but that's all that we need so that we insert name of copied letters:
<family name="Arial">
<font weight="400" style="normal">arial.ttf</font>
<font weight="700" style="normal">arialbd.ttf</font>
<font weight="400" style="italic">arialbi.ttf</font>
<font weight="700" style="italic">ariali.ttf</font>
</family>
Since the type arial four species were also found, (normal, bold, italic, bold italic) should therefore enter and inserted into the original xml file. But where there are only two (normal, bold), there's this:
<family name="Tahoma">
<font weight="400" style="normal">tahoma.ttf</font>
<font weight="700" style="normal">tahomabd.ttf</font>
</family>
Which entries are nothing but a plain ttf, there is this:
<family name="Hwedding">
<font weight="400" style="normal">hwedding.ttf</font>
<font weight="700" style="normal">hwedding.ttf</font>
</family>
It may find that some letters than we can find only three kinds of (normal, bold, italic), the more so, enter:
<family name="Garamond">
<font weight="400" style="normal">GARA.ttf</font>
<font weight="700" style="normal">GARABD.ttf</font>
<font weight="400" style="italic">GARAIT.ttf</font>
</family>
The editing syntax pay attention to the layout, images and Notepad ++ help him. When you are done, you copy the modified xml file in the system / etc folder, but not before the original file, create a backup or just rename example fonts_lge.xm away. The new set fonts_lge.xml file permissions: rw-r--r--.
Here you only need to reboot the phone, and if everything went well, the letters appear. It is not hard on the whole, it can be done in a few minutes, and you can use any fonts out what we want .... enjoy ....
Click to expand...
Click to collapse
Thanks OP, your solution worked like a charm! iFont refused to do anything because it couldn't detect that I was rooted.
I used LG smartword to download and just apply the new fonts in Settings>displays>fonts

Enabling Vulkan for vernee mix 2

you may have noticed this post at the modding thread (and maybe the Q&A thread), the reason im double posting is so others could see this one visibly, while the other is just a substitute to get the 10 post requirement (sorry to add the unnecessary spam / post)
requirements:
Rooted phone
file manager
some patience
and a healthy working mind
and twrp (in case of bootloop)
now anything you do below here is considered "DIY" if your device gets f***ed dont blame me
1. open your file manager
go to : /system/etc/permissions
make 2 new files
android.hardware.vulkan.level.xml
android.hardware.vulkan.version.xml
2.
open android.hardware.vulkan.level.xml
add this :
<permissions>
<feature name="android.hardware.vulkan.level" version="0" />
</permissions>
save & close
open android.hardware.vulkan.version.xml
Add this:
<permissions>
<feature name="android.hardware.vulkan.version" version="4194307" />
</permissions>
save & exit
3. Now the fun bit
go to /system/vendor
open lib/egl
copy libGLES_mali.so & paste it to lib/hw
rename libGLES_mali.so at the lib/hw folder to vulkan.mt6757.so
next
open lib64/egl
copy libGLES_mali.so & paste it to lib64/hw
rename libGLES_mali.so at the lib/hw folder to vulkan.mt6757.so
4. reboot and hope it doesnt bootloop
tadah, you're ready to game hard! , open aida64 and the devices tab, you will see "Vulkan Device - Mali-T880"
if you think this helps, do press the thank button
Hi. How can I root this Phone?
Sir,thanks for his post is very interesting for me..I now working on some port Samsung that have many files Vulcan including the files that you takes.. thianproces is possible to do trough the super.. and change the file names 7870 for the names mentioned for you?!and do it manually? Thanks for is for his support..are the same file including on firmware Samsung doc 7870 y 7884b
May be will can working it? What do you think

[Tool] LG Back up & restore (com.lge.bnr) .lbf file analysis & extract tool

Hello, recently I looked into LG backup and restore application using static analysis.
Note: this is based on version lg bnr 8.0.26 from 2020-02-13, tested with 7.0.20 from 2008-12-31
Here is the extract tool:
https://github.com/Mysak0CZ/LBFtool
And here is the technical part (you don't need to read this, if you just want to extract your data):
The file contains 2 headers (one of them is referred to as "new")
These are XML documents encrypted using AES/ECB/PKCS5Padding + SHA256 and null IV with static password
Code:
cd562f61-5399-3978-ac76-7c54b0508010
And they look like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<BackUp>
<Common>
<Name>LGBackup_200217_1</Name> <!-- Name of the backup file -->
<Id>Randomly generated UUID</Id> <!-- Id of the backup file -->
<IsNew>True</IsNew> <!-- IsNew is same in new and old header -->
<Version>1.00</Version>
<Attr Name="product_model">LM-X525</Attr>
<Attr Name="os_version">9</Attr>
<!-- And other attributes including google email -->
</Common>
<BackupItem Category="settings_DB" StartOffset="59392" DataSize="136626" />
<BackupItem Category="MEDIA_DB" StartOffset="901169" DataSize="78393344" FileName="external.db" />
<!-- Other backuped items -->
</BackUp>
The "new" header has more information than original header, but same structure.
The attribute "IsNew" signals the presence of the new header. (and is True in both files)
All numbers inside file are in Big-endian.
And this is the structure of the file (decimal position):
Code:
0: Unknown - 0x00 for me
1: Int32 - size of the new header
5: Int64 - offset to the new header (usually 13)
13 ... EOF-33: data
EOF-33: 20 bytes - SHA1 hash of the password (if present, otherwise still data)
EOF-13: Int64 - offset to the (old) header
EOF-5: Int32 - size of the (old) header
EOF-1: Bool - Lock byte - the file is (0x01) or isn't (0x00) protected by password
The password is only checked during import, not used to encrypt data (so to remove password, just set the last byte to 0)
Every "BackupItem" entry has a "Category".
Special case is Category="APPLICATION" with this structure:
Code:
<BackupItem Category="APPLICATION">
<APPLICATION Name="com.lge.ime" StartOffset="19221586" DataSize="2385983" Package="com.lge.ime">
<Attr Name="com.lge.ime">com.lge.ime</Attr>
</APPLICATION>
<APPLICATION Name="org.exmple.app" StartOffset="1429652009" DataSize="3420160" FileName="org.exmple.app.tar" Package="org.exmple.app">
<Attr Name="org.exmple.app">org.exmple.app</Attr>
</APPLICATION>
<!-- ... -->
</BackupItem>
All applications are tar files that contain 2 folders:
app - contains the apk file
data - application's internal data
All other items have:
StartOffset - Offset inside file
DataSize - Self explanatory
FileName - Not all have this, but most do; it is the original name of the backuped file.
The files are not compressed nor encrypted.
Footnote: This is my first post on XDA, so sorry for any mistakes I made (including my english) and feel free to correct me/give me advice.
Mysak0CZ said:
Hello, recently I looked into LG backup and restore application using static analysis.
Note: this is based on version lg bnr 8.0.26 from 2020-02-13, tested with 7.0.20 from 2008-12-31
Here is the extract tool:
And here is the technical part (you don't need to read this, if you just want to extract your data):
The file contains 2 headers (one of them is referred to as "new")
These are XML documents encrypted using AES/ECB/PKCS5Padding + SHA256 and null IV with static password
And they look like this:
The "new" header has more information than original header, but same structure.
The attribute "IsNew" signals the presence of the new header. (and is True in both files)
All numbers inside file are in Big-endian.
And this is the structure of the file (decimal position):
The password is only checked during import, not used to encrypt data (so to remove password, just set the last byte to 0)
Every "BackupItem" entry has a "Category".
Special case is Category="APPLICATION" with this structure:
All applications are tar files that contain 2 folders:
app - contains the apk file
data - application's internal data
All other items have:
StartOffset - Offset inside file
DataSize - Self explanatory
FileName - Not all have this, but most do; it is the original name of the backuped file.
The files are not compressed nor encrypted.
Footnote: This is my first post on XDA, so sorry for any mistakes I made (including my english) and feel free to correct me/give me advice.
Click to expand...
Click to collapse
Nice job dude! just a the quick recommendation: I would suggest that you put your code on gitlab or GitHub so it will become easier for others to contribute
Sent from my OnePlus 6T using XDA Labs
Hi. I'm trying to use this tool but I don't know how to use it. I followed the instructions and downloaded Python. but none of the other steps are working for me. I have my backup on my PC and am trying to extract my files into normal formats as I wish to move away from the LG platform. Thank you.
---------- Post added at 07:20 AM ---------- Previous post was at 06:57 AM ----------
Nevermind, I found a work around.
For anyone else in the future wondering: If you select backup with the app on the phone and backup to the internal memory, it will create .pdf files of all text/images in internal storage>>Quickmemo+. This doesn't help to retrieve the audio or video recordings, but at least that way you can retrieve your text files/images.
Tried script on old backup, failed with error.
Mysak0CZ said:
Hello, recently I looked into LG backup and restore application using static analysis.
Note: this is based on version lg bnr 8.0.26 from 2020-02-13, tested with 7.0.20 from 2008-12-31
Here is the extract tool:
And here is the technical part (you don't need to read this, if you just want to extract your data):
The file contains 2 headers (one of them is referred to as "new")
These are XML documents encrypted using AES/ECB/PKCS5Padding + SHA256 and null IV with static password
Code:
cd562f61-5399-3978-ac76-7c54b0508010
...
[/CODE]
All applications are tar files that contain 2 folders:
app - contains the apk file
data - application's internal data
All other items have:
StartOffset - Offset inside file
DataSize - Self explanatory
FileName - Not all have this, but most do; it is the original name of the backuped file.
The files are not compressed nor encrypted.
Footnote: This is my first post on XDA, so sorry for any mistakes I made (including my english) and feel free to correct me/give me advice.
Click to expand...
Click to collapse
My first post as well. Thanks for the script. I ran it on an old backup I was hoping to extract contacts from. See excerpt with error below.
C:\Temp\LG G4\Backup>python extract.py LGBackup_190218.lbf
[+] Backup size: 597864605
Parsing...
Reading header
[*] Header start offset: 597792768
[*] Header length: 71824
[+] Header read OK
Reading header (new)
[*] Header start offset: 7021235167904623918
Traceback (most recent call last):
File "extract.py", line 125, in <module>
root = readHeader(True)
File "extract.py", line 99, in readHeader
size = getBackupInfoSize(isNew)
File "extract.py", line 88, in getBackupInfoSize
raise Exception("Invalid header length.")
Exception: Invalid header length.
C:\Temp\LG G4\Backup>
Click to expand...
Click to collapse
I'm a complete newbie with Python, haven't done any coding in over a decade. Where do I go from here?
Ninja_Toad said:
My first post as well. Thanks for the script. I ran it on an old backup I was hoping to extract contacts from. See excerpt with error below.
I'm a complete newbie with Python, haven't done any coding in over a decade. Where do I go from here?
Click to expand...
Click to collapse
Hi! Your backup seem to be at least partially corrupted. (The new header position seems to start at 7021235167904623918, however the file is only 597864605 bytes long). Fortunatly there are two headers in the backup and the old one seems to be ok (You got "[+] Header read OK" for the old header). So you can try ignoring the "new" header.
To ignore the faulty header just set the relevant "FORCE_*_HEADER" to True in the script header. In your case just set "FORCE_OLD_HEADER = True".
Also note, that extracting contacts in readable format is beyond this script's current scope. This can however be done manually. After you get your data successfully extracted, look for export/data/contacts_DB file. This is a TAR file in which you need to find file "data/data/user/0/com.android.providers.contacts/databases/contacts2.db". This is the contact database as your phone stores it. To actually extract the contacts, you will need to find a way to convert the database to some other format (I have't looked into how the contacts are stored, you will need to do your own googling)
Files extracted but...
hello guys,
I also managed to extract my files using the hack mentioned above (force old headers to TRUE) since by using the default script i was also getting a similar error as above.
However now all of my files (pictures in particular) are corrupted and i cannot seem to be able to open them using several editors.
Anyone else had the same issue?
Thanks in advance!
serlal said:
hello guys,
I also managed to extract my files using the hack mentioned above (force old headers to TRUE) since by using the default script i was also getting a similar error as above.
However now all of my files (pictures in particular) are corrupted and i cannot seem to be able to open them using several editors.
Anyone else had the same issue?
Thanks in advance!
Click to expand...
Click to collapse
Yes I have exactly same issue as you have. All exported files cannot be read.
Hello @tking2000 and @serlal, this script was written based on versions that are available to me. There are two possibilities of what is happening:
1) The file was badly corruped, however the old header stayed itact. (This is the likely case, if you are trying this tool because your phone refused to restore the backup)
2) The file was made by version that does something differently and the script doesn't account for it.
In the first case there is nothing anyone can do (short of trying some corrupted file recovery software hoping the corruption is only minor)
In the second case, you can try sending me a PM with following information, so I can have a look and confirm whether this is truly the case (and improve the script)
1) The script's output
2a) The <Version> and <Attr Name="settingVersionName"> from the <Common> part of the header
2b) If you aren't concerned about privacy or it is just easier for you: just send the whole header file
3) The version of the com.lge.bnr app (LG Mobile Switch); this is not necessary, but may help me
Feel free to censor anything you are sending with [CENSORED] (like your email or filenames)
I have no experience with python, but I have one of these lbf files and I'm trying to figure out how to make it work and all I get is couldn't get library pycryptodome. How do I get Python 3.8.3 to get this library?
Multipart backups
Hello everyone,
I just finished an update, that should enable the tool to extract backups that have multiple files.
If you received "Exception: Invalid header length." in the past and your backup has multiple files, try the script now; your backups are likely to extract correctly now.
This is the likely case for: @Ninja_Toad @serlal and @tking2000
This was made possible thanks to @cheesyzombie who sent me the data I asked for.
@kamikazkid, You don't need to know Python to use this tool, the easiest way is to enter the commands in quotes on the github page into the console (To open the console Shift+Right click in the folder with backups and choose "Open command window here").
Just:
Download the zip on the github page (Under "Code" button)
Make sure the extract.py and your backup are in the same folder
Follow the usage, skip the 4th step and replace xxxxxx to match your backup name.
I figured it out, it was something with windows 10 and the version of python installation I used. Microsoft garbaging things up as usual, thanks for the help though. Thanks, I recovered my files from my old phone successfully.
I have no experience withc++, but I have one of these lbf files and I'm trying to figure out how to make it work, it is a great this forum
Is there a way to import the _DB files (contacts, messages, call logs etc.) back to a phone?
I asked before:
https://forum.xda-developers.com/lg-g3/general/restore-backup-lbf-lineage-17-t4172483#post83644281
Thank you so much for this! I was able to extract the Messaging data from an LG G8 ThinQ. Does anybody know the easiest way to view that data on my PC?
Hi, you can follow these steps to extract data fron _db files:
1) Send the _db files like contacts_db, messages_db to any android phone
2) Double tap on the file and open it using File Manager (which is by default on Mi phones)
3) The file will now open as a folder. Continue opening the folders until you reach to the last file.
4) The last file is the database file. It won't open directly. Select the file and extract the file.
5) Now transfer the file to computer and you can now view it using SQLite DB Browser if its a contacts file or you can use any VMG reader if its a messages file.
Hope this helps you.
Hi @Mysak0CZ, just follow your instructions on GitHub but when I run the command on Command Prompt, nothing happens. Just like this:
F:\>python -m pip install pycryptodome
F:\>python extract.py LGBackup-201031.lbf
When I enter nothing happened. Kindly help to advise for this.
Thank you
Problem in powershell
Mysak0CZ said:
Hi! Your backup seem to be at least partially corrupted. (The new header position seems to start at 7021235167904623918, however the file is only 597864605 bytes long). Fortunatly there are two headers in the backup and the old one seems to be ok (You got "[+] Header read OK" for the old header). So you can try ignoring the "new" header.
To ignore the faulty header just set the relevant "FORCE_*_HEADER" to True in the script header. In your case just set "FORCE_OLD_HEADER = True".
Also note, that extracting contacts in readable format is beyond this script's current scope. This can however be done manually. After you get your data successfully extracted, look for export/data/contacts_DB file. This is a TAR file in which you need to find file "data/data/user/0/com.android.providers.contacts/databases/contacts2.db". This is the contact database as your phone stores it. To actually extract the contacts, you will need to find a way to convert the database to some other format (I have't looked into how the contacts are stored, you will need to do your own googling)
Click to expand...
Click to collapse
Hi, I am trying to extract via your method but in the power shell in sending the command "python extract.py LGBackup_1x0x07.lbf" it does not execute and brings me back the initial path line. Do you have solutions in this regard? Thanks in advance
Ps. I use Win10
Worked so well. I only needed to recover images and audio recordings after realizing that LG backup tool won't restore on other brand phones.
Thank you!!
Mysak0CZ said:
Hello, recently I looked into LG backup and restore application using static analysis.
Note: this is based on version lg bnr 8.0.26 from 2020-02-13, tested with 7.0.20 from 2008-12-31
Here is the extract tool:
https://github.com/Mysak0CZ/LBFtool
And here is the technical part (you don't need to read this, if you just want to extract your data):
The file contains 2 headers (one of them is referred to as "new")
These are XML documents encrypted using AES/ECB/PKCS5Padding + SHA256 and null IV with static password
Code:
cd562f61-5399-3978-ac76-7c54b0508010
And they look like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<BackUp>
<Common>
<Name>LGBackup_200217_1</Name> <!-- Name of the backup file -->
<Id>Randomly generated UUID</Id> <!-- Id of the backup file -->
<IsNew>True</IsNew> <!-- IsNew is same in new and old header -->
<Version>1.00</Version>
<Attr Name="product_model">LM-X525</Attr>
<Attr Name="os_version">9</Attr>
<!-- And other attributes including google email -->
</Common>
<BackupItem Category="settings_DB" StartOffset="59392" DataSize="136626" />
<BackupItem Category="MEDIA_DB" StartOffset="901169" DataSize="78393344" FileName="external.db" />
<!-- Other backuped items -->
</BackUp>
The "new" header has more information than original header, but same structure.
The attribute "IsNew" signals the presence of the new header. (and is True in both files)
All numbers inside file are in Big-endian.
And this is the structure of the file (decimal position):
Code:
0: Unknown - 0x00 for me
1: Int32 - size of the new header
5: Int64 - offset to the new header (usually 13)
13 ... EOF-33: data
EOF-33: 20 bytes - SHA1 hash of the password (if present, otherwise still data)
EOF-13: Int64 - offset to the (old) header
EOF-5: Int32 - size of the (old) header
EOF-1: Bool - Lock byte - the file is (0x01) or isn't (0x00) protected by password
The password is only checked during import, not used to encrypt data (so to remove password, just set the last byte to 0)
Every "BackupItem" entry has a "Category".
Special case is Category="APPLICATION" with this structure:
Code:
<BackupItem Category="APPLICATION">
<APPLICATION Name="com.lge.ime" StartOffset="19221586" DataSize="2385983" Package="com.lge.ime">
<Attr Name="com.lge.ime">com.lge.ime</Attr>
</APPLICATION>
<APPLICATION Name="org.exmple.app" StartOffset="1429652009" DataSize="3420160" FileName="org.exmple.app.tar" Package="org.exmple.app">
<Attr Name="org.exmple.app">org.exmple.app</Attr>
</APPLICATION>
<!-- ... -->
</BackupItem>
All applications are tar files that contain 2 folders:
app - contains the apk file
data - application's internal data
All other items have:
StartOffset - Offset inside file
DataSize - Self explanatory
FileName - Not all have this, but most do; it is the original name of the backuped file.
The files are not compressed nor encrypted.
Footnote: This is my first post on XDA, so sorry for any mistakes I made (including my english) and feel free to correct me/give me advice.
Click to expand...
Click to collapse
ok I am so lost. And here is the technical part (you don't need to read this, if you just want to extract your data):
that statement would make it appear easy. well the link only takes you to the code, there is no tool and nothing with "new" as header. so ive tried deciphering what to do for hours now and i cant figure npthing out. rooted and flashed my lgv20 and did a backup with lg bridge beforehand. trying to restore and phone connects to computer fine but doesnt regster in lg bridge so that is why i need to extract .lbf file. can someone make this easier?
hello..it ended up successful.but there is no jpeg or mp4 file on DCIM folder..how can i restore them?should i do somthing with the script? i don't know pyton

Categories

Resources