[UTIL] signapk.sh: onboard .apk signing. 100% java-free - G1 Android Development

Since I tend to modify roms before flashing them to my phone, and sometimes want to do so away from a computer, I ended up writing this. It's an ash script that uses the openssl binary found on most custom roms, and infozip. The sdk test/platform/media/etc keys are included. Usage:
Usage: signapk (options) [command] (files)
commands:
sign FILE sign a .zip or .apk
sign FILE1 FILE2 create a signed copy of FILE1 as FILE2
cert FILE(s) print cert info on FILE's signer
certinfo FILE print detailed cert info on FILE's signer
cmp FILE compare signer of FILE with default/selected cert
cmp FILE1 FILE2 compare signer of FILE1 to signer of FILE2
options:
-k, --key FILE key to sign with
-c, --cert FILE cert to sign with
if -c or -k are not files then they are considered
aliases to builtins (ie -k testkey or -c platform)
-f, --force sign even if cert differs from original
-t, --tmp DIR use DIR for tempdir instead of '/cache'
-d, --debug output debugging
-V, --version print 'signapk v0.3.1'
exit codes:
1: read error (file 1) 2: read error (file 2)
3: write error 4: ssl error
5: zip write error 9: key error
8: sign: cert mismatch 10: cmp: cert mismatch
128: script error 255: user error
Installation:
unpack somewhere. If needed, edit the variables at the top of the script. By default it uses /cache/ for 4 small temporary files.
Faq:
* Why did you include a busybox and openssl? * Some roms don't include the openssl utility. Busybox's unzip refuses to deal with zipaligned apks on alot of roms, because it wasn't compiled with ENABLE_DESKTOP. Busybox's ash is missing things that the script needs, on some roms. The script will use whatever the rom provides, if these binaries are not present. Good luck.
* How do I change the cert? * see signapk --help for cert/key selection flags
* Can I use this in my MarketAppThingy? * Sure, and please let me know. If it's a paid MarketAppThingy, consider sending me a free copy.
Changelog:
release 3: cmp function, key selection, documented exit codes that make sense, and paranoia. Includes trimmed down busybox and openssl binaries. If these are present, script will reload itself to run in it's busybox ash interpreter to avoid broken busybox compiles, and can run without using anything provided by the rom. In theory this means no compatibility issues, but is limited to ARM devices.
release 2: Apparently it's valid to have ANYNAME.SF/ANYNAME.RSA or ANYNAME.DSA. signapk cert and certinfo now handles this. The sign function will blindly write to CERT.SF and CERT.RSA as this is the behavior of the standard SignApk.java. This may be fixed later.
If you don't wanna signup to download attachment, snag this from http://code.google.com/p/signapk/downloads/list

very, very useful. I'm testing this now Signing stuff was always way too complicated.

Cool. Can't wait for someone to make a market app that creates a simple ui to edit update.zips before flashing. Hint hint

I put the files in /system/signapk (new folder)
When i run the script I get the error below. The test file is an unsigned apk exported from eclipse.
Code:
# ./signapk sign /sdcard/unsigned.apk
./signapk sign /sdcard/unsigned.apk
Checksumming /mnt/sdcard/unsigned.apk:
res/layout/main.xml AndroidManifest.xml
resources.arsc res/drawable-hdpi/icon.png res/drawable-ldpi/icon.png res/drawable-mdpi/icon.png classes.dex
[COLOR="Red"]unable to write 'random state'
./signapk: line 132: ./signapk.zip: not found[/COLOR]
#
Any idea what needs changing to fix this?
update: When I used the full path it worked.
Code:
# /system/signapk/signapk sign /sdcard/unsigned.apk
/system/signapk/signapk sign /sdcard/unsigned.apk
Checksumming /mnt/sdcard/unsigned.apk:
res/layout/main.xml AndroidManifest.xml
resources.arsc res/drawable-hdpi/icon.png res/drawable-ldpi/icon.png res/drawable-mdpi/icon.png classes.dex
unable to write 'random state'
adding: META-INF/MANIFEST.MF (deflated 49%)
adding: META-INF/CERT.SF (deflated 48%)
adding: META-INF/CERT.RSA (deflated 33%)
# /system/signapk/signapk cert /sdcard/unsigned.apk
/system/signapk/signapk cert /sdcard/unsigned.apk
/sdcard/unsigned.apk 936EACBE07F201DF SDK Test Key

Was playing around with app inventor and came up with this:
edit: AppInventor does not generate java code and it cannot be worked on further in anything else (i.e eclipse)
I was really hoping I would atleast get the activity xml

Heya, the latest is at http://code.google.com/p/signapk/downloads/list and should fix the zip error. signapk-bb, signapk-zip, and signapk-openssl are static, trimmed down versions of utilities required by the script, and should be extracted to the same directory as the script. If they are not present it will try to use stuff in $PATH

Just throwing it (the obvious) out there that this could enable a new generation of morphs for /data apps
Copy apk,uninstall,morph, install

Hmmmm....

britoso said:
Just throwing it (the obvious) out there that this could enable a new generation of morphs for /data apps
Copy apk,uninstall,morph, install
Click to expand...
Click to collapse
How can i get this to work with a morph and to edit the updater-script?

Someone explain the commands with example...
Another noob question is .. it is for android or pc...
Edit:- Made my own mod here https://forum.xda-developers.com/t/...-apk-zip-within-android.3835975/post-81324327
below code works with latest(1.32.0) busybox
Bash:
#!/system/bin/sh
# depends unzip printf zip openssl
# put zip openssl busybox in PATH
# Usage:-
# Sign.sh key.pk8 key.x509.pem in.zip out.zip
ordie() {
if [ $? -ne 0 ]; then
IFS=" "
$BB printf "$1\n"
exit $2
fi
}
PKEY="$1"
CERT="$2"
ORIG="$3"
TARGET="$4"
BB=busybox
cat "$ORIG" > "$TARGET"; ordie "Cannot write to $TARGET" 3
$BB printf "Checksumming $ORIG:\n"
TMP=$HOME
TMPDIR="$TMP/sign-$$"
TMPPKEY="$TMPDIR/tmp.pkey"
mkdir -p "$TMPDIR/META-INF"; ordie "" 3
$BB printf "Manifest-Version: 1.0\r\nCreated-By: 1.0 (Android SignApk)\r\n\r\n" > "$TMPDIR/META-INF/MANIFEST.MF"
ZIPls=$($BB unzip -qql "$ORIG"); ordie "$ORIG: unzip error" 1
OLDIFS=$IFS
IFS=${IFS:2:2}
for i in $ZIPls; do
IFS=$OLDIFS
set -- $i
if [ "$#" -ge 3 ] && [ "$1" != "0" ]; then
file="${i:30}"
case "$file" in META-INF/MANIFEST.MF|META-INF/CERT.SF|META-INF/CERT.RSA) continue;; esac
$BB printf "$file "
hash=$($BB unzip -p "$ORIG" "$file" | openssl sha1 -binary | openssl base64); ordie "$ORIG: unzip error" 1
ret="Name: $file\r\nSHA1-Digest: $hash\r\n\r\n"
$BB printf "$ret" >> "$TMPDIR/META-INF/MANIFEST.MF"
hash=$($BB printf "$ret" | openssl sha1 -binary | openssl base64)
$BB printf "Name: $file\r\nSHA1-Digest: $hash\r\n\r\n" >> "$TMPDIR/META-INF/CERT.SF.temp"
fi
done
$BB printf "\n"
mfhash=$(cat "$TMPDIR/META-INF/MANIFEST.MF" | openssl sha1 -binary | openssl base64)
$BB printf "Signature-Version: 1.0\r\nCreated-By: 1.0 (Android SignApk)\r\nSHA1-Digest-Manifest: $mfhash\r\n\r\n" > "$TMPDIR/META-INF/CERT.SF"
cat "$TMPDIR/META-INF/CERT.SF.temp" >> "$TMPDIR/META-INF/CERT.SF"
openssl pkcs8 -inform DER -nocrypt -in "$PKEY" > "$TMPPKEY"; ordie "" 4
cat "$TMPDIR/META-INF/CERT.SF" | openssl smime -sign -inkey "$TMPPKEY" -signer "$CERT" -binary -outform DER -noattr > "$TMPDIR/META-INF/CERT.RSA"; ordie "" 4
cd "$TMPDIR"
zip "$TARGET" META-INF/MANIFEST.MF META-INF/CERT.SF META-INF/CERT.RSA; ordie "" 5
cd - > /dev/null
rm -r "$TMPDIR"

Related

HOW TO: Better AD Block

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

[App] Netflix HD for Widevine DRM L1 devices

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 to Batch Sign Zip Files

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.

Android's /data/system/packages.xml cert's key attribute

Android's /data/system/packages.xml contains a cert node that has a "key" attribute. How is that key attribute datastring generated? For example:
<package name="packageName" codePath="/data/app/packageName-4r-3P8gvwV53t8CAY1HaqQ==" nativeLibraryPath="/data/app/ packageName -4r-3P8gvwV53t8CAY1HaqQ==/lib" primaryCpuAbi="arm64-v8a" publicFlags="944275012" privateFlags="0" ft="1794526df30" it="179452759d5" ut="179452759d5" version="60" userId="10346">
<sigs count="1">
<cert index="17" key = "3082056f30820357a00302010202020357300d06092a864886f70d01010b0500306d310b3009060355040613025553311d301b060355040a131453796d616e74656320436f72706f726174696f6e311d301b060355040b1314416e64726f6964204170706c69636174696f6e733120301e0603550403131753796d616e74656320434120666f7220416e64726f6964301e170d3136313131353132343332345a170d3431313131303135353832315a3075310b300906035504061302494e311430120603550408130b4d61686172617368747261311430120603550407130b4e617669204d756d626169311c301a060355040a131353544154452042414e4b204f4620494e444941311c301a0603550403131353544154452042414e4b204f4620494e44494130820122300d06092a864886f70d01010105000382010f003082010a0282010100b40850398200afe7647c734cb4a04f2b67eee915301f6c5e8d5b7fbae3defa4b7c27894d35cceef222009333843b5e49c9382e64822d00fd0a8667f470f5fbeed677b768cbe4f39f9b71f10d6db2070d63220108a4e183e937fbf00ac3e69bf726890b9242c70262fbdd564ddbc4e63701d912df1f37e9b7dcb28b7b13b9fdd33a9f3bbba0fefbbbdcff30c3c605db8b6d61675b86f486d185cfdfe7c1ad73a4618a1b0f383d3d9b5c26ed6007cf89601453617fb07ef40daa4a307044e0eb8a6ce5cc7422fea1b2d244c6fb39a830368ac7b2855ee580c13e11b25bb8d0ae426c262303e7dd1b3bc84ada65f2cd758efce96700c91a5827331a7fc40f9a72870203010001a382010f3082010b301f0603551d230418301680148e55d1a566d0a824974eec77d0dcbea0936884dd303c06082b060105050701010430302e302c06082b060105050730018620687474703a2f2f616e64726f69642d6f6373702e67656f74727573742e636f6d300e0603551d0f0101ff0404030205e0302a0603551d250423302106082b0601050507030206082b06010505070303060b6086480186f8450108350130410603551d1f043a30383036a034a0328630687474703a2f2f616e64726f69642d63726c2e67656f74727573742e636f6d2f63726c732f616e64726f69642e63726c301d0603551d0e04160414c42e45c7eb54079d944c0a915e3c390544a20194300c0603551d130101ff04023000300d06092a864886f70d01010b0500038202010063e29f0f7c49b6f1724bd34376cda80acf1f2bb0fb5d5a50d84caa3862458b5dd8e5ac184c98bc424dd667e326938b003b7bdc05f9bfb449fa19fe52d7389d929b0979064cd6b1cd48e9c49b41a0a24ddd9968f3a98631a99f40213bc181f61f32b327016fcaff475cea7f8242fe0a571cf5d89fb26be0a0049050d57b5fdb9e8e75a439a6e6d42c324163ab39b2482aba1274dba663d94bbdc0bca47ad7d4d5fbe1cb41f8c2ea9d9be6c4de553aeaf9e82d8318034f37dadd5579edb1d43dd2ced3988353fe7c3a12e350dc188aa5019c96d3384fa2b6201335644d6650263fa92118ac18c1a571150fa9a16c2ca68dde38982cb9dd02fa8aac9c6dcfa40fcf95b858540434fa38c6e22cf65649c3844932a9fe77c4fabdf649787ba63978f19e1c4a696e678347a21b65908e67a543d1650544d5107499770b1ed82c1276edcaeb57cc8489bfab7e976621d6c8458c7ef4a4e5938afe6315fadfd11b818587f04ee23462bbef13a2825b6334a0154fd69de8b23be81129f5f328782f0222717481d155a478d02af378ab7d01427bbfdf33934bc113d8a8d34676487316c5d7c5861689ea8bd5ffb89e079295ac583bdf309deda1f9b40506dd204291fe5c062c88963600bbc573fabed63022b40cecb9b1858603b6a7532952c3742c7259e7185e5e2b3da5673a9a25b28327c71657770e30f4436d062444b15d82c553968d" />
</sigs>
I want to generate the same key value from the *.RSA file present inside the apk. I tried the following things but it did not work out:
Executed the command unzip -p path_to_appName.apk META-INF/CERT.RSA | xxd -p | tr -d '\n' (but it gave incorrect result)
openssl pkcs7 -inform DER -in filename.RSA -noout -print_certs -text
Tried to fetch the certificate details of the app using the above command and tried analysing the public key of the app but could not find any pattern
Does anyone know how to generate the key value from the signature file (*.RSA) file present inside the apk?
Thanks a lot for the help

I need help starting Apache server with PHP on Android

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....

Categories

Resources