yashsingh1/xdaforums huggingface dataset:
[Android General] Mysak0CZ:
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

cd562f61-5399-3978-ac76-7c54b0508010

And they look like this:

<?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):

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:

<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.
[Android General] steadfasterX:
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
[Android General] crushdancexz:
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.
[Android General] Ninja_Toad:
Tried script on old backup, failed with error.

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?
[Android General] Mysak0CZ:
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)
[Android General] serlal:
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!
[Android General] tking2000:
Yes I have exactly same issue as you have. All exported files cannot be read.
[Android General] Mysak0CZ:
Hello [MENTION=10950711]tking2000[/MENTION] and [MENTION=4636436]serlal[/MENTION], 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)
[Android General] kamikazkid:
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?
[Android General] Mysak0CZ:
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: [MENTION=10889865]Ninja_Toad[/MENTION] [MENTION=4636436]serlal[/MENTION] and [MENTION=10950711]tking2000[/MENTION]

This was made possible thanks to [MENTION=941538]cheesyzombie[/MENTION] who sent me the data I asked for.

[MENTION=11026341]kamikazkid[/MENTION], 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.
[Android General] kamikazkid:
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.
[Android General] LuisP2020:
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
[Android General] LGAddict:
Is there a way to import the _DB files (contacts, messages, call logs etc.) back to a phone?

I asked before:

https://xdaforums.com/lg-g3/general/restore-backup-lbf-lineage-17-t4172483#post83644281
[Android General] Destroky:
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?
[Android General] tejassamel:
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.
[Android General] Leonard_Phan:
Hi [MENTION=9933697]Mysak0CZ[/MENTION], 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
[Android General] costy_95:
Problem in powershell

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
[Android General] watsinaname:
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!!
[Android General] alv09012013:
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?
[Android General] jabi_james:
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
[Windows Mobile Development and Hacking General] c@rL0$:
I have created several Diamiondish Accessories for you guys to use.

Startup Images

Comm Manager

PsShutXP Skin (QVGA Only)

HTC Home Profile Icons "Landscape Support"

These aren't perfect but it's something. So if you like it use it, or request something else and I'll try to make it

Startup Images

NEW

*Only use if your phone has a ROM which has Startup Image capabilities*

They are already made into PNG files, all you would need to do is rename them into the name already being used by your Startup Image.

Then copy it and place it into your \Windows Directory in your phone.

Now every time you restart your phone you will have a new custom Startup Image.

----------------------------------------------------------------------------------------------------------------------------------------------------------

Comm Manager

First Uninstall any custom Comm Manager.

Soft Reset your phone and then install the Cab I provided. Then soft reset once again.

For advanced users, you can change the type of functionality by going into the registry.

HKLM -- Software--HTC--CommManager

Remember there are only 6 available functions at one time.

----------------------------------------------------------------------------------------------------------------------------------------------------------

PsShutXP Skin

*You must have the PsShutXP program in order to use this*

All you would need to do is copy the files from the ZIP into the PsShutXP folder. This will override the original images, so make a back up if you want to use the previous images again.

----------------------------------------------------------------------------------------------------------------------------------------------------------

I can make other colors / modifications if I have time later on. I'm open for requests.

Enjoy
[Windows Mobile Development and Hacking General] c@rL0$:
Startup Images
[Windows Mobile Development and Hacking General] c@rL0$:
Comm Manager
[Windows Mobile Development and Hacking General] curtiskelowna:
looks very nice....however i think that all this diamond stuff is getting a bit over-used...but thats just me. looks good anyways
[Windows Mobile Development and Hacking General] c@rL0$:
HTC Touch Pro / Diamond Profile Icons for HTC Home

All you would need to do is extract the images from the ZIP and copy them to your respective HTC Home Icon Folder in your phone.
[Windows Mobile Development and Hacking General] DrForIslam:
common manager seems very nice
[Windows Mobile Development and Hacking General] nir36:
thanks for that carlos.
[Windows Mobile Development and Hacking General] lepsyfou:
thanks you carlos , :D
[Windows Mobile Development and Hacking General] smittyofdhs:
awesome, thanks for the cab carlos...
[Windows Mobile Development and Hacking General] l3v5y:
Nice!

Thanks for all these welcomeheads! :D
[Windows Mobile Development and Hacking General] nir36:
for some reason i get a message saying i don't have enough permissions to install the comm manager..
[Windows Mobile Development and Hacking General] c@rL0$:
Did you remove any other custom Comm Manager, or close out all programs especially Comm Manager?
[Windows Mobile Development and Hacking General] bluemetalaxe:
how to remove the buildin comm manager of a touch cruise ? Not possible i think ?
[Windows Mobile Development and Hacking General] c@rL0$:
If it's built in then you should be fine by just installing the CAB.

You only get a problem by trying to override a custom Comm Manager with another Cabed one.
[Windows Mobile Development and Hacking General] bluemetalaxe:
More noob :D questions because i had problems with diamond dialers/skins:

1. is this just replacing my "old" graphics or is this a complete application ?

2. and will the language change to english ?
[Windows Mobile Development and Hacking General] c@rL0$:
At this moment I don't recommend using the Diamond Dialers if you have Video Calling. None of those dialers support Video Calling.

But I will work on that later. The finished product will be a skin that will just replace the images on your phone.
[Windows Mobile Development and Hacking General] bluemetalaxe:
okay, thanks, and what about my questions about your commmanager ?
[Windows Mobile Development and Hacking General] c@rL0$:
If it's built into your ROM then all you would have to do is just install the CAB.
[Windows Mobile Development and Hacking General] stevefxp:
Theme

Is your Touch Pro theme ready for more widespread use? I actually like its look and would like to try it on my 6800.

Thanks,

Steve
[Windows Mobile Development and Hacking General] weatherboys:
"for some reason i get a message saying i don't have enough permissions to install the comm manager.."

I had the same problem. I had to do a soft reset before I could install this nice comm. manager
[Windows Mobile Development and Hacking General] tmz:
c@rLo$ , Is it possible to skin Pocket Digital Clock.With the diamond skin? That would be sweet.

Thanks T M Z
[Windows Mobile Development and Hacking General] ktaro:
Ktaro

thank you very gooooood:D
[Windows Mobile Development and Hacking General] jakub_w:
what is the registry entry for the beam function that you have in the example picture? i really need that button to be on my comm manager
[Windows Mobile Development and Hacking General] c@rL0$:
HKLM -- Software --HTC --CommManager

you got 0 - 9 options ( I do on mine )

Assign the functions that you want to your first 6 options. The rest wont work.
[Windows Mobile Development and Hacking General] jakub_w:
i only have 0-6. thats why im wondering what your option 5 is, for beam. what is the registry entry name?

EDIT: nevermind, i found it. it was option 6, which i switched to 5, i just took out wi-fi as my vogue doesnt have it. its called "Ir" incase anyone else wonders in the future
[Samsung Galaxy S9+ Questions & Answers] maysider:
Hi, please,

tried to flash (without wiping) to the latest stock 8 Oreo even with patched Odin but still stuck on "recovery" or "image" and have to cancel. Of course debugging on, everything acc to the manuals but it changes nothing with the phone, still "happily" working under A10.

Is it possible at all to get rid that crippled Android 10 Q or 9 P, will the newer boatloader allow that at all?
[Samsung Galaxy S9+ Questions & Answers] Jogg3r:
Unfortunately you can't go back to oreo due to higher Bootloader versions.
[Samsung Galaxy S9+ Questions & Answers] maysider:
really not a single way how to get rid of that crippled and incompetent Google Android 10, via root etc? :(
[Samsung Galaxy S9+ Questions & Answers] Jogg3r:
Maybe with root, but official no. That's why I'm still sticking with oreo.
[Samsung Galaxy S9+ Questions & Answers] elliwigy:
lol
[Samsung Galaxy S9+ Questions & Answers] maysider:
you lucky bast.... don't you want to change my "higher upgraded" phone for yours? :D
[Android Q&A, Help & Troubleshooting] galefabio:
Hello,

I need help, I uploaded the upload of an old version of TWRP to the tablet, but starting it doesn't allow me to do anything.

Get stuck on the home screen "Samsung galaxy tab s4"

It doesn't even allow me to go into download mode.

Error: "Set Warranty bit Recovery"

How can I do?
[Samsung Galaxy J7 (2017) Questions & Answers] teoskyr:
Hey all anyone have u6 compination file for the sm-j730f all i can found is compinations for u3 but not for the u6
[OnePlus 7 Pro Questions & Answers] Unknowx:
I NEED HELP URGENTLY!

I made a factory reset directly from the oxygen OS menu, he sent me back to TWRP and now at startup I am in Fastboot and I do not have to install the official ROM there, what should I do? Thx
[OnePlus 7 Pro Questions & Answers] SUPNYUS:
Hello,

Don't worry we will fix it :)

What is the exact model of your OnePlus 7 Pro ?
[Chromebooks] Marcopoloy13:
Hey

Lately I've bought a Chrome box after I have a Chromebook at school for a few moths and I liked it.

On my ARM Chromebook (MEDION S2015) I had no problems rooting the Android System and using AdAway and Titanbackup on it, but on my new Intel Acer Chromebox CXI3 I get errors I get error like:

cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory

chown: cannot access '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory

and on the end it says

ERROR: No running Android system found. Unable to patch sepolicy

I used this tutorial to root both devices:

https://nolirium.blogspot.com/2016/12/android-on-chrome-os-rooting-shell.html

What's wrong with it and how can I root the Android Image on my Intel Chrome OS device?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] pittaman:
No idea why, but my GF and I have the same Tilt. I used the same unlock and flash process for both phones. Was using one of Dutys roms, and now moved on to LV6 V9, and hers still locks up when IE opens... Mine runs fine.

ANy thoughts? I tried looking around for diffrent radios, but cant find a list anywhere...
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] shannoncole05:
And you're certain IE temp/cache files are not pointed to storage card?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] assembisa:
Switch to opera 9.5. The latest version is somewhere here in the forum. IE sucks. Wait a minute! here you go! A better browser by far.

http://xdaforums.com/showthread.php?t=404507
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] ibanyard:
HardSPL ?

Could be if you've previously applied HardSPL that you need to update to a newer version....

http://xdaforums.com/showthread.php?t=396922
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] scotchua:
I'd bet anything that post #2 is correct and you have your IE cache moved to the SD card which will cause your device to lock up.

Please don't start these kind of threads here. This is the Rom DEVELOPMENT thread, and as such issues such as IE locking up the phone should not be posted as new threads. This answer should have turned up that moving the cache to the SD card causes all knids of evil with IE. So in the future please obey the forum rules and SEARCH, read, and post in a preexisting thread first.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] pittaman:
Im all for following the rules, but the search on the forum is garbage... I dont know how that guy found the link so fast for radios... but I cant make use of the search here to save my life... I did a earch for radios... and unless he went digging through pages, a quitck new pst is MUCH faster...

Thanks for all the help, and I wil ltry to move the IE stuff back to the internal flash... first ive heard of that...

(I cant be the only one that has a hard time finding stuff on these boards....)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] kimtyson:
Not really a good excuse. Try the search in my sig if you need something better. You would have found this too if you had looked around first.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] pittaman:
And having to use an alternate search just to find things isn't odd to anyone here?

How was I supposed to know that the search sucked, and I needed to search for an alternate search so I could search for a solution to my issuie so the trolls don't hell at me?

Just saying the whole thing is kinda broken... why not just code your search method int the system?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] scotchua:
I'm not sure who you're calling a troll? Everyone who magically found the answer by looking has spent time learning how to structure their query correctly. It takes time ot learn how to narrow down what you're looking for. None of the people giving you advice didn't have to take the same time it would require of you to learn. If you don't like the rules, you don't have to use the site. Please just be respectful to the thousands of people who do, and follow the rules.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] austinsnyc:
search is good.................. yup