yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] STreeTNerD:
Hey [MENTION=962182]rayman[/MENTION]. By any chance this tool will have a restore feature. Other similar tools for older devices have it. Thanks for this tool. Grate work.
[Sony Cross-Device General] D1kiy:
On Xperia M5 works great! Thank you!
[Sony Cross-Device General] garikay:
On my Xperia XA Ultra Dual (F3212) It works great! Thank you! I did backupTA already twice successfully restored.
[Sony Cross-Device General] STreeTNerD:
How do you restore the img? Been looking but there's no tutorial on it. Thanks any help would be nice.
[Sony Cross-Device General] garikay:
I did only on my device F3212. On other devices I do not know, because I do not know where the TA in them. In my device tutorial I wrote here: http://xdaforums.com/showpost.php?p=70214474&postcount=176 Sorry me for my English, but many have to write through Google translator.

---------- Post added at 02:24 PM ---------- Previous post was at 02:11 PM ----------

It is important not to reboot the system! Just need to flash the stock firmware with wipe and without marking MiscTA.
[Sony Cross-Device General] Viqsi:
Appears to work just fine on my Z2 Tablet (Verizon edition SGP561, firmware build number 23.4.B.0.319) running on MacOS 10.11.6. Of course, the bootloader can't presently be unlocked on that particular tablet (damn you, Verizon!) and I've not subsequently tried a restore, but the image was pulled and it matched the expected size in bytes, so that's encouraging info. :)

$ ./backupTA.sh
Running on SGP561 on 32-bit platform
Pushing files
764 KB/s (13644 bytes in 0.017s)
1205 KB/s (5364 bytes in 0.004s)
1810 KB/s (9512 bytes in 0.005s)
482 KB/s (5416 bytes in 0.010s)
1239 KB/s (5364 bytes in 0.004s)
220 KB/s (1094 bytes in 0.004s)
Running scripts to dump ta to "TA_SGP561_CB5127UWSE_20161226-1759.img" on device
Overwriting run-as
Attempting to dirtycow
Done dirtycowing
Overwriting secondary payload (screenrecord)
Attempting to dirtycow
Done dirtycowing
Reading dumpta from stdin...
Read dumpta from stdin at 5416 bytes
Attempting exploit with buf of length 5416
Attempting to dirtycow
Attempting to dirtycow
Attempting to dirtycow
Done dirtycowing
Waiting for result....
Bad reply received, failing...
Attempting exploit with buf of length 5416
Attempting to dirtycow
Attempting to dirtycow
Attempting to dirtycow
Done dirtycowing
Waiting for result....
Got a total of 2097152 bytes
Exploit successful!
Dumped TA as TA_SGP561_CB5127UWSE_20161226-1759.img
adler32:0x4946B704 calc_adler32:0x4946B704
adler32:0x14BC2187 calc_adler32:0x14BC2187
adler32:0x46D764AB calc_adler32:0x46D764AB
adler32:0xECEB9165 calc_adler32:0xECEB9165
Trim area dump is valid.
Pulling image
3804 KB/s (2097152 bytes in 0.538s)
Cleaning up
TA Sucessfully pulled to TA_SGP561_CB5127UWSE_20161226-1759.img
****NOTE: Please verify filesize is 2MB ****

$ ls -l TA_SGP561_CB5127UWSE_20161226-1759.img
-rw-r--r-- 1 *** ***** 2097152 Dec 26 12:59 TA_SGP561_CB5127UWSE_20161226-1759.img
[Sony Cross-Device General] FATMANCHAN:
Hi rayman, my is F8332. May I know what drivers I need to install and anything I need to do on the mobile in order to backup TA. I have tried, but it was negative and could not detect the mobile. And I have installed flashtool, from it, it said ADB n fastboot is not installed. However, I did installed the mini ADB n fastboot already. Please help. Thanks a lot
[Sony Cross-Device General] YoLO13:
Hi mate!

I had a similar problem to you and it took me forever to find out what to do, so here's what I did!

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

INSTALLING SONY XPERIA XZ DRIVERS, ADB & FASTBOOT:

==================================================

1) Download the following things:

- (a) Xperia XZ Drivers [Xperia_XZ_drivers.zip]:

http://developer.sonymobile.com/downloads/drivers/

- (b) ADB and Fastboot Easy Install [adb-setup-1.3.exe]:

http://xdaforums.com/showthread.php?t=2588979

- (c) SONY Drivers for Fastboot [downloadinf_v1.01.zip]:

http://developer.sonymobile.com/downloads/drivers/fastboot-driver/

2) Installing Xperia XZ Drivers

- Open 'Device Manager'

- Add legacy hardware

- Browse to the location of Xperia XZ Drivers (a)

- Install signed drivers

3) Enabling USB Debugging on Xperia XZ

- Turn on the phone and enable USB Debugging via Dev. Options

- Turn off phone completely

4) Connecting via Fastboot

- Press VOLUME UP key and connect usb to the PC

- Blue LED indicates Fastboot mode connected

- In Device Manager, update drivers using the following steps:

- Locate 'Sony sa0115' in the list, and click on update drivers

- Browse for driver software and link to SONY Drivers for Fastboot (c)

- Then 'Pick from a list of device drivers on my computer' and locate 'Sony sa0115'

- Install drivers

5) Install ADB, Fastboot and Drivers

- Locate ADB and Fastboot Easy Install (b) and install

- Select [Y] for everything and install Google USB Drivers

- Done!

6) Verifying Fastboot Status

- Connect phone via Fastboot and type:

>> fastboot devices << via directory terminal

- Entry for phone should be listed

7) Connecting via ADB

- Power on the phone and type:

>> adb devices << via directory terminal

- ADB access prompt should be seen on-screen on the PHONE (RSA Keys) --> allow access and ADB now works on phone

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

That's what I had to do for the Xperia XZ F8831 - should be the same for the F8832 perhaps? But DOUBLE CHECK that please!

Btw, that was for Windows 10 - SHOULD be the same for Windows 7, 8 & 8.1

Good luck!
[Sony Cross-Device General] L1K3AB055UK:
Will this work for Xperia E5 F3311?
[Sony Cross-Device General] Licaon_Kter:
That depends, did you update to 37.0.A.2.156 already?

This exploit was fixed in newer versions, so what security date do you have in About device?
[Sony Cross-Device General] Nojus33:
deleted
[Sony Cross-Device General] FATMANCHAN:
Hi YoLO13,

Thanks a lot. I Tried, but step4 could not be done it said please confirm if the driver is 64bit or not.

And please advise where I shd put the backup TA in order to run?

Thanks again
[Sony Cross-Device General] FATMANCHAN:
finally, it seems successfully backup TA.

XZ dual F8332 os 6.0.1 MM 39.0..1.250

quoted

Picking 64-bit version

Running on F8332 on 64-bit platform

Pushing files

Pushing files/dirtycow64 to /data/local/tmp/dirtycow

886 KB/s (9984 bytes in 0.011s)

Pushing files/run-as64 to /data/local/tmp/run-as

660 KB/s (6088 bytes in 0.009s)

Pushing files/exploitta64 to /data/local/tmp/exploitta

820 KB/s (14280 bytes in 0.017s)

Pushing files/dumpta64 to /data/local/tmp/dumpta

765 KB/s (10184 bytes in 0.013s)

Pushing files/checkta64 to /data/local/tmp/checkta

994 KB/s (10184 bytes in 0.010s)

pushing push files/backupTA.sh /data/local/tmp/backupTA.sh

118 KB/s (1094 bytes in 0.009s)

Running scripts to dump ta to "TA_F8332_CB512CHKVY_31122016-週六22.img" on devic

e

Overwriting run-as

Attempting to dirtycow

Done dirtycowing

Overwriting secondary payload (screenrecord)

Attempting to dirtycow

Attempting to dirtycow

Done dirtycowing

Reading dumpta from stdin...

Read dumpta from stdin at 10184 bytes

Attempting exploit with buf of length 10184

Attempting to dirtycow

Attempting to dirtycow

Attempting to dirtycow

Attempting to dirtycow

Done dirtycowing

Waiting for result....

Got a total of 2097152 bytes

Exploit successful!

Dumped TA as TA_F8332_CB512CHKVY_31122016-週六22.img

adler32:0x3634A345 calc_adler32:0x3634A345

adler32:0x993B7B37 calc_adler32:0x993B7B37

adler32:0xF695E6A6 calc_adler32:0xF695E6A6

adler32:0xAD5358EA calc_adler32:0xAD5358EA

Trim area dump is valid.

Pulling image

1108 KB/s (2097152 bytes in 1.848s)

Cleaning up

TA Successfully pulled to TA_F8332_CB512CHKVY_31122016-週六22.img

unquoted

please advise if it is OK.

thanks all help.
[Sony Cross-Device General] YoLO13:
Hi there, based on what I see, I believe it's been pulled successfully! I'm glad the drivers worked - sorry I didn't see your message till now!

It appears the file is of the correct size, but just double check this with the file in the directory to make sure it's actually 2,097,152 bytes!

Take care!
[Sony Cross-Device General] FATMANCHAN:
shd be....

i found the actual file size from property

it is 2.00 MB (2,097,152 bytes)

but it was strange the size shown on file manager is 2048KB
[Sony Cross-Device General] YoLO13:
2048 KB is 2.00 MB --> this is a bit difficult for me to describe but bytes are based on a logarithmic system where the base is 2.

This will explain why you see memory listed as: 1GB = 1024 MB as 2^10 = 1024 MB... so that equates to 1GB..

Now, anyone who has better knowledge than me is free to correct me but based on what I know, that's what I understand the conversions to be!
[Sony Cross-Device General] Licaon_Kter:
2,097,152~=2048KB~=2.00 MB ;)

It's ok, size wise that is.
[Sony Cross-Device General] rayman:
I have no plans to do this, but there's nothing really preventing it.

However, due to the way dirtycow works, it's simply not possible to reliably fit the code for both dumping and restoring in a single binary, so it would need a separate set of tools (With a lot of shared code) to work.

Perhaps someone else will do it when I release source soon :)

The main reason I find it a bit useless is the fact that it requires a dirtycow-able ROM to restore then, which means restoring while on 7.x will be impossible...
[Sony Cross-Device General] djandrea:
i have all stock rom and TA img file , how to restore ta backup on xperia xz? thanks
[Sony Cross-Device General] wzhy:
Xperia X Performance on Android 6.01 fw 35.0.A.1.297 test OK!

I have run the script several times and compare them with hex.

Only some boot logcat is different and the others are the same!

All files is 2097152 bytes
[Sony Cross-Device General] wzhy:
FIDO_KEYS: Provisioned on screenshot is in LB or UB?
[Sony Cross-Device General] serajr:
UB
[Sony Cross-Device General] anrydisappear:
Hi to all and Happy new year,strange but i can't make backup on my drm keys.My phone is xperia z2 and bootloader not locked,also no root,firmware is 17.1.1.A.0.402(4.4.2).So what i've done:

*connect phone in usbmode-mtp(before i check debugging in settings on my phone)

*run backupTA as administartor

*result=0

I tried severals times but without success
[Sony Cross-Device General] Licaon_Kter:
You can't do this if you already UNLOCKED your bootloader.

This is for LOCKED bootloader.
[Sony Cross-Device General] anrydisappear:
Opss my mistake about bootloader,it's locked man,for that reason i post here my problem
[Sony Cross-Device General] Klaus N.:
It could be possible that this tool doesn't work with Android 4.4.2. I'd suggest to update to the latest Z2 fw (23.5.A.1.291) and give it another try.
[Sony Cross-Device General] anrydisappear:
Ok.Thanks for the suggestion,i will try and post here.

keepyourself
[Sony Cross-Device General] Licaon_Kter:
This works on 6.0.1 or Nougat.
[Sony Cross-Device General] anrydisappear:
Yes,with the last update i can get drm keys

?
[Sony Cross-Device General] wzhy:
Thanks a lot
[Sony Cross-Device General] PRO>KOMP.<:
Thanks, works perfect!
[Sony Cross-Device General] Mazellat:
I had a Backup TA.img file which 2MB. How can I restore it and must I stock rom to restore?
[Sony Cross-Device General] SamBamBim:
I unlocked bootloader flashed recovery did as said and after restart my device going to bootloop :(

4096+0 records in
4096+0 records out
2097152 bytes (2.0MB) copied, 0.142371 seconds, 14.0MB/s

Edit:

Never mind, I got it to work to restore TA.img and update from device. Will be waiting for a working xposed for pokemon, untill then no root for me.
[Sony Cross-Device General] TimeIsAll:
Will this work with the Z5 Premium?
[Sony Cross-Device General] Licaon_Kter:
It should.
[Sony Cross-Device General] cioce:
Many thanks for this tool, work perfect on Z5 Compact (E5823) fw 32.2.A.5.11 with November security patch.

A TA_Restore.bat and some clear instruction about how to restore in the first message of this topic will be appreciated :)
[Sony Cross-Device General] MixEcoSystem:
Thanks :) Worked on my Z5c E5803 build 32.2.A.0.305.
[Sony Cross-Device General] 88%:
HI, I'm not really very good at all with the command line and so I'm sure I've made a pretty basic mistake here. I was hoping someone could point me in the right direction.

I've got adb working (tested by running the "devices" command).

I extracted the folder backupTA_v2 to my platform-tools folder, then navigated to the backupTA_v2 folder and ran backupTA.sh. But I get repeated "command not found" errors.

Can anyone figure out what I'm doing wrong here?
[Sony Cross-Device General] Licaon_Kter:
just do:

cat backupTA.sh

And execute those commands by hand, one after another (except echo)
[Sony Cross-Device General] garikay:
Try first

chmod -R 777 /your folder TA backup/*

Then

./backupTA.sh
[Sony Cross-Device General] bam80:
[MENTION=962182]rayman[/MENTION], thanks for the exploit.

Can the same technique be used to get access to /data ?

Could you share the source code?
[Sony Cross-Device General] lebigmac:
Thanks rayman.

It looks like it worked like a charm.
[Sony Cross-Device General] mhaha:
The (Windows) script v2 fails on Windows Traditional Chinese systems, and possibly other non-latin locale versions.

Suspecting the %DateNtime% as the culprit, which outputs Chinese characters as part of the date/time, I removed this variable from line 16 and was able to successfully complete the operation.

Log from original script:
[Sony Cross-Device General] tempurastyle:
Is the adb command to flash back the TA the same for the X Compact?

So as far as I understand, the only step to Re-lock the bootloader is to flash back the TA backup?
[Sony Cross-Device General] shoey63:
It's the same for all Sony devices. But rayman has since posted that this thread should be about backing up only. Restoring is a separate subject.
[Sony Cross-Device General] lebigmac:
Hi. I followed all of your steps and everything was working fine until I performed this command

adb shell dd if=/data/local/tmp/TAbackup.img of=/dev/block/bootdevice/by-name/TA

The command execution was successful and I don't get this notification anymore upon bootup:

your device has been unlocked and can't be trusted

But now when I turn on the phone it says:

To start Android , enter your password.

I don't know the password...

Before performing the aforementioned command I was able to get into TWRP just fine (I remember I swiped to allow modifications to the system partition)

Now when I try to boot into recovery mode (by holding power and volume down buttons) I get an error saying:

Your device has failed verification and will not work properly

Then the phone turns off.

I did not root it yet. I did however get a root adb shell when performing that aforementioned command while in recovery mode.

I can't get into recovery or adb but fastboot mode still works.

EDIT: OK I temporarily fixed my problem by entering the wrong password a bunch of times at the prompt until it performed a factory reset.

EDIT #2: I still get the "Your device has failed verification and will not work properly" error when trying to boot into TWRP. Looks like I'll have to repeat the procedure. This time I will leave the system partition as read-only in TWRP. Hopefully it will work.
[Sony Cross-Device General] chawlasrijan:
Just use flashtool & reflash the ftf. Your error will be gone.
[Sony Cross-Device General] lebigmac:
Hi. Do you mean this error ? I still get this error. I didn't set pattern, PIN or password yet.

To start Android , enter your password.
[Sony Cross-Device General] shoey63:
Why do you need to restore TA? Selling the phone? Unlock your bootloader again and flash a kernel with DRM fix or make your own. https://xdaforums.com/showthread.php?p=64990566
[Sony Cross-Device General] M1chiel:
I think that after bootloader unlock all data are to be wiped. I read on another thread that if you fill in a wrong password more than 15 times or so, the device does a factory reset and you can enter the phone. Did not try it myself though.
[Sony Cross-Device General] bautista0069@gmail.com:
hi sir

[MENTION=4675598]shoey63[/MENTION] hi sir can you help me to find MM ftf file for f8332 or can you provide me a link thanks and gob bless :)
[Sony Cross-Device General] shoey63:
This type of question is totally OT for this thread. Please ask Here
[Sony Cross-Device General] notabene:
Could you please providesome instructions how to restore? I did backup and need to restore now. Thanks
[Sony Cross-Device General] nathan30:
Hi,

First of all, thanks for the sharing of this success !

I have to restore my TAbackup, because I have battery problem and I have to send it for reparation.

What is the exact procedure ? Do I have to reflash a stock ROM via FlashTool ? Do I have to flash a MM ? How can I relock bootloader after ?

The command line you gave, is the one pushing the backuped TA img ?

Last question, you push the TAbackup.img via adb (in your computer) while in TWRP ?

Thanks in advance :)
[Sony Cross-Device General] shoey63:
One way is to push with adb from PC while in TWRP recovery.

adb push TAbackup.img /data/local/tmp/TAbackup.img

then

adb shell dd if=/data/local/tmp/TAbackup.img of=/dev/block/bootdevice/by-name/TA

Then power off and flash a stock rom. LP, MM, N - doesn't matter. Your bootloader will be re-locked and TA partition restored as if the device was never unlocked.
[Sony Cross-Device General] nathan30:
Thanks for your quick answer! :)

I could do it even if I am under a custom ROM (existenz actually) ? If I didn't reboot after I guess

And bootloader will be locked again by his own after the flash of latest ROM through flashtool ?

EDIT : After testing your command, can I use it to complete the guide I wrote (https://xdaforums.com/xperia-xz/how-to/how-to-unlock-bl-kernel-twrp-root-t3541648) ? With quoting you of course
[Sony Cross-Device General] shoey63:
Bootloader lock state is independent of the rom. Just restore TA and flash pure stock before you reboot. And yes, you can share this method. There are others, but this BACKUP thread is being spammed enough.
[Sony Cross-Device General] 88%:
Thanks so much for your help. Sorry for the delay in my reply, but I wanted to have the time to try this 8 different ways before asking for more help.

I tried your suggestion, but it didn't seem to work for me.

Here's what I did:

extracted Google's platform-tools folder to ~/Downloads

extracted backupTA_v2 to ~/Downloads/platform-tools/

In terminal I ran

cd /Users/me/Downloads/platform-tools

then

./adb devices

This returns a device ID

I then ran

chmod -R 777 /Users/me/Downloads/platform-tools/backupTA_v2/*

then

cd /Users/me/Downloads/platform-tools/backupTA_v2

then

./backupTA.sh

After this I get the following:

./backupTA.sh: line 3: adb: command not found
./backupTA.sh: line 4: adb: command not found
./backupTA.sh: line 5: adb: command not found
Running on on 32-bit platform
Pushing files
./backupTA.sh: line 16: adb: command not found
./backupTA.sh: line 17: adb: command not found
./backupTA.sh: line 16: adb: command not found
./backupTA.sh: line 17: adb: command not found
./backupTA.sh: line 16: adb: command not found
./backupTA.sh: line 17: adb: command not found
./backupTA.sh: line 16: adb: command not found
./backupTA.sh: line 17: adb: command not found
./backupTA.sh: line 16: adb: command not found
./backupTA.sh: line 17: adb: command not found
./backupTA.sh: line 19: adb: command not found
./backupTA.sh: line 20: adb: command not found
Running scripts to dump ta to "TA___20170210-0928.img" on device
./backupTA.sh: line 24: adb: command not found
Pulling image
./backupTA.sh: line 26: adb: command not found
Cleaning up
./backupTA.sh: line 28: adb: command not found
TA Backup Failed!! Please reboot and try again.
NOTE: If you are running Android Nougat, you need to downgrade to use this tool.

I've got no idea what I'm doing wrong here. I've even tried to do these steps on a clean install as admin, but I'm still getting the same error.

---------- Post added at 02:40 AM ---------- Previous post was at 02:35 AM ----------

This is a bit too much for me. Running the cat command gives me information that I simply don't understand. I think it might be time for me to take a Unix course.

Thanks so much for trying to help.
[Sony Cross-Device General] Licaon_Kter:
It's not information, it just commands, the ones that the script tries to run, you just copy/paste them one by one...

BUT

adb: command not found

means you did something else wrong, where is your adb located?
[Sony Cross-Device General] garikay:
You need

cd /Users/me/Downloads/platform-tools

then

./adb devices

- This returns a device ID. Then Open the folder where there are script backupTA.sh and run terminal from this folder. Promt

./backupTA.sh

Done. I can not understand what you're doing.
[Sony Cross-Device General] Licaon_Kter:
S/he is missing ADB from paths, so backup.sh needs to be unpacked where adb is in /Users/me/Downloads/platform-tools
[Sony Cross-Device General] Keij0:
You're lucky that Sony got the kernel wrong, because if they wrote the SELinux rules well, you'd have bad day. Some devices can't be rooted with dirtycow AFAIK
[Sony Cross-Device General] yannik~:
Hey [MENTION=962182]rayman[/MENTION], can you publish the source of this on github? I would like to use it, but prefer to build my own software. Thanks alot!
[Sony Cross-Device General] Sajad Askari:
Hi ...

How To Restore ?
[Sony Cross-Device General] 88%:
Thanks so much for your help with this.

After reading your post and doing some further poking around, I think this has something to do with the fact that I haven't installed adb properly. I'd been under the impression that if I got my device identifier working that I adb had been installed the right way, but it looks like I'm going to need to set up some symlinks before it works properly.
[Sony Cross-Device General] M1chiel:
Post #20: https://xdaforums.com/crossdevice-d...-ta-backup-t3514236/post69972315#post69972315
[Sony Cross-Device General] ajaychaudhary07:
Thanks :)

Looking for this from quite a long time.

successfully backed up TA for My Xperia Z3 Dual.

I have checked the size its 2MB.

Do I need to do anything else to verify the Valid TA backup?
[Sony Cross-Device General] rayman:
It's just dirtycow, so kind of? It doesn't need anything nearly as complicated as this to merely access data.

The sourcecode is now out.
[Sony Cross-Device General] rayman:
It's not necessarily the easiest thing to build, but the source is now released (https://github.com/EnJens/backupTA)
[Sony Cross-Device General] yannik~:
Can you perhaps add a few lines on how to build this? Thanks so much so far for releasing the source!
[Sony Cross-Device General] U-StaSS:
Hi.

It DON'T work on Xperia M4 Aqua E2303

I'm receiving file with length=0.

2 executables can't run - see log. Phone is pre-rooted.

Picking 64-bit version
Running on E2303 on 64-bit platform
Pushing files
Pushing files/dirtycow64 to /data/local/tmp/dirtycow
Pushing files/run-as64 to /data/local/tmp/run-as
Pushing files/exploitta64 to /data/local/tmp/exploitta
Pushing files/dumpta64 to /data/local/tmp/dumpta
Pushing files/checkta64 to /data/local/tmp/checkta
pushing push files/backupTA.sh /data/local/tmp/backupTA.sh
Running scripts to dump ta to "TA_E2303_YT911BP5XP_19022017-1907.img" on device
Overwriting run-as

Attempting to dirtycow

Done dirtycowing

Overwriting secondary payload (screenrecord)

Attempting to dirtycow

Attempting to dirtycow

Done dirtycowing

CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "/system/bin/run-as" (built with --hash-style=gnu?)

Dumped TA as TA_E2303_YT911BP5XP_19022017-1907.img

CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "/data/local/tmp/checkta" (built with --hash-style=gnu?)

Pulling image
Cleaning up
TA Successfully pulled to TA_E2303_YT911BP5XP_19022017-1907.img