yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] ze7zez:
Do not use old versions of brotli.

Download at least version 1.0 from the google brotli release page.
[Android Software/Hacking General [Developers Only]] majinawaz:
[/COLOR]

its worked A lots of thnks brother :good:
[Android Software/Hacking General [Developers Only]] majinawaz:
Brother tell me one thing more i have korean s7 edge when i flash Aokp 8.0 rom every thing works fine but when i flash lineageos rom 8.0 there's noise in front speaker(call speaker) kindly guide me which folder/file can replace to solve this issue thanks in advance ?
[Android Software/Hacking General [Developers Only]] ze7zez:
It's not as you think, it's enough to replace files. Not the way.

This is not the place for further discussion about LineageOS.

It will be best if you describe everything in this forum thread, from which you get information about LineageOS for your Galaxy S7 Edge.
[Android Software/Hacking General [Developers Only]] mtkmanjaro:
[MENTION=5132229]xpirt[/MENTION] i tried to use your binary in android

1 I installed termux

2 downloaded Python from termux repo

3 copy system.new.dat and system.transfer.lits + sdat2img.py to data/local/temp

4 executed using (python sdat2img.py system.transfer.list system.new.dat system.img) I'm getting this error any idea

Attached picture to use the issue

Note using lineages 14.1
[Android Software/Hacking General [Developers Only]] Alexey71:
update https://xdaforums.com/showpost.php?p=57742855&postcount=42
[Android Software/Hacking General [Developers Only]] Q9Nap:
[MENTION=5132229]xpirt[/MENTION]

I've been using the sdat tools for awhile now, and I have a recommendation for improving img2sdat.py.

Because the script works with any sparsed ext4 image, and because there are often multiple sparsed ext4 images in a fastboot file, it would be useful if the filenames of the output files inherited the name of the input file.

For example:

img2sdat.py oem.img . 4 -> oem.new.dat oem.patch.dat oem.transfer.list

img2sdat.py NON-HLOS.bin . 4 -> NON-HLOS.new.dat NON-HLOS.patch.dat NON-HLOS.transfer.list

It is simple enough to rename the output files manually, but just throwing this out there.
[Android Software/Hacking General [Developers Only]] ST Dog:
It's also easy enough to write a script to do that or edit the python to suit your needs/desires.

Spend some time searching and I'll bet you could find enough examples to coble something together with even minimal prior programming/scripting skills.

In fact, if you started when you posted, you have been done before my reply.
[Android Software/Hacking General [Developers Only]] greeshan:
Why if i make wipe "system" from TWRP or from updater script [format("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "0", "/system");] and after try install my

system.new.dat

ROM i getting error 7? Even after wiping "system" i reboot TWRP, or unmount "system" in Mount menu, i always have error 7 when flash. BUT if i have worked installed ROM and flash my ROM without wipe "system" i dont have errors! Help me please, i need make system wipe before each install....

Log from TWRP with error 7:

Patching system image unconditionally...

Patching system image unconditionally...

performing update

package_extract_file took 00s.

package_extract_file took 00s.

blockimg version is 4

maximum stash entries 0

creating stash /cache/recovery/2bdd385042ggccf332c59f2228c33c25f7222524/

script aborted: E1001: Failed to update system image.

E1001: Failed to update system image.

error: 1001

cause: 101

device name: /dev/block/bootdevice/by-name/system

Filesystem volume name: <none>

Last mounted on: <not availabel>

Filesystem UUID: 57fas3bc-abf4-622f-bf62-946fc0he4t65b

Filesystem magic number: 0xEF53

Filesystem revision #: 1 (dynamic)

Filesystem flags: unsigned_directory_hash

Filesystem features: has_journal ext_attr resize_inode filetype extents sparse_super large_file gdt_csum

Default mount options: (none)

Filesystem state: clean

Errors behavior: Remount read-only

Filesystem os type: Linux

Inode count: 196608

Block count: 786432

Reserved block count: 0

Free blocks: 760647

Free inodes: 196597

First block: 0

Block size: 4096

Reserved GDT blocks: 191

Blocks per group: 32768

Inodes per group: 8192

Inode blocks per group: 512

Last mount time: Thu Jan 18 15:26:13 2018

Last write time: Thu Jan 18 15:26:13 2018

Mount count: 2

Maximum mount count: 10

Last checked: Thu Jan 1 04:00:00 1970

Check interval: 0 (<none>)

Lifetime writes: 9 GB

Reserved blocks uid: 0 (user root)

Reserved blocks gid: 0 (group root)

First inode: 11

Inode size: 256

Required extra isize: 28

Desired extra isize: 28

Journal inode: 8

Default directory hash: tea

Journal backup: inode blocks

Updater process ended with ERROR: 7

I:Legacy property environment disabled.

I:Install took 16 second(s).
[Android Software/Hacking General [Developers Only]] deprofeet:
I don't know whether this is a false positive or not, but with 38 out of 66 virus scanners flagging it as a virus, you may want to check your system or use a different compression tool for your .exe files...

https://www.virustotal.com/#/file/8...41ec4d8e53881ee29e79695df4d2bb3a0c5/detection

Other than that, thanks for a great tool! I've used the previous versions many times :)
[Android Software/Hacking General [Developers Only]] TimV_:
Thanks That worked but now I can't mount the .img :( and must I compress it again after i'm done doing my things?
[Android Software/Hacking General [Developers Only]] yusuo:
Awesome mate, really appreciate this approach, however after decompressing, editing on linux and recreating an img file using make_ext4 i am having trouble re-compressing back to system.new.dat. how can i change my newly created img file into a dat so I can reinject it back into the rom zip and flash it
[Android Software/Hacking General [Developers Only]] xpirt:
there is not a method yet to compress it in dat files.
[Android Software/Hacking General [Developers Only]] chauhansonu104:
How to repack it back to system.new.dat,plz help me i am at the ending stage of my rom
[Android Software/Hacking General [Developers Only]] xpirt:
? read the post above yours and don't quote the OP please.
[Android Software/Hacking General [Developers Only]] chauhansonu104:
then how are they able to build lollipop roms :confused:
[Android Software/Hacking General [Developers Only]] Martin_Ro:
got a malware warning from Windows defender on latest windows version...
[Android Software/Hacking General [Developers Only]] xpirt:
well if you don't trust even apps with source code I don't know what to say.

there are 2 ways though:

- compile python script by yourself

- don't use these binaries for your safety and skip this thread
[Android Software/Hacking General [Developers Only]] Elluel:
lol Windows Defender
[Android Software/Hacking General [Developers Only]] ericlnu:
Windows Defender is malware ... Even M$ says to use at the very least their Essentials package, but this is way off-topic now. To put it on topic, I'll say that since everyone can see the source code, everyone who can read and understand it can say with absolute certainty it's not malware.
[Android Software/Hacking General [Developers Only]] codelover:
Nah, don't blame Windows Defender, it's just doing it's job. It's the d-h.st fault that always mislead users to click the wrong button.

If you forgot to opt-out the 'Download Manager', doesn't matter which button you click you will end up downloading the malware.

Those new with internet and/or those who like to click fast will always be their victim.
[Android Software/Hacking General [Developers Only]] Martin_Ro:
I don't blame anyone but only informed you about that oddity.

But yes, I totally forgot that d-h.st misbehaviour regarding their download manager as I don't download there very often...
[Android Software/Hacking General [Developers Only]] ericlnu:
I failed to realise they had done something really not cool. Thanks for the tip.
[Android Software/Hacking General [Developers Only]] jez9999:
Damn, I clicked on the Windows link http://d-h.st/bEk and then clicked "Download", got this "sdat2img.exe.exe" and stupidly download and ran it. I cancelled out of the program as soon as I realized it was malware and disabled it starting up from msconfig, but what else do I need to do to remove it from my system?

Also, WTF is the OP doing hosting the file on this site? Put it on a site that doesn't serve up (or link to malware). I'm thinking of reporting the OP for that.
[Android Software/Hacking General [Developers Only]] howellzhu:
In my blog, a python package script was provided to pack system.img into system.new.dat.

Usage:

$ python img2sdat.zip [system.img] [output_dir]

The argument system.img is default set as system.img, can be omitted.

The argument output_dir is default set as otazip, can be omitted.

Big thanks to luxi78.

Please get the script at:

https://www.dropbox.com/s/ljn1q9eprf9l9fi/img2sdat.zip?dl=0

or

http://download.csdn.net/download/howellzhu/8375811

If you know Chinese :p, you can visit the blog for details at:

http://blog.csdn.net/howellzhu/article/details/42841191
[Android Software/Hacking General [Developers Only]] xpirt:
oh that's awesome! :)

i'll update the OP asap.
[Android Software/Hacking General [Developers Only]] jez9999:
How about updating the links to a hosting site that doesn't point to downloader malware? I *think* I have finally gotten rid of it off my machine... but it tried to put itself into startup. I had to disable it through msconfig.
[Android Software/Hacking General [Developers Only]] xpirt:
alright I'll change all download links to mega.co.nz
[Android Software/Hacking General [Developers Only]] puiatmp:
Be carefull

Hey guys.. dont install sdat2img. this have a vírus and your chrome ll stop to work...

Trying to clean the vírus at moment, uninstall the chrome and ll see what ll happeng when restart computer...

This create a entry on start folder of Windows too.... And edit your start page of iexplorer.

DONT INSTALL THIS !!!!!
[Android Software/Hacking General [Developers Only]] xpirt:
wow man, enough of this..

if you don't know how to download properly a file from a hosting website then really you have serious problems.. really I don't know why you are registered at xda ...

please do me a favor..

- read ALL posts of this thread

- learn how to download a file from dev-host (watch YouTube videos if necessary)

seriously.. dev-host is not the only website which has the option to download with its download manager.

and after this I hope you'll edit your post too.

cheers

edit: added also mirrors to mega.co.nz as promised.
[Android Software/Hacking General [Developers Only]] Alexey71:
upload new build, fixing
[Android Software/Hacking General [Developers Only]] mazenbs:
[emoji8]

تم الإرسال من SM-N920V باستخدام Tapatalk
[Android Software/Hacking General [Developers Only]] awab228:
noob question

Traceback (most recent call last):
File "img2sdat.py", line 12, in <module>
import common, blockimgdiff, sparse_img
ImportError: No module named 'common'

this what i get when i run :

img2sdat.py system.img

i used latest python 3 and also python 2.7

any help would be great , thanx
[Android Software/Hacking General [Developers Only]] xpirt:
you need all files from that repository
[Android Software/Hacking General [Developers Only]] awab228:
yes i figured that few minutes ago

thank you for your quick replay ,

sorry i am gonna ask again

img2sdat binary - version: 1.6

Traceback (most recent call last):
File "./img2sdat.py", line 89, in <module>
main(sys.argv)
File "./img2sdat.py", line 79, in main
image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0')
File "/mnt/c/simg/img2sdat/sparse_img.py", line 52, in __init__
raise ValueError("Magic should be 0xED26FF3A but is 0x%08X" % (magic,))
ValueError: Magic should be 0xED26FF3A but is 0x00000000

this is the new error now ,, is it because of the image ?

i used a tool to convert from system.img.ext4 to system.img
[Android Software/Hacking General [Developers Only]] xpirt:
you need to convert the ext4 image to android sparse format using img2simg binary (step 3).
[Android Software/Hacking General [Developers Only]] awab228:
i tried that before posting

thanx again for your replay ,,

i tired that before posting this is the error i get ,

img2simg system.img.ext4 system.img
img2simg: ../libsparse/sparse.c:144: write_all_blocks: Assertion `pad >= 0' failed.
Aborted (core dumped)

i used Imgextractor.exe to convert from img.ext4 to .img but i got the result in the above post , when i try to use img2simg it gives that error ,

i am not building from source and i am using WSL and Cygwin
[Android Software/Hacking General [Developers Only]] vagyula:
Could you update it to convert the vendor.new.dat also (for 8.1)?
[Android Software/Hacking General [Developers Only]] narshi shukla:
Can i unpack and then repack system.new.dat if i dont have file context bin and system.transler. List??

I wanna edit a rom which have just boot. Img system.new.dat meta inf and nothing else.
[Android Software/Hacking General [Developers Only]] zheshifandian:
I think you need to update this script.

And divide 7.x 8.0 8.1 into three parts.

I use this script to convert system.new.dat(MIUI based 8.0), but it can't boot

thanks for your work
[Android Software/Hacking General [Developers Only]] rkhat:
If anyone needs img2simg and/or make_ext4fs for Android Nougat or Android Oreo, check this new version I made. The link from OP supports up to Android 6 (Marshmallow) only.
[Android Software/Hacking General [Developers Only]] blackeangel:
a few fixes on working with parameters from me

https://github.com/blackeangel/img2sdat/tree/patch-1

Using: for example variants:

1. img2sdat.py system.img folder 3

2. img2sdat.py system.img 3

3. img2sdat.py system.img folder

4. img2sdat.py system.img

also corrected the names of the output files.
[Android Software/Hacking General [Developers Only]] Ultraworrior:
I Am Getting This Error On Ubuntu Terminal:

#############################################################

root@xperience-VirtualBox:/media/sf_VMSHARED# sudo mount -t ext4 -o loop system.img output/

mount: wrong fs type, bad option, bad superblock on /dev/loop0,

missing codepage or helper program, or other error

In some cases useful info is found in syslog - try

dmesg | tail or so.

root@xperience-VirtualBox:/media/sf_VMSHARED#

#############################################################
[Android Software/Hacking General [Developers Only]] blackeangel:
added autodetect version

https://github.com/blackeangel/img2sdat/tree/patch-1
[Android Software/Hacking General [Developers Only]] xiaowei666:
It isn't support android oero?

---------- Post added at 01:36 AM ---------- Previous post was at 01:31 AM ----------

I want to know it support android oero? I just want to Remediation miui rom
[Android Software/Hacking General [Developers Only]] blackeangel:
Yes.

If this in .new.dat format, but not .new.dat.br
[Android Software/Hacking General [Developers Only]] xiaowei666:
ok thank you
[Android Software/Hacking General [Developers Only]] Zackptg5:
You can use brotli to decompress .br files, then this tool for the rest
[Android Software/Hacking General [Developers Only]] JamFlux:
Good day [MENTION=5132229]xpirt[/MENTION].

Any update for android P, because it's not working with P images. Thanks.
[Android Software/Hacking General [Developers Only]] DIXES:
I can't extract system.new.dat successfully, it always shows these messages:

D:\tools>sdat2img.py system.transfer.list system.new.dat system.img

Usage: sdat2img.py <transfer_list> <system_new_file> [system_img]

<transfer_list>: transfer list file

<system_new_file>: system new dat file

[system_img]: output system image

Visit xda thread for more information.

Press ENTER to exit...
[Android Software/Hacking General [Developers Only]] Aqyx:
Hi, I'm wondering if there is a way to combine the decompressed (brotli) vendor.new.dat and system.new.dat into the system.img?
[Android Software/Hacking General [Developers Only]] blacknikname:
Sure. Use terminal commands. Search on XDA
[Android Software/Hacking General [Developers Only]] Aqyx:
I did search. I used terminal and brotil to decompress them, then used sdat2img with system.transfer.list and vendor.new.dat, but the resulting system.img will not mount (it will mount when using system.new.dat).

Maybe I'm searching wrong – vendor.new.dat didn't turn up anything relevant (other than this thread, which I hoped someone could point me in the right direction, or help in some way).

Cheers.
[Android Software/Hacking General [Developers Only]] blacknikname:
sorry, I am on phone

search in this direction - ./mkuserimg.sh -s system system.img ext4 /system 2324M file_contexts
[Android Software/Hacking General [Developers Only]] Aqyx:
Thank you, I will check it out!
[Android Software/Hacking General [Developers Only]] Nightmare_MYS:
can you see me ,I am a Chinese,I have some question

---------- Post added at 02:00 PM ---------- Previous post was at 01:52 PM ----------

Hi,I am Chinese,my English is so bad,I hope you can understand what I said,I use miui,when I use make_ext4fs build a new system.img,and I flash it,when I reboot my phone ,some application fc,and all of the software ICONS are missing.
[Android Software/Hacking General [Developers Only]] Ni1994:
i repack miui rom(cn) by your tools,i got the system.img, then flash it with fastboot mode, The phone is not turned on and is restarted to fastboot mode, so i remove the dm-verify from boot.img by magiskboot and flash boot.img. Now the phone can be turned on, but wifi does not work. Please tell me which step is wrong.sorry for my poor englsh. thanks！
[Android Software/Hacking General [Developers Only]] TyroSpy:
why result transfer.list many differenf and large than original?
[Android Software/Hacking General [Developers Only]] vdbhb59:
Any update for Pie, and separate /vendor (treble)?
[Android Software/Hacking General [Developers Only]] Atul Menon:
Sir i am getting an error

Showing bsdf is not valid

How to solve it Sir
[Android Software/Hacking General [Developers Only]] chiragkrishna:
even i am getting the exact same thing every time i try to extract,

python version 3.7.3

converted system.new.dat.br to system.new.dat using brotli

any clue whats happening??
[Android Software/Hacking General [Developers Only]] Vice.:
Where is the file "file_contexts" inside the zip of a rom ?.

for example, pixel_experience.zip for redmi note 6 pro:

install folder

Meta-INF folder

boot.img

system.new.dat.br

system.patch.dat

system.transfer.list

vendor.new.dat.br

vendor.patch.dat

vendor.transfer.list

= /
[Android Software/Hacking General [Developers Only]] palmbeach05:
File_contexts? This aint kitkat. Stop living in the past.
[Android Software/Hacking General [Developers Only]] Vice.:
I tell you that Miui's zips on android pie bring file_contexts.

but beyond that, my question comes because I want to repackage system.img and I need this file file_contexts. Moreover, in this same tutorial it indicates.
[Android Software/Hacking General [Developers Only]] Wahyu6070:
wahyu6070@wahyu6070-Lenovo-G40-30:~$ sudo chown -R wahyu6070:wahyu6070 /home/unpack/project/output
chown: cannot access '/home/unpack/project/output': No such file or directory

even though the file already exists
[Android Software/Hacking General [Developers Only]] CXZa:
Absolutely no idea, but files used would probably help...
[Android Software/Hacking General [Developers Only]] Wahyu6070:
# python2 img2sdat.py system.img
Traceback (most recent call last):
File "img2sdat.py", line 12, in <module>
import common, blockimgdiff, sparse_img
ImportError: No module named common

Termux android
[Android Software/Hacking General [Developers Only]] Wahyu6070:
root@wahyu6070:/home/wahyu6070/Downloads/tmp/bins/tool/img# sudo ./make_ext4fs -s -l 512M -a system my_new_system.ext4 system/ sudo umount sys rm -fr sys
sudo: ./make_ext4fs: command not found

??
[Android Software/Hacking General [Developers Only]] ST Dog:
the command make_ext4fs is not found in the current directory, /home/wahyu6070/Downloads/tmp/bins/tool/img

Or the executable bit isn't set.

Not surprising as I'd expect it to be in /bin or /sbin.
[Android Software/Hacking General [Developers Only]] ST Dog:
ls -l ?

What are the permissions?

Is that the executable or a symlink?

The original error still looked to be looking in the wrong place.
[Android Software/Hacking General [Developers Only]] Wahyu6070:
Permissions 777
[Android Software/Hacking General [Developers Only]] ST Dog:
So I'm not sure. I use the tools a few years ago and it worked.

Looking back at the first posts there's a download for make_ext4fs in with the python scripts. I'm sure that's what is supposed to be executed.
[Android Software/Hacking General [Developers Only]] Tyakrish:
Deleted
[Android Software/Hacking General [Developers Only]] paxar331:
I placed sdat2img.py in the same directory as system.new.dat.br:

https://i.imgur.com/5hJKw6M.png

Then I executed the following:

E:\HIS Documents\Computer guides\LG G7\Softwares\lineage\lineage zip extract>C:\
ProgramData\Python\python sdat2img.py system.transfer.list system.new.dat system
.img

Unfortunately no luck for me:

Android Nougat 7.x / Oreo 8.x detected!

Traceback (most recent call last):
File "sdat2img.py", line 143, in <module>
main(TRANSFER_LIST_FILE, NEW_DATA_FILE, OUTPUT_IMAGE_FILE)
File "sdat2img.py", line 92, in main
new_data_file = open(NEW_DATA_FILE, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'system.new.dat'

https://i.imgur.com/32tYXnL.png

I already made brotli was installed:

https://xdaforums.com/showpost.php?p=82038917&postcount=68

Edit: I had to manually specify the file extension, i.e. system.new.dat.br, instead of, system.new.dat

https://i.imgur.com/q2uNM73.png

https://i.imgur.com/GDW4pF7.png
[Android Software/Hacking General [Developers Only]] Creator54:
if anyone still trying to use this and having issues on linux

try this

https://github.com/Creator54/android-image-modifier

I created a bash script to simplify the process

just install the dependencies/requirements & proceed .
[Android Software/Hacking General [Developers Only]] BlueMan_86:
Is v3.6 Latest Version? And do you have github or post just only for this script so i can follow?

Thanks for your work...
[Android Software/Hacking General [Developers Only]] ura513:
is there img2dat.py converted to img2dat.exe?
[Android Software/Hacking General [Developers Only]] VBabbar:
I will try these softwares to extract .dat files but isn't there any ANDROID APP WHICH CAN do this?
[Android Software/Hacking General [Developers Only]] dgm_mixtoon:
hello bro, with your tool i can delete magisk from pre-rooted rom.zip?
[Android Software/Hacking General [Developers Only]] palmbeach05:
Well magisk is systemless, so you need to focus on the boot.img. if you do it right, the answer is yes
[Android Software/Hacking General [Developers Only]] dgm_mixtoon:
Unroot forever! Use an image of the same version of android (boot.img) I'm happy, I'm testing it, what consequences can that bring? Is what I did wrong?

by the way I managed to unpack the rooted .img file and I see several folders with magisk, if I delete them and repackage it working?

sorry I'm a newbie at this
[Android Software/Hacking General [Developers Only]] MPK99:
@xpirt Hello sir, I'm getting this issue where I get ioctl & lseek64 errors. I'm trying to repack it for Android 11 images.
[Android Software/Hacking General [Developers Only]] MPK99:
I understood I got this problem....

The roms I built sparsed such that it's transfer.list got corrupt. I had to dd a raw image from system partition through adb shell & convert it again into sparse to make it work...
[Android Software/Hacking General [Developers Only]] Neil_Armstrong_:
Do you guys know how to convert the three system files to a valid system.img ?

talking bout these 3 :

system.new.dat

system.patch.dat

system.transfer.list
[Android Software/Hacking General [Developers Only]] ForForkSake:
python3 sdat2img.py system.transfer.list system.new.dat.br system.img
or
python3 sdat2img.py system.transfer.list system.new.dat system.img

ignore the patch file

sdat2img.py source