[Magisk] HippoMan:
I wrote a couple of scripts to (1) create a new PIF installation zip file which contains a new pif.json that is either directly supplied, or which it will generate from a directly supplied file containing build props; and (2) to quickly install the new PIF zip file and start using it.

I am attaching those scripts here ...

HOWEVER (!!!!!!!!!!!!!!!!) ...

PLEASE READ CAREFULLY! ...

I do not have much spare time to support this, and I may not be able to answer too many technical questions about the scripts. Please accept them "as is" and try to fix them yourself if they don't work.

Also, to keep this from escalating into a crazy clown show here in this thread, please only contact me about these scripts via private messages. I will generally ignore publicly posted questions about the technical details of these scripts. And please understand that unfortunately, I might not have time to give timely answers even to the private messages.

I'm very, very sorry, but I just don't have the time to support this properly.

Please just consider these as if they're just a couple of free scripts that you might have stumbled upon somewhere.

These scripts are both meant to run on the desktop computer, preferably a linux box. I already posted an initial version of the first script, and I have now slightly enhanced it. It's a python3 script called update-pif.py, and I've attached it here. The second script is a bash shell-script, and to run it on windows, you'll have to convert it to a *.bat file or maybe a powershell file.

To use the first script ...

python3 update-pif.py PIF-installation-zipfile new-zipfile-basename json-file-or-build-prop-file

where ...

PIF-installation-zipfile
the PIF installation file for the PIF module,
for example, PlayIntegrityFix_v13.9-osmod.zip
new-zipfile-basename
the base name of the new zipfile that will be created, without a .zip suffix.
for example, "newzip", which becomes the base name of "newzip.zip" that gets created
as the PIF installation file and which will contain the newly generated pif.json
json-file-or-buiild-prop-file
either a file which contains a build-prop list
in the format of what's generated by "adb shell buildprop",
or else an already generated pif.json file

The python3 program can determine whether the third argument is a json file or not. If it's json, it just gets used as is (with comment lines and blank lines removed). If it's a build prop file, it gets converted to a json file.

This json file gets named as "pif.json" and inserted into a new zip installation file that gets created based on the PIF-installation-zipfile, the first argument of the update-pif.py program. The zipfile that gets created will be [new-zipfile-basename].zip ... i.e., it's based on the second argument to update-pif.py

And also, the generated json file will get written to the same directory as [new-zipfile-basename].zip, and it will be named [new-zipfile-basename].json ... so that it can be viewed later for reference.

Given the example above, once the python3 program runs, two files will be created:

"newzip.zip" and "newzip.json". The first one is eligible to be flashed in Magisk, and the second one is simply for reference.

The second script, which I've also attached here, is called "install-pif.sh", and it's a shell script (bash) which runs the first script and then installs the resulting zipfile via adb into Magisk on the Android device. Therefore, to do a direct install of an obtained json file or build prop file, just do the following ...

bash install-pif.sh PIF-installation-zipfile json-file-or-build-prop-file

where the first argument is the same as the first argument described above for update-pif.py

and the second argument is the same as the third argument described above for update-pif.py

When running update-pif.py, this script generates a unique, random basename for the zipfile, and this is used as the second argument to update-pif.py when this script calls that python3 program.

This second script should be run when connected via USB to your Android device.

If there are no errors, the new zipfiile will get copied to the Android device, and the "magisk" command will be run to install it, and then the "com.google.android.gms.unstable" process will be killed, so that the newly installed PIF module will take effect without having to reboot the device.

Note that your device must be rooted, or else this won't work.

The new zip file which is created on your machine is treated like a temp file, and after it gets installed on your device via Magisk, it then gets deleted from your desktop machine ... although it remains on the /sdcard of the Android device.

And messages get written to stdout when the scripts are running, and so you can see the unique name of the PIF zip file and the new reference json file that get generated.

Again, if you want to change the semantics of either of these scripts or convert the second one to a *.bat or powershell file, please feel free to do so, since I don't have much time to support or maintain them myself.

Feel free to think of them as a starting point for someone else to develop something that is more general and more useful.

Given that XDA does not accept *.py files to be uploaded, the python3 file I uploaded here is called "update-pif.py.txt". After downloading, it should be renamed to "update-pif.py".