I've seen other post, so I thought I should share this with anyone who may be interested.
This script is based on "Adblock script" by Adrian Jon Kriel, http://lifehacker.com/5060053/set-up-universal-ad-blocking-through-your-router
This will only work on rooted phone.
Download: adblock.sh
or copy-n-paste source code below
Code:
#!/bin/sh
## Adblock script for G1
## By Jason Driver
## firestrife23(at)gmail(dot)com
## Version 1.1
## May 19 2009
##
## This script is based on "Adblock script" by Adrian Jon Kriel,
## http://lifehacker.com/5060053/set-up-universal-ad-blocking-through-your-routerr
##
## This script is free: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Required AD Blocklist
eval MVPSSOURCE="1" ## default 1
eval PGLSOURCE="1" ## default 1
## Extra AD Blocklist, Extremist Only
## HUGE FILE!! your G1 may experience performance hit!!
eval HSFSOURCE="0" ## default 0
eval HFPSOURCE="0" ## default 0
## DO NOT EDIT BELOW, UNLESS YOU KNOW WHAT YOU'RE DOING!!!!
eval GENFILE="hosts"
eval MVPSOURCEFILE="http://www.mvps.org/winhelp2002/hosts.txt"
eval PGLSOURCEFILE="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts"
eval HSFSOURCEFILE="http://www.it-mate.co.uk/downloads/hosts.txt"
eval HFPSOURCEFILE="http://hostsfile.mine.nu/Hosts"
echo "ADBLOCK: Testing for Internet Connection..."
if ping -c 1 yahoo.com > /dev/null; then
echo "ADBLOCK: Success"
eval GOTSOURCE="0"
echo "" > $GENFILE
## download
if [ "$MVPSSOURCE" = "1" ] ; then
if wget -q $MVPSOURCEFILE -O - >> $GENFILE ; then
echo "ADBLOCK: Downloaded MVPS Source"
eval GOTSOURCE="1"
else
echo "ADBLOCK: Failed to download MVPS Source"
fi
fi
if [ "$PGLSOURCE" = "1" ] ; then
if wget -q $PGLSOURCEFILE -O - >> $GENFILE ; then
echo "ADBLOCK: Downloaded [email protected] Source"
eval GOTSOURCE="1"
else
echo "ADBLOCK: Failed to download [email protected] Source"
fi
fi
if [ "$HSFSOURCE" = "1" ] ; then
if wget -q $HSFSOURCEFILE -O - >> $GENFILE ; then
echo "ADBLOCK: Downloaded I.T. Mate Group Source"
eval GOTSOURCE="1"
else
echo "ADBLOCK: Failed to download I.T. Mate Group Source"
fi
fi
if [ "$HFPSOURCE" = "1" ] ; then
if wget -q $HFPSOURCEFILE -O - >> $GENFILE ; then
echo "ADBLOCK: Downloaded Hosts File Project Source"
eval GOTSOURCE="1"
else
echo "ADBLOCK: Failed to download Host File Project Source"
fi
fi
echo "ADBLOCK: Adding Mobile Ads to blocklist"
echo '127.0.0.1 p.admob.com' >> $GENFILE
echo '127.0.0.1 analytics.admob.com' >> $GENFILE
echo '127.0.0.1 r.admob.com' >> $GENFILE
if [ "$GOTSOURCE" = "1" ]; then
echo "ADBLOCK: Got Source Files"
echo "ADBLOCK: Stripping Source Files"
sed -i -e '/^[0-9A-Za-z]/!d' $GENFILE
sed -i -e '/%/d' $GENFILE
sed -i -e 's/[[:cntrl:][:blank:]]//g' $GENFILE
sed -i -e 's/^[ \t]*//;s/[ \t]*$//' $GENFILE
echo "ADBLOCK: Sanitize, and Optimising"
sed -i -e 's/[[:space:]]*\[.*$//' $GENFILE
sed -i -e 's/[[:space:]]*\].*$//' $GENFILE
sed -i -e '/[[:space:]]*#.*$/ s/[[:space:]]*#.*$//' $GENFILE
sed -i -e '/^$/d' $GENFILE
sed -i -e 's/127.0.0.1/127.0.0.1 /g' $GENFILE
sed -i -e 's/www.//g' $GENFILE
echo "ADBLOCK: Removing Duplicates (Resource Friendly)"
cat $GENFILE | sort -u > $GENFILE.new
mv $GENFILE.new $GENFILE
## including important informations
sed -i -e '1i127.0.0.1 localhost' $GENFILE
sed -i -e '2i##' $GENFILE
sed -i -e '3i##-----------------------------------------' $GENFILE
sed -i -e '4i## Generated by Adblock script v1.1 ' $GENFILE
sed -i -e '5i##-----------------------------------------' $GENFILE
sed -i -e '6i##' $GENFILE
## removing last line (garbage)
sed -i -e '$d' $GENFILE
## info section
echo "ADBLOCK: Unique Hosts Blocked" $(awk 'END { print NR-6 }' $GENFILE)
else
echo "ADBLOCK: Error Files Not Downloaded"
fi
else
echo "ADBLOCK: Error No Internet"
fi
## replacing old hosts with new hosts file
echo "ADBLOCK: Remounting /system to read-write"
mount -o remount,rw /dev/block/mtdblock3 /system
rm /system/etc/hosts
cp /sdcard/hosts /system/etc/hosts
echo "ADBLOCK: Updated Hosts"
echo "ADBLOCK: Remounting /system to read-only"
mount -o remount,ro /dev/block/mtdblock3 /system
rm $GENFILE
be sure to place this script at root level of sdcard
Example:
Code:
/sdcard/adblock.sh
Open terminal emulator and excute as following.
Code:
$ su
# cd /sdcard
# sh adblock.sh
I Hope you find this useful. Enjoy!
Just wondering, is this all your own shell code? Looks awfully similar to one I used on my router -- variable names and all.
Either way -- good post. Just wondering since you posted it with GPL and all
Edit: Ah, here is the script I previously used and thought it reminded me of; "Adblock script" by Adrian Jon Kriel, http://lifehacker.com/5060053/set-up-universal-ad-blocking-through-your-router
yes you're right. Mostly is borrowed from tomato firmware forums (can't remember where), however their script is meant for dnsmasq, and I revised this to work with hosts file.
EDIT: Saw your source link, the reason I GPL'ed this script to prevent anyone else taking credit for Adrain Jon Kriel's work, I'll revision first post to give him proper credit thanks for link.
firestrife23 said:
yes you're right. Mostly is borrowed from tomato firmware forums, however their script is meant for dnsmasq, and I revised this to work with hosts file.
Click to expand...
Click to collapse
Ahh, just wondering -- good work with it. Though I'd assume the original other (no matter how much you edited it) would like a little credit on it too
how/why is this better than the app? doesn't it do the same thing?
Lieu10ant said:
how/why is this better than the app? doesn't it do the same thing?
Click to expand...
Click to collapse
It does the same as app, however my script is only 4.3kb.
Basically it combine multiple hosts source into single hosts file by clean up garbage such as ^M (MS-DOS end of line) which can be quite problematic for linux/unix in general (yes Android is Linux), and trimmed down to much smaller file size by removing comments, duplications, and finally sort everything by 0-9 and A-Z order to speed up hosts look up.
Does this need to be rerun on any sort of schedule? Or will it take care of looking for new address to add to the hosts file?
Love this script, thanks for sharing!
nice work!
way to condense this down to nearly nothing. Quick question, does this autoupdate? Do I have to run this from time to time to update the hosts its blocking?
Thanks!
No it does not auto update, you can just rerun the script yourself.
autoupdate
so then, how could we force this to run at boot so Android will always be adfree? Could we add a line to userinit.sh?
innerspace said:
so then, how could we force this to run at boot so Android will always be adfree? Could we add a line to userinit.sh?
Click to expand...
Click to collapse
I have my doubts that the internet connection is live until phone is fully booted. And it certainly is not if you have SIM card pin enabled.
We have 3 options from where I sit.
We can add it to the userinit.sh (or user.conf) file(s) and perhaps set it up with a delay (since most of our internet won't be on right when the phone is booting) ie sleep 120 like from this post.
We can use Autostart from the Market.
We can just run the script manually.
Thanks, works nice.
(nice name above me )
I keep getting an error, it can't connect to any of the sites to download the files... like it says 'bad address' and then 'error files not downloaded'
Can someone please help me?
I am running JACHero v1.4
I'm pretty sure I'm trying this wrong.
I used the autostart app and created a .sh file (I'll post the content at the end of this) and the corresponding directory in data.
I started the phone and got a SU permission request (which I expected). But I don't know if the script ran right.
BTW I created this script using notepad in XP. Probably not the smartest choice, but I really don't know what I'm doing and figured I'd give it a shot.
Here is the content of the .sh file I created:
--------------------------------------
setPriorityLater()
{
# sleep for 2 minutes
sleep 120
# phone and all processes should surely by up by now
su
cd /sdcard
sh adblock.sh
}
setPriorityLater > /dev/null 2>&1 &
-----------------------------------------
I copied the text of the script from http://forum.xda-developers.com/showpost.php?p=4355721&postcount=78 and inserted the commands to run this script.
Be honest, I screwed it up didn't I?
Couldn't you just use Gscript and run it every so often?
Gilliland12 said:
I'm pretty sure I'm trying this wrong.
I used the autostart app and created a .sh file (I'll post the content at the end of this) and the corresponding directory in data.
I started the phone and got a SU permission request (which I expected). But I don't know if the script ran right.
BTW I created this script using notepad in XP. Probably not the smartest choice, but I really don't know what I'm doing and figured I'd give it a shot.
Here is the content of the .sh file I created:
--------------------------------------
setPriorityLater()
{
# sleep for 2 minutes
sleep 120
# phone and all processes should surely by up by now
su
cd /sdcard
sh adblock.sh
}
setPriorityLater > /dev/null 2>&1 &
-----------------------------------------
I copied the text of the script from http://forum.xda-developers.com/showpost.php?p=4355721&postcount=78 and inserted the commands to run this script.
Be honest, I screwed it up didn't I?
Click to expand...
Click to collapse
It's recommended to use notepad++. Trust me. It's much better than notepad.
cannot create hosts
C:\Documents and Settings\Administrator\Desktop>adb shell
# sh /sdcard/adblock.sh
sh /sdcard/adblock.sh
ADBLOCK: Testing for Internet Connection...
ADBLOCK: Success
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Failed to download MVPS Source
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Failed to download [email protected] Source
ADBLOCK: Adding Mobile Ads to blocklist
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Error Files Not Downloaded
ADBLOCK: Remounting /system to read-write
rm: cannot remove '/system/etc/hosts': No such file or directory
cp: cannot stat '/sdcard/hosts': No such file or directory
ADBLOCK: Updated Hosts
ADBLOCK: Remounting /system to read-only
rm: cannot remove 'hosts': No such file or directory
#
Binary100100 said:
C:\Documents and Settings\Administrator\Desktop>adb shell
# sh /sdcard/adblock.sh
sh /sdcard/adblock.sh
ADBLOCK: Testing for Internet Connection...
ADBLOCK: Success
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Failed to download MVPS Source
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Failed to download [email protected] Source
ADBLOCK: Adding Mobile Ads to blocklist
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
/sdcard/adblock.sh: cannot create hosts: read-only file system
ADBLOCK: Error Files Not Downloaded
ADBLOCK: Remounting /system to read-write
rm: cannot remove '/system/etc/hosts': No such file or directory
cp: cannot stat '/sdcard/hosts': No such file or directory
ADBLOCK: Updated Hosts
ADBLOCK: Remounting /system to read-only
rm: cannot remove 'hosts': No such file or directory
#
Click to expand...
Click to collapse
I had the same problem, thn i moved:
Code:
echo "ADBLOCK: Remounting /system to read-write"
mount -o remount,rw /dev/block/mtdblock3 /system
at the beginning of the script, and now it works fine
Hey people,
today i wanted to share a post from chenxiaolong, who did some awesome work back at the Galaxy Tab S2 forum. The main problem, was that Netflix didn't want to play HD content on the Galay Tab S2, which was why I researched the requirements of Netflix. They need Widevine L1 implemented on the SoC to allow HD playback. While this is the necessary requirement, Netflix also needs to enable this device in their device list and tell the app it supports Widevine DRM L1. In many cases they don't do that although the device itself would be very capable of displaying HD content. Tried it out on my Galaxy Tab S2 and on the Nexus 5, which both support Widevine DRM L1 and aren't/weren't marked as WV L1 capable. To check DRM capability of your device you can use for example this app https://play.google.com/store/apps/details?id=com.androidfung.drminfo&hl=en
This will not make a non WV L1 capable device run Netflix HD, it will only make the device use the most secure DRM technology!
The whole process doesn't need root, just some tools like apktool, apk-signer and such. Feel free to link the post into your device forum you achieved to get Netflix HD on.
Big Thanks goes out to @chenxiaolong
Link to thread post: http://forum.xda-developers.com/showpost.php?p=65001865&postcount=12
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
It currently works on version up to 5.12.xxx, it doesn't seem to work on more recent versions, we will have probably to wait for a new version of apktool (2.4.0 ?).
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching method 1"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching method 2"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Perfect! It works for me on Medion Tablet. It also enables download offline mode. Tanks.
It doesn´t work for me...I get an error when tryng to reproduce movies
Hi!
Is it possible that this trick doesn't work anymore or doesn't work on all devices? I patched the current Netflix APK (and verified that the changes were made using apktool) but I only get 720p at best. There was also an error message along the lines of "content not allowed in prolog"?
I'm using one of those generic AmLogic S912 boxes ("X92 Smart Box" with the white clock display thing in the front) which supports L3 but neither Netflix nor Prime Video stream 1080p.
GuillaumeBarberousse said:
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
apktool d -r -f "${1}" -o "${TMPOUT}"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' ${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali
apktool b ${TMPOUT}
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf $TMPOUT
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Click to expand...
Click to collapse
Im sorry but with these informations I don't know exactly if and how it will work out for my galaxy s5. Can I use a app on my mobile to sign the backuped Netflix app? Or do I need to sign the apk on my PC?
T0mfield said:
Im sorry but with these informations I don't know exactly if and how it will work out for my galaxy s5. Can I use a app on my mobile to sign the backuped Netflix app? Or do I need to sign the apk on my PC?
Click to expand...
Click to collapse
These are instructions for Linux. What I have done:
1. download Ubuntu from Windows 10 Store
2. open powershell as admin and type:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
3. reboot when prompted
4. open command line and type:
ubuntu
5. create user/password as prompted
6. type:
sudo apt-get upgrade
Then follow the instructions from post #1. I've got my netflix apk from apkmirror: https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=netflix
You can access the windows filesystem by /mnt/c/
The script worked fine for me with Netflix 5.9.0 build 24858 and my Nexus 10.
The modification was not working anymore on my tablet (Samsung Galaxy Tab A6 SM-T580) giving me an error 0013 and it is now working again, I don't know why (I upgraded firmware to last version T580XXU2BQI9 / T580XEF2BQI9, or maybe Netflix changed something on their servers).
It is tested and working on Netflix apk 5.8.0_build_24642 and 5.9.0_build_24858 with apktool 2.2.1-dirty (Ubuntu 17.04 version), 2.2.3 and 2.3.0
I edited post https://forum.xda-developers.com/showpost.php?p=72178861&postcount=2, it should now work with old and new version of APK, (tested with version 5.11.1_build_25432)
GuillaumeBarberousse said:
I edited post https://forum.xda-developers.com/showpost.php?p=72178861&postcount=2, it should now work with old and new version of APK, (tested with version 5.11.1_build_25432)
Click to expand...
Click to collapse
I'm getting this error:
Code:
sed: can't read /tmp/tmpdir.netflixpatch.1QU3FdHrJ4/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali: No such file or directory
Also, you've changed the keystore value in the script code but not in the signature code.
Also, it didn't work with 5.11.2. Getting an error 5.2. Not sure if it's because it genuinely doesn't work anymore or because I didn't do it correctly on account of the error. Might I add that I'm using a virtual machine, if it makes a difference.
Also, why is there an L before com/?
vleesevlons said:
Also, you've changed the keystore value in the script code but not in the signature code.
Also, it didn't work with 5.11.2. Getting an error 5.2. Not sure if it's because it genuinely doesn't work anymore or because I didn't do it correctly on account of the error. Might I add that I'm using a virtual machine, if it makes a difference.
Also, why is there an L before com/?
Click to expand...
Click to collapse
Thank you, I edited the script to correct keystore path.
The error you were getting was normal, I was trying to patch file for old versions and new versions of netflix apk, I changed the script to prevent the file error message.
I don't know why you've got error 5.2, I had it for some times then it worked again, after uninstalling official apk and reinstalling patched one, maybe something in the cache of the tablet. I tried many version of apktool too, but it doesn't seem related.
For the virtual machine, it shouldn't affect the patching process.
And for the L before com, I don't know, it is smali language, probably to indicate a string value.
GuillaumeBarberousse said:
Thank you, I edited the script to correct keystore path.
The error you were getting was normal, I was trying to patch file for old versions and new versions of netflix apk, I changed the script to prevent the file error message.
I don't know why you've got error 5.2, I had it for some times then it worked again, after uninstalling official apk and reinstalling patched one, maybe something in the cache of the tablet. I tried many version of apktool too, but it doesn't seem related.
For the virtual machine, it shouldn't affect the patching process.
And for the L before com, I don't know, it is smali language, probably to indicate a string value.
Click to expand...
Click to collapse
I have a Nexus 5 (2013).
I've installed DRMinfo to confirm that I have WV L1 and it says it does.
I've been experimenting with liboemcrypto.so, i.e. deleting it or renaming it, and that does get rid of the error 5.2.
However, it appears that if the .so file differs from how a liboemcrypto.so should be, then Netflix will not do the DRM check and it will just give you SD quality.
So, I'm at a loss there...
What build worked for you? I've tried 5.11.2 build 25441 and 5.11.1 build 25432
vleesevlons said:
I have a Nexus 5 (2013).
I've installed DRMinfo to confirm that I have WV L1 and it says it does.
I've been experimenting with liboemcrypto.so, i.e. deleting it or renaming it, and that does get rid of the error 5.2.
However, it appears that if the .so file differs from how a liboemcrypto.so should be, then Netflix will not do the DRM check and it will just give you SD quality.
So, I'm at a loss there...
What build worked for you? I've tried 5.11.2 build 25441 and 5.11.1 build 25432
Click to expand...
Click to collapse
In my understanding, but I'm not sure, if you remove liboemcrypto.so, you lose Widevine level 1, so Netflix won't even try to play HD, so no error 5.2. I tried and got HD by patching 5.11.2_build_25441 and 5.11.1_build_25432.
Thanks for this guide. For me this missed a few instructions, like how to run a script on a file
So this are the steps nessesary to compleat this process:
1. Do everything from OP till it says to run a script on a file
2. For ease name your script netflixpatch and file com.netflix.mediaclient_4.16.1.apk
3. Open terminal in a place where you saved netflix app and this script
4. In terminal type: chmod u+x netflixpatch
5. Then run this script on apk by typing in terminal: ./netflixpatch com.netflix.mediaclient_4.16.1.apk (with ./ in front)
6. If all went you will see new file in your directory, thats the modified app
Now. For me, and I had apk v .12.2 build 25768 this trick seems to not work. I still have video looking like 720
Im on OnePlus 5T (capable of widevine lv.1) and stock rom.
Do I have nessesary libery I don't really know yet.
Need to investigate more but at least I have modified apk now so thanks for that
EDIT: Thers no liboemcrypto.so in /system/vendor/lib/ so that's probably the issue here ...
anybody knows that this code founds with Android TV netflix apk ?
GuillaumeBarberousse said:
Based on this, I made a script on Ubuntu to patch last version of netflix APK.
First, you need to install some packages
Code:
sudo apt-get install apktool zipalign default-jdk
Then, you have to build you own signature (to do only once)
Code:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore "${HOME}/.netflix.keystore" -storepass android -keyalg RSA -sigalg SHA1withRSA -dname "CN=Android Debug,O=Android,C=US" -validity 9999
Then, download last netflix APK, for instance from apkmirror, and execute this script on downloaded file (for instance "netflixpatch com.netflix.mediaclient_4.16.1.apk" if your script is named "netflixpatch")
Code:
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching old version"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching new version"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
You'll get a "com.netflix.mediaclient_4.16.1-patched-signed-zipaligned.apk" file, which will play HD content if your device has Widevine DRM L1 libraries, even if not whitelisted by Netflix.
Click to expand...
Click to collapse
------------------------------------------
anyone try to apply this patch and upload to mega to try if this patch found in Mi box Tv
Problems with the script Helpme
[email protected]:/mnt/c/Users/crist/Downloads/netflix# ./net.sh com.netflix.ninja_5.0.4_build_1965.apk
./net.sh: line 2: $'\r': command not found
./net.sh: line 14: syntax error near unexpected token `elif'
'/net.sh: line 14: `elif [ -f "${FILENEW}" ];then
anybody could helme ... I copy this script :
-------------------------------------------------------------
#!/bin/bash
NAME=$(basename "${1}" .apk)
KEYSTORE="${HOME}/.netflix.keystore"
TMPOUT=$(mktemp -d /tmp/tmpdir.netflixpatch.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }
FILEOLD="${TMPOUT}/smali/com/netflix/mediaclient/service/webclient/model/leafs/DeviceConfigData.smali"
FILENEW="${TMPOUT}/smali/com/netflix/mediaclient/service/configuration/DeviceConfiguration.smali"
apktool d -r -f "${1}" -o "${TMPOUT}"
if [ -f "${FILEOLD}" ];then
echo "Patching old version"
sed -i 's/iget-boolean v0, p0, Lcom\/netflix\/mediaclient\/service\/webclient\/model\/leafs\/DeviceConfigData;->enableWidevineL1:Z/const\/4 v0, 0x1/g' "${FILEOLD}"
elif [ -f "${FILENEW}" ];then
echo "Patching new version"
sed -i '/isWidevineL1Enabled/c\ const\/4 v0, 0x1\n return v0' "${FILENEW}"
else
echo "File to patch not found !"
rm -rf "${TMPOUT}"
exit 1
fi
# /usr/local/bin/apktool b "${TMPOUT}"
apktool b "${TMPOUT}"
jarsigner -keystore "${KEYSTORE}" -storepass android -keypass android -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT -signedjar "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${TMPOUT}/dist/${NAME}.apk" androiddebugkey
zipalign -f 4 "${TMPOUT}/dist/${NAME}-patched-signed.apk" "${NAME}-patched-signed-zipaligned.apk"
rm -rf "${TMPOUT}"
-----------------------------------
Don't copy and paste the script into terminal. Create a new file and past this to it then set permission on file and run the script
yes I did that
Friend I Did that. I was copy the script and paste in a white document and save has .sh when I try to execute make me that error . Please help me
Tried the script. First had to get Ubuntu. So I did:
enable Hyper-V, load Ubuntu 16.4.3-server-x64 (so no GUI) on Generation 1
ran the apt-get install commands provided by OP
Code:
[email protected]:~$ ./netflixpatch com.netflix.mediaclient_5.13.0_build_25824.apk
03:21:52 up 17 min, 2 users, load average: 0.05, 0.07, 0.07
USER TTY FROM [email protected] IDLE JCPU PCPU WHAT
sebas tty1 03:04 13:17 0.05s 0.05s -bash
sebas pts/0 192.168.178.72 03:09 0.00s 0.07s 0.00s w
I: Using Apktool 2.0.2-dirty on com.netflix.mediaclient_5.13.0_build_25824.apk
I: Copying raw resources...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
Patching old version
Script is running BUT I do not see the output created. Old file has an unmodified timestamp. Any thoughts on how to troubleshoot this?
Recent versions of the Netflix app (starting with 5.13.0) are permanently crashing after being processed. At least on my devices. So you can stop working on the current version or take a 5.12.x release.
See: https://forum.xda-developers.com/showpost.php?p=75479828&postcount=136
How do i make this tool by: Ryuinferno Windows Sign Em v2-0
[TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error
[TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error Sign-em! v2.0 Hi all! As we know, making zip files is a must no matter when we want to flash a new ROM, theme, mods and so on...but at times we need to sign...
forum.xda-developers.com
Work with the new apksigner.jar file which on windows has to be used through the apksigner bat file?
The batch script in the tool from Ryuinferno is this:
@Echo off
COLOR 70
title "Sign-em! 2.0"
ECHO.
ECHO Sign-em! v2.0 by Ryuinferno @ XDA 2013
ECHO.
ECHO This script signs multiple zip files automatically...
ECHO.
ECHO **REMINDER!!! Do not leave spaces when you name your zip files...**
ECHO.
FOR %%A in (.\Input\*.zip) do (
ECHO Signing - %%~nA.zip
java -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\Output\%%~nA-signed.zip
)
FOR %%A in (.\Output\*.zip) do (
ECHO Calculating md5 checksum
.\Tools\md5sums.exe -u %%A >> ./Output/md5.txt
)
ECHO.
ECHO Files signed successfully if no errors above...
ECHO.
ECHO Hope you enjoyed my work...
ECHO Ryuinferno @ XDA 2013
ECHO.
pause
peter1miller2 said:
How do i make this tool by: Ryuinferno Windows Sign Em v2-0
[TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error
[TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error Sign-em! v2.0 Hi all! As we know, making zip files is a must no matter when we want to flash a new ROM, theme, mods and so on...but at times we need to sign...
forum.xda-developers.com
Work with the new apksigner.jar file which on windows has to be used through the apksigner bat file?
Click to expand...
Click to collapse
To execute a .JAR-file on Windows, you need to install Java on your system. Go to Java Download Page and install it.
I am not asking how to execute a JAR file. I am asking how to make the Apk Signer sign all files in a folder like this tool does with the older zip signer.
If you do not have OpenSSL installed on Windows machine, download and install it. You need OpenSSL to create a private key and a corresponding public key, which act as your digital signature.
On elevated Windows command prompt enter the following commands to generate a new private key and a corresponding public key for yourself:
Code:
openssl genrsa -out key.pem 1024
openssl req -new -key key.pem -out request.pem
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
In Windows you create a folder named ZipSignerTool with 4 subfolders named InFiles & OutFiles & Tools & Keys.
In subfolder InFiles you place all the .ZIP-files what should get signed.
In subfolder Tools you place the Java executable named signapk.jar.
In subfolder Keys you place the 2 files you generated by means of OpenSSL as shown above.
You create a Windows batch-file in folder ZipSignerTool named ZipSigner.bat ( or whatever ) that does the job:
Code:
@echo off & setlocal
pushd "%~dp0"
set "InFiles=%CD%\Infiles"
set "OutFiles=%CD%\OutFiles"
set "Signer=%CD%\Tools\signapk.jar"
set "Keys=%CD%\Keys"
for /F %%a in ('dir %InFiles%\*.zip /B') do (
set "ZIP=%%a"
if NOT "?%ZIP%"=="?" (
java -jar %Signer% %Keys%\certificate.pem %Keys%\key.pk8 %ZIP% %OutFiles%\signed-%ZIP%
)
)
popd
endlocal & @echo on & exit
jwoegerbauer said:
If you do not have OpenSSL installed on Windows machine, download and install it. You need OpenSSL to create a private key and a corresponding public key, which act as your digital signature.
On elevated Windows command prompt enter the following commands to generate a new private key and a corresponding public key for yourself:
Code:
openssl genrsa -out key.pem 1024
openssl req -new -key key.pem -out request.pem
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
In Windows you create a folder named ZipSignerTool with 4 subfolders named InFiles & OutFiles & Tools & Keys.
In subfolder InFiles you place all the .ZIP-files what should get signed.
In subfolder Tools you place the Java executable named signapk.jar.
In subfolder Keys you place the 2 files you generated by means of OpenSSL as shown above.
You create a Windows batch-file in folder ZipSignerTool named ZipSigner.bat ( or whatever ) that does the job:
Code:
@echo off & setlocal
pushd "%~dp0"
set "InFiles=%CD%\Infiles"
set "OutFiles=%CD%\OutFiles"
set "Signer=%CD%\Tools\signapk.jar"
set "Keys=%CD%\Keys"
for /F %%a in ('dir %InFiles%\*.zip /B') do (
set "ZIP=%%a"
if NOT "?%ZIP%"=="?" (
java -jar %Signer% %Keys%\certificate.pem %Keys%\key.pk8 %ZIP% %OutFiles%\signed-%ZIP%
)
)
popd
endlocal & @echo on & exit
Click to expand...
Click to collapse
Thank you very much for your answer. I am sure it would work. Thought since i completely failed to explain the real problem i have. it is currently not working for me. I hope i explained the problem better in my new post here: https://forum.xda-developers.com/t/how-can-i-batch-sign-zip-files-on-windows.4361871/ and thank you again wery much for the answer.
I'm trying to start a web server on my LAN, but there are some problems. Can't set Default Charset to UTF-8 on my site or enable .htaccess for setting it. Tried adding AddDefaultCharset UTF-8 to the end of apache's httpd.conf file, without success,my phone is rooted, this is not so important for the question itself.
Bellow are the codes that I run from scratch at Termux:
apt update && yes | apt upgrade && yes | pkg install autoconf automake bison bzip2 clang cmake coreutils diffutils flex gawk git grep gzip libtool make patch perl sed silversearcher-ag tar apache2 php php-apache
ln -s /data/data/com.termux/files/usr/etc/ ~/etc
touch ~/etc/apache2/extra/php-module.conf
Then the changes made to httpd.conf:
LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so without # at start
LoadModule rewrite_module libexec/apache2/mod_rewrite.so without # at start
New lines added
LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so
AddHandler cgi-script .cgi
AddHandler php-script .php
At end = Include etc/apache2/extra/php-module.conf
Is something else missing?
My site has problems with accents, invalid characters appear, so I need to change the charset!
Devmobdroid said:
I'm trying to start a web server on my LAN, but there are some problems. Can't set Default Charset to UTF-8 on my site or enable .htaccess for setting it. Tried adding AddDefaultCharset UTF-8 to the end of apache's httpd.conf file, without success,my phone is rooted, this is not so important for the question itself.
Bellow are the codes that I run from scratch at Termux:
apt update && yes | apt upgrade && yes | pkg install autoconf automake bison bzip2 clang cmake coreutils diffutils flex gawk git grep gzip libtool make patch perl sed silversearcher-ag tar apache2 php php-apache
ln -s /data/data/com.termux/files/usr/etc/ ~/etc
touch ~/etc/apache2/extra/php-module.conf
Then the changes made to httpd.conf:
LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so without # at start
LoadModule rewrite_module libexec/apache2/mod_rewrite.so without # at start
New lines added
LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so
AddHandler cgi-script .cgi
AddHandler php-script .php
At end = Include etc/apache2/extra/php-module.conf
Is something else missing?
My site has problems with accents, invalid characters appear, so I need to change the charset!
Click to expand...
Click to collapse
KSWEB is one approach. Has all the binaries and libs needed, and comes preconfigured. Check your messages....