[Tutorial] How to install custom SSL Certificates (Root/Etc) on Bluestacks 4/5 - General Topics

THIS POST IS FOR EDUCATIONAL PURPOSE ONLY (FOR USERS USING BLUESTACKS AS THEIR ANDROID DEVELOPMENT PLATFORM)
Requirements:
Bluestacks 4 or 5
Rooted Bluestacks with ADB + Root Files Editing Ability
OpenSSL Software
​Step 1.​Generate the hash used by android for the certificate file name by running this command for openssl software:
Code:
openssl x509 -inform PEM -subject_hash_old -in rootCA.crt
It will return something like:
Code:
5d4e73c2
-----BEGIN CERTIFICATE-----
FuIEZyYW5zaXNjbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRp
eTkNLUb/u3ukTwoQ9LzToWhPwdVKf+CLn98GF46/qif1vUGSOmRgdVhjFMgBYXz6
+b2MW+UAuCYWvYJ5R5g3OQo8kSy4KHs47yDrEImQcIV9M7+wAcyf4ehVCuk5Ytxr
4R8KIjP6wOfKb3/f38iqoEx1IYaweDnmL0MktbACMzaMYsPUFn/Y9SnqW7UEbkYE
3qpX+gFFcUvuHDemnimNiDcmWHnRY7cEzZniMZiLSp753nHhZTrxzStPijReSOgw
ozmDhztsyoo05fgazue8LhMJY0Nr5w3WiwRJPdQmsCG3bL6Iq/Z7Zcyt8vFvYHRt
tJPuBej0ZGecj+DWbXkCAwEAAaNTMFEwHQYDVR0OBBYEFMJ4HTxoK4isk9Ec8GFC
AOsxtj5gMB8GA1UdIwQYMBaAFMJ4HTxoK4is
-----END CERTIFICATE-----
5d4e73c2 will be the filename used by android so run the next command:
Code:
openssl x509 -inform PEM -text -in rootCA.crt -noout >> 5d4e73c2.0
make sure you replace rootCA.crt with your cert file and 5d4e73c2.0 with your hash
Step 1 should be done if you have the new file with the hashname in your directory (around 5kb size)
Step 2.​Edit the generated hashname.0 file and move CERTIFICATE data from your .crt file to top of hashname.0 file:
Example (rootCA.cert):
Code:
-----BEGIN CERTIFICATE-----
FuIEZyYW5zaXNjbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRp
eTkNLUb/u3ukTwoQ9LsToWhPwdVKf+CLn98GF46/qif1vUGSOmRgdVhjFMgBYXz6
+b2MW+UAuCYWvYJ5R5g3OQo8kSy4KHs47yDrEImQcIV9M7+wAcyf4ehVCuk5Ytxr
4R8KIjP6wOfKb3/X38iqoEx1IYaweDnmL0MktbACMzaMYsPUFn/Y9SnqW7UEbkYE
3qpX+gFFcUvuHDemnimNiDcmWHnRY7cEzZniMZiLSp753nHhZTrxzStPijReSOgw
ozmDhztsyoo05fgazue8LhMJY0Nr5w3WiwRJPdQmsCG3bL6Iq/Z7Zcyt8vFvYHRt
tJPuBej0ZGecj+DWbXkCAwEAAaNTMFEwHQYDVR0OBBYEFMJ4HTxoK4isk9Ec8GFC
AOsxtj5gMB8GA1UdIwQYMBaAFMJ4HTxoK4is
-----END CERTIFICATE-----
copy your certificate data to top of hashname.0 file like:
Code:
-----BEGIN CERTIFICATE-----
FuIEZyYW5zaXNjbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMRp
eTkNLUb/u3ukTwoQ9LzToWhP2dVKf+CLn98GF46/qif1vUGSOmRgdVhjFMgBYXz6
+b2MW+UAuCYWvYJ5R5g3OQo8kSy4KHs47yDrEImQcIV9M7+wAcyf4ehVCuk5Ytxr
4R8KIjP6wOfKb3/X38iqoEx1IYaweDnmL0MktbACMzaMYsPUFn/Y9SnqW7UEbkYE
3qpX+gFFcUvuHDemnimNiDcmWHnRY7cEzZniMZiLSp753nHhZTrxzStPijReSOgw
ozmDhztsyoo05fgazue8LhMJY0Nr5w3WiwRJPdQmsCG3bL6Iq/Z7Zcyt8vFvYHRt
tJPuBej0ZGecj+DWbXkCAwEAAaNTMFEwHQYDVR0OBBYEFMJ4HTxoK4isk9Ec8GFC
AOsxtj5gMB8GA1UdIwQYMBaAFMJ4HTxoK4is
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
9b:59:08:67:2a:bb:f5:df
Signature Algorithm: sha256WithRSAEncryption
................................................... (alot of data below)
save the file and get ready to copy to your bluestacks.
Step 3.​there are many ways to transfer files to bluestacks, for example by using their windows file manager import option or using adb
once you have copied the hashname.0 file to your bluestacks.
Using Root Explorer:- Copy .0 file to /system/etc/security/cacerts/ and set the file permissions to 644 (file owner can remain root:root)
OR
Using ADB:- run these commands below:
Code:
su
mount -o remount,rw /system
adb push C:\openssl\5d4e73c2.0 /system/etc/security/cacerts/
cd /system/etc/security/cacerts/
chmod 644 5d4e73c2.0
mount -o remount,ro /system
reboot
AND DONE!​once rebooted, you should have the certificates installed.

Related

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

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"

[Q] Help using Android command line dev tools

I'm trying to deconstruct the Android app development process by creating and installing a sample app entirely from the command line (without even using Ant). I've composed a script which seems to work until the very last command, at which point I get the message
134 KB/s (10496 bytes in 0.076s)
pkg: /data/local/tmp/MyActivity-debug.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Please don't be put off by the fact that my script is a Windows .bat script. I'm just calling code from the SDK's tools and platform-tools directories. Anyway, here's the script. If find what I'm missing that's giving me the NO_CERTIFICATES error, please reply...
call "c:\program files (x86)\Android\android-sdk\tools\android" create project --target 10 --name MyAndroidProject --path c:\MyProjects\MyAndroidProject --activity MyActivity --package com.allmycode.samples
cd \MyProjects\MyAndroidProject
mkdir C:\MyProjects\MyAndroidProject\res
mkdir C:\MyProjects\MyAndroidProject\libs
mkdir C:\MyProjects\MyAndroidProject\bin
mkdir C:\MyProjects\MyAndroidProject\gen
mkdir C:\MyProjects\MyAndroidProject\bin\classes
"C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe" package -f -m -M C:\MyProjects\MyAndroidProject\AndroidManifest.xml -S C:\MyProjects\MyAndroidProject\res -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -J C:\MyProjects\MyAndroidProject\gen
"c:\program files\java\jdk1.7.0\bin\javac" -d C:\MyProjects\MyAndroidProject\bin\classes -classpath C:\MyProjects\MyAndroidProject\bin\classes;C:\MyProjects\MyAndroidProject;c:\ant\lib\ant-launcher.jar;"C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip";C:\ant\lib\ant-antlr.jar;C:\ant\lib\ant-apache-bcel.jar;C:\ant\lib\ant-apache-bsf.jar;C:\ant\lib\ant-apache-log4j.jar;C:\ant\lib\ant-apache-oro.jar;C:\ant\lib\ant-apache-regexp.jar;C:\ant\lib\ant-apache-resolver.jar;C:\ant\lib\ant-apache-xalan2.jar;C:\ant\lib\ant-commons-logging.jar;C:\ant\lib\ant-commons-net.jar;C:\ant\lib\ant-jai.jar;C:\ant\lib\ant-javamail.jar;C:\ant\lib\ant-jdepend.jar;C:\ant\lib\ant-jmf.jar;C:\ant\lib\ant-jsch.jar;C:\ant\lib\ant-junit.jar;C:\ant\lib\ant-junit4.jar;C:\ant\lib\ant-netrexx.jar;C:\ant\lib\ant-swing.jar;C:\ant\lib\ant-testutil.jar;C:\ant\lib\ant.jar;"C:\Program Files\Java\jdk1.7.0\lib\tools.jar" -sourcepath C:\MyProjects\MyAndroidProject\src;C:\MyProjects\MyAndroidProject\gen -target 1.5 -bootclasspath "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -encoding UTF-8 -g -source 1.5 c:\MyProjects\MyAndroidProject\src\com\allmycode\samples\*.java
call "C:\Program Files (x86)\Android\android-sdk\platform-tools\dx.bat" --dex --output=C:\MyProjects\MyAndroidProject\bin\classes.dex C:\MyProjects\MyAndroidProject\bin\classes
"C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe" package -f --debug-mode -M C:\MyProjects\MyAndroidProject\AndroidManifest.xml -S C:\MyProjects\MyAndroidProject\res -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -F C:\MyProjects\MyAndroidProject\bin\MyActivity-debug-unaligned.apk
"C:\Program Files (x86)\Android\android-sdk\tools\zipalign.exe" -f 4 C:\MyProjects\MyAndroidProject\bin\MyActivity-debug-unaligned.apk C:\MyProjects\MyAndroidProject\bin\MyActivity-debug.apk
start "Launch an emulator" "C:\Program Files (x86)\Android\android-sdk/tools/emulator.exe" -avd Gingerbread
timeout /T 60
"C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" install -r C:\MyProjects\MyAndroidProject\bin\MyActivity-debug.apk
You need to sign your apk
Hey, I believe all you need to do is sign your .apk with a certificate.
Here is a link about creating a certificate if you dont already have one. I tried to include a link but it wont let me. (sorry im a new user)
Once you have acquired a certificate, you can then use the JDK utitility called jarsigner. The terminal command should be something like this...
jarsigner -verbose -keystore my-release-key.keystore final.apk alias_name
Click to expand...
Click to collapse
Hope this helps ya out.

BackTrack 5 for Android Smartphones - VERY UNSTABLE

WARNING: THIS IS NOT FOR THE FAINT OF HEART
UPDATE: My goal was to create a version of BackTrack 5 for ARM that was easy to use and install. As of this time, that IS NOT the case! The versions posted here are **probably not** going to work straight out of the box. If you know what you are doing in a Linux environment, you'll probably be able to get it working.
Because of this, the project is currently completely unsupported. You are free to dive in, but you are doing so with no support for me, and I'm not liable for any damage that might be done to your device's ROM.
I encourage you to pass this up unless you know what you are getting yourself into!
If you were referred here from the XDA-Developers.com article...
Hi there! Let's get one thing on the record here... this is *not* a native client! This is the chroot + VNC method that we'd been using to get Ubuntu running with Android for a while. The article makes it sound like that's the case, but sadly it's not. However, with the chroot + VNC method we can really run BackTrack 5 on an Android device, and it really does work. This takes some technical skills, and isn't for the non-Linux experienced user.
Requires a rooted device!
BackTrack 5 installation guides are making their way around this forum. I've tried to synthesize it all, but I've also added my own touches to help with usability and features, along with a workaround for the "ioctl LOOP_SET_FD failed" error message some people have been getting.
In theory this build is nearly universal, so if you have an Android device it should work. I've put it all in one zip file that you can download directly from my website, no hassles or wait timers.
If you are interested have a look, feel free to re-post. Credit goes to the BackTrack team and xda member anantshri (he's got skills, give him props guys), who built the base image file.
Information, download link, and installation guide at:
(SERVER OFFLINE, SEE BELOW)
If you like what you see help me out, hosting is expensive!
http://www.mattslifebytes.com/donate
(alternatively, you can show interest in the products and services featured on my website, if you know what I mean )
msullivan said:
If you don't know what BackTrack is, you probably don't want it
BackTrack is an operating system based on Ubuntu Linux that is used for security testing (aka hacking) and digital forensics. I'm a master's degree student in computer security, so I love this OS... it can do awesome things. Turn on your Wi-Fi and you can do advanced network scans and tests right from your phone, no laptop required. For me this is hella-useful.
But besides just being an OS for hacking ****, it's also fully Ubuntu-based, so you can run it like a desktop, including running Firefox and other Linux applications.
Click to expand...
Click to collapse
Well guys my server had hardware failure (lol, my luck), so here's the website's content:
msullivan said:
The Download
This installation of BackTrack 5 is available as a compressed file that will need to be extracted. I recommend downloading this using Chrome or Firefox. Internet Explorer often doesn’t play well with large HTTP downloads.
The root account’s password and the VNC server password are both set to ‘root’ by default!
Mirror 1
Part 1: http://www.mediafire.com/?1z5sbxdxv3naxp1
Part 2: http://www.mediafire.com/?0zz1vac0k59d58p
Part 3: http://www.mediafire.com/?kxpb7ug0x55ppde
Mirror 2
http://www.megaupload.com/?d=M6YCKZLR
Mirror 3 (Provided by shenshang)
http://www.shenye.co.uk/files/BackTrack5ForARM-MattsLifeBytesEditionv2.zip
Mirror 4 (Provided by brilldoctor)
http://brilldoctor.co.cc/Files/BackTrack5ForARM-MattsLifeBytesEditionv2.zip
Mirror 5 (Thanks for uploading, PIIcoding)
Part 1: https://rapidshare.com/files/3602140493/BackTrack5ForARM-MattsLifeBytesEditionv2.part1.rar
Part 2: https://rapidshare.com/files/2384880899/BackTrack5ForARM-MattsLifeBytesEditionv2.part2.rar
Part 3: https://rapidshare.com/files/3314159192/BackTrack5ForARM-MattsLifeBytesEditionv2.part3.rar
Part 4: https://rapidshare.com/files/3073073580/BackTrack5ForARM-MattsLifeBytesEditionv2.part4.rar
Part 5: https://rapidshare.com/files/2486943841/BackTrack5ForARM-MattsLifeBytesEditionv2.part5.rar
Part 6: https://rapidshare.com/files/3545372402/BackTrack5ForARM-MattsLifeBytesEditionv2.part6.rar
Part 7: https://rapidshare.com/files/2371728719/BackTrack5ForARM-MattsLifeBytesEditionv2.part7.rar
Part 8: https://rapidshare.com/files/1437974805/BackTrack5ForARM-MattsLifeBytesEditionv2.part8.rar
Part 9: https://rapidshare.com/files/1758571109/BackTrack5ForARM-MattsLifeBytesEditionv2.part9.rar
The Description
If you want to run BackTrack 5 on your Android-powered device, read on, you’re in the right place! So the big news is that BackTrack 5 runs on Android phones. We’ve been able to run Ubuntu on these devices for quite some time too, but admittedly BackTrack on a smartphone is just awesome.
Anyway, files for using BackTrack 5 on an Android phone have been running around the internet, but sadly it’s kind of a mish-mash of links saying, “go download this, then get this, to then this, blah blah blah”. Too confusing for my simple brain, so I’ve rounded it all up and posted it in one place… right here. The version posted here has everything you should need to run BackTrack 5 on your Android device. I’ve also added a lot of goodies to help with the user experience that the other offerings don’t include:
Works around the ioctl LOOP_SET_FD failed error that many people have been receiving on Galaxy S devices (and others)
Asks the user if they want a VNC session upon start-up
Starts the SSH service automatically and displays device IP on start-up
Enables the Ubuntu repositories to Aptitude, so you can do package installation
Adds vim. Really, what distribution doesn’t come with vim by default? Seriously…
Sets the screen resolution to 800×480 default (should be compatible with most smartphone devices)
SU
This requires root!
You must be able to "su" at terminal. This ability is usually provided by software for rooting your phone. To see if you have rooted your phone correctly and it's working, go to your terminal emulator and type "su" <enter>. If it is working, you'll probably get a prompt asking you if you want to allow your terminal emulator root access. Hit accept/yes. Now you'll be back in your terminal emulator. Type "whoami" <enter>. If it responds with "root" or "uid 0", then you are properly rooted.
Busybox
This requires Busybox!
I am no longer providing an installer for Busybox because of issues getting it to work universally, so instead YOU need to go get a working build and install it (I believe "Busybox Installer" will work, but not tested). If you want to know if you have Busybox and it's working, go to your terminal emulator and type "su" <enter>, then "busybox ls" <enter>. If you get a printout of all the files in your current directory, then your Busybox will likely work with BackTrack 5 just fine. If you get an error, "busybox: not found", that means you either do not have Busybox, or it is not properly installed.
WARNING FOR CyanogenMod USERS
Before doing ANYTHING, please test for ext2 support by running (as root, at terminal) --> "modprobe ext2" <enter>
If this fails probably your device lacks ext2 support and the whole thing will screw up if you try to run it! Support for ext2 in CM is being worked on.
The Installation Guide
Enable Wi-Fi and connect to a Wi-Fi access point (* not required, but BT5 cannot use your data plan for internet access)
Download the zip file, extract anywhere
After extraction you’ll have one folder “bt5″; copy this folder to the root of your phone’s SD Card
Put card back in phone and/or unplug from USB
In a terminal emulator, type “su” <enter>, “cd /sdcard/bt5″ <enter>
Now you are ready to rock and roll, so issue “sh bt” <enter> (in the future to start BT5 skip the line above and come straight to this command)
If all is well you’ll now be running BackTrack 5 on your Android device; you can SSH to it via Wi-Fi (password ‘root’), or access it from VNC if you said “Yes” to the prompt asking if you wanted a VNC session
To get a GUI for BackTrack on your smartphone’s screen, download a VNC viewer from the market (many are free), then connect to host “127.0.0.1″, port “5901″, password “root”
Enjoy, boys and girls.
The Credits
The BackTrack 5 Development Team
anantshri on xda-developers (his blog: http://blog.anantshri.info/) for creating the image file to fit FAT32 filesystems
anantshi's original thread where it all began: http://forum.xda-developers.com/showthread.php?t=1074169
Click to expand...
Click to collapse
Known Incompatibility
Voodoo lagfix kernel (possibly? reported, not confirmed)
Hi thanks for the great work, I try it on my HTC WildFire with CyanogenMod7 2.3 CFW
this what i got when try it install it from the terminal:
$ su
# id
uid=0(root) guid=0(root)
#
# cd /sdcard/bt5
# sh installbusybox
installbusybox: 14: Syntax error: end of file unexpected (expecting "fi")
#
# sh bt
bt: 36: Syntex error: end of file unexpected (expecting "then")
#
Click to expand...
Click to collapse
Which terminal emulator are you using?
Terminal emulator
Open up "installbusybox" in a text editor and axe the first two lines, then try again.
Hrm... I failed when packaging the version that got put up online (sorry). I'm fixing now, will update shortly.
ok i remove the first two lines, and i got:
# sh installbusybox
BeginningBusyBox installation...
mount: mounting /dev/block/mtdbloc faild: No such file or directory
/sdcard/busybox: No such file or directory
cd:can't cd to /data/local
installbusybox: ./busybox: permission denied
cd:can't cd to /system/xbin
: No such file or directory
installbusybox: ./busybox: permission denied
If there were no error messages given above then installation was successfull
#
Click to expand...
Click to collapse
not sure why when i try to chmod 755 busybox nothing change!
msullivan said:
Hrm... I failed when packaging the version that got put up online (sorry). I'm fixing now, will update shortly.
Click to expand...
Click to collapse
aha, ok thanks again
Awesome.
Sent from a super smooth captivate running andromeda
Old news...
Btw.. if you're having problems, migrate apps from SDCard to Internal memory.
edit: Just realized this came off kinda ****-like... So here http://forum.xda-developers.com/showpost.php?p=13924701&postcount=109
AdamOutler said:
Old news...
Click to expand...
Click to collapse
News isn't that BT5 runs on these; the news is that my builds resolve a lot of issues and makes it as simple as dropping in the files and saying go.
Fixed version now posted at the website.
http://www.mattslifebytes.com/?p=456
export PATH=/data/local/bin:$PATH
$ $su
# cd /sdcard/bt5
# sh bt
mkdir failed for /data/local/mnt, File exists
mount: No such device
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: No such device
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
failed.
failed.
failed.
failed.
losetup: /dev/loop7: No such device or address
#
I have this error when i try
Sent from my A953 using Tapatalk
Motodoido said:
export PATH=/data/local/bin:$PATH
$ $su
# cd /sdcard/bt5
# sh bt
mkdir failed for /data/local/mnt, File exists
mount: No such device
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: No such device
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
failed.
failed.
failed.
failed.
losetup: /dev/loop7: No such device or address
#
I have this error when i try
Sent from my A953 using Tapatalk
Click to expand...
Click to collapse
Same error here, Verizon Fascinate.
Motodoido, tripacer99: have you remembered to do the "sh installbusybox" command first?
I download the new package, and this what i got:
[[email protected] tools]$ ./adb shell
# id
uid=0(root) gid=0(root)
# cd sdcard/bt5
# ls
bt busybox installbusybox unionfs
bt5.img fsrw mountonly
# sh installbusybox
Beginning BusyBox installation...
/sdcard/busybox: No such file or directory
--install: applet not found
If there were no error messages given above then installation was successful!
# sh bt
mkdir: can't create directory '/data/local/mnt': File exists
Loop device exists
losetup: /dev/block/loop7: No such file or directory
mount: mounting /dev/block/loop7 on /data/local/mnt failed: Device or resource busy
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: ip 192.168.2.13 mask 255.255.255.0 flags [up broadcast running multicast]
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
umount: can't umount /data/local/mnt/dev/pts: No such file or directory
umount: can't umount /data/local/mnt/proc: No such file or directory
umount: can't umount /data/local/mnt/sys: No such file or directory
umount: can't umount /data/local/mnt: Invalid argument
losetup: /dev/loop7: Device or resource busy
#
Click to expand...
Click to collapse
Hrm yet another small error in one of the scripts. So sorry :S (this script is from the BT5 team though, so I take no fault in it not working, lol).
Open "installbusybox" in a text editor and replace the text "cat /sdcard/busybox" with "cat /sdcard/bt5/busybox" it should work. I'll fix it and put it up online once I'm home from work today.
msullivan said:
Hrm yet another small error in one of the scripts. So sorry :S (this script is from the BT5 team though, so I take no fault in it not working, lol).
Open "installbusybox" in a text editor and replace the text "cat /sdcard/busybox" with "cat /sdcard/bt5/busybox" it should work. I'll fix it and put it up online once I'm home from work today.
Click to expand...
Click to collapse
thanks for your time and for your help
now i got:
# sh installbusybox
Beginning BusyBox installation...
[1] Illegal instruction ./busybox cp /da...
--install: applet not found
If there were no error messages given above then installation was successful!
#
# cat installbusybox
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
echo "Beginning BusyBox installation..."
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cat /sdcard/bt5/busybox > /data/local/busybox
chmod 755 /data/local/busybox
#/data/local/busybox mkdir /system/xbin
cd /data/local
./busybox cp /data/local/busybox /system/xbin
cd /system/xbin
chmod 755 busybox
./busybox --install -s /system/xbin
rm /data/local/busybox
echo "If there were no error messages given above then installation was successful!"
# ls /data/local/busybox
ls: /data/local/busybox: No such file or directory
#
Click to expand...
Click to collapse
Dr_Death said:
thanks for your time and for your help
now i got:
Click to expand...
Click to collapse
I'll have to play when I get home... at the moment I don't have an answer :-/
Link is offline....

[APP][DEV][GUIDE] Using the Android Java Internal/Hidden API classes

Using Java Reflection with Eclipse ADT to Access Internal/Hidden API classes.
Purpose
We present a way to access all the Internal and Hidden Java packages/classes
in the AOS. To do this we need to both repackage the Android.jar and hack the
Eclipse ADT plugin, to allow using these internal packages.
Posting
==================================================
Do NOT post general questions/requests on how to
do this or that, they will not be answered here.
DO post if you have additional tricks, hacks or
information that can help/benefit this tutorial.
==================================================
Background
There are two reasons one cannot use internal packages. One reason is that, if
you're using Eclipse as your development platform, those packages are
internally blocked in the Eclipse ADT plugin. Second reason is that the normal
development android.jar runtime does not contain those *.class files that
belong to the internal packages.
"There is no easy way to use com.android.internal package (internal API) or
anything marked with @hide attribute (hidden API) without using reflection.
That’s because android.jar file does not contain classes from internal and
hidden API and because of this nobody can reference those classes in compile
time."
Thus we need to first restore the "original" android.jar which will allow us
to use internal and hidden APIs. But the runtime equivalent of Android SDK’s
android.jar file is framework.jar. This file is located in the
/system/framework/ directory of your device. We will extract and use this for
our pleasure.
The general procedure:
A) Grab the "full" framwork.jar from your device
B) extract the class files
C) add them to "full" android.jar ??
D) Hack the Eclipse ADT plugin jar.
Finally, NOTHING would have been possible without the excellent step-by-step
instructions on the devmaze-blog by senior Android developer Ievgenii Nazaruk
(aka. "inazaruk"). THANK YOU Ievgenii!​References
http://stackoverflow.com/questions/...d-sdk-with-hidden-and-internal-apis-available
http://stackoverflow.com/questions/...-state-permission-for-apps-ran-on-gingerbread
http://code.google.com/p/smali/wiki/DeodexInstructions
http://code.google.com/p/adt-addons/
​
The General Procedure
NOTE: All this was performed on Windows Vista with Cygwin.(1) Grab BOOTCLASSPATH from init.rc
Find the line in your init.rc file that reads something like:
Code:
[SIZE=2]export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar[/SIZE]
Extract and reformat the path to:
Code:
[SIZE=2]core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar[/SIZE]
(2) Grab the "framework" from your device
Create a working directory somewhere, let's call it "_framework":
Code:
[SIZE=2]mkdir ./_framework[/SIZE]
[SIZE=2]cd _framework[/SIZE]
Grab all the framework files from your device:
Code:
[SIZE=2]adb pull /system/framework .[/SIZE]
Rename directory if needed.
NOTE-1: From now on I'll assume you know where you are!
NOTE-2: Most GB 2.3.4+ devices uses .odex'ed files,
with name pairs like: <package>.jar and <package>.odex.
These need to be converted.
(3) Use baksmali with (1)
You can also use baksmali with the switch: -d <framwork-dir>.
The general command is something like below, but in windows there may be "wrappers"
that allow you to just type "baksmali" without the "java -jar" prefix and without
the ".jar" post fix. Anyway here is the command I used:
Code:
[SIZE=2]java -Xmx1024m -jar ./../../baksmali.jar -a 10 -c :core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar -x framework.odex[/SIZE]
==> This results in all files put in the "out" sub-directory.
This directory contain 3 sub-directories (for GB 2.3.4):
Code:
[I]android [/I](Hidden APIs)
[I]com [/I](Internal APIs)
[I]javax [/I](Hidden APIs)
NOTE: If you are using Google's own API's, you will probably also need to add
those packages to the path above. (Eg. Email.jar, etc etc ?)
(4) Then use smali to create a dex file from "out" directory
Code:
java -jar smali.jar out
==> creates out.dex from "out" directory.
(5) Run dex2jar on out.dex
Code:
[SIZE=2]./dex2jar.bat out.dex[/SIZE]
==> creates out_dex2jar.jar
(This .jar contain close to 4900 files at 12 MB!)
(6) Rename "out_dex2jar.jar" to "framework-classes.zip"
Code:
[SIZE=2]mv out_dex2jar.jar framework-classes.zip
unzip framework-classes.zip[/SIZE]
(7) Find and copy your Android SDK's android.jar file
Go to: /path/to/android-sdk-windows/platforms/android-X/android.jar
where X is the API level of interest. This obviously have to match the
API level of the files you extracted from your device in: /system/framework .
This .jar file contain more than 5300 files when expanded, but missing all
the internal packages. Our job is to add them back in.
Let's first make a copy that we can use to expand and add files from (6):
Code:
cp android.jar custom-android.zip
unzip custom-android.zip
(8) Add all *.class files from (6) in to (7)
Copy and replace all existing *.class files from framework-classes.zip into
custom-android.zip:
Code:
[SIZE=2]cp -R /path/to/framework-classes/* /path/to/custom-android/.[/SIZE]
The root content of that directory should then look something like this:
Code:
[SIZE=2]android[/SIZE]
[SIZE=2]assets[/SIZE]
[SIZE=2]com[/SIZE]
[SIZE=2]dalvik[/SIZE]
[SIZE=2]java[/SIZE]
[SIZE=2]javax[/SIZE]
[SIZE=2]junit[/SIZE]
[SIZE=2]META-INF[/SIZE]
[SIZE=2]org[/SIZE]
[SIZE=2]res[/SIZE]
[SIZE=2]AndroidManifest.xml[/SIZE]
[SIZE=2]resources.arsc[/SIZE]
(9) Rename directory and create your new "classy-android.jar"
We rename it so not confuse with the original:
Code:
mv custom-android classy-android
zip classy-android
mv classy-android.zip classy-android.jar
IMPORTANT:
Make absolutely sure that the folder structure of your zip archive
is exactly the same as what you intended. To check, unzip the file
and see if it is what you (and eventually Eclipse) would expect.
(For example, if you use 7zip to zip a directory file called "test",
into "test.zip", you may end-up extracting it to ./test/test/... )
(10) Enabling & Restricting Access to classy-android.jar
Instead of just replacing the android.jar with classy-android.jar, we choose
to create a customized Android platform. This way you can enable the Internal
and Hidden API's for those projects requiring them, while other standard
projects doesn't have access to those.
(a) Go to: /path/to/android-sdk-windows/platforms/
and copy the relevant directory (for example):
Code:
cp -R android-10 android-10-internals
(b) Replace android.jar with your classy-android.jar:
Code:
cp classy-android.jar android.jar
("cp" overwrites!)
(c) Edit the build.prop file:
Edit/replace the following lines:
Code:
[SIZE=2]ro.build.version.sdk=10 ==> ro.build.version.sdk=[COLOR=Black][B]-10[/B][/COLOR][/SIZE]
[SIZE=2]ro.build.version.release=2.3.3 ==> ro.build.version.release=2.3.internal[/SIZE]
(11) Customizing the Eclipse ADT
In order to be able to use com.android.internal packages in the Eclipse ADT,
you have to disable the internal protection mechanism of the plugin, that
prevent you to use these libraries. You can see this by right-clicking on your
project package and navigate to:
Code:
[SIZE=2]==> Properties ==> Java Build Path ==> Libraries (tab) [/SIZE]
[SIZE=2]--> Android 2.x.x --> android.jar [/SIZE]
[SIZE=2]--> "Access rules: 1 rule defined": [B][COLOR=Red](X)[/COLOR][/B] [B]Forbidden: com/android/internal/**[/B][/SIZE]
This can not be removed (bug?), even though the interface allows changing, it
never persists after closing the Properties window. So we have to hack it!
The way to do it, is to hexedit the correct java class file and change the
name from "internal" to "internax". First let's find the correct file. The
plugin file is located in the ./eclipse/plugins/ directory, and its name is
something like:
Code:
com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar
(a) make a backup copy of this (with the exact name preserved) in another directory.
(b) make a another copy of this in another directory.
(c) unzip (b) in that directory
Code:
[SIZE=2]cp com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar hacked_adt.zip[/SIZE]
[SIZE=2]unzip hacked_adt.zip[/SIZE]
[SIZE=2]cd hacked_adt[/SIZE]
This is a huge directory system, so forget poking around in it,
just go to the correct sub-directory:
Code:
[SIZE=2]cd ./com/android/ide/eclipse/adt/internal/project/[/SIZE]
Then find the correct file and the approximate string location within that file:
Code:
[SIZE=2]strings.exe -f -4 -t x ./*.class |grep "android\/internal"[/SIZE]
It happens to be in "AndroidClasspathContainerInitializer.class". Now, use a
hexeditor to find and change the string "com/android/internal/**"
to "com/android/internax/**". That will do it!
Now zip-up your hacked jar directory and copy it over the old one.
(Remember that "cp" overwrites without warning!)
Code:
[SIZE=2]zip hacked_adt[/SIZE]
[SIZE=2]cp hacked_adt.zip /path/to/eclipse/plugins/com.android.ide.eclipse.adt_18.0.0.v201203301601-306762.jar[/SIZE]
You Are Done!
Enjoy your newly hacked Eclipse! ​Errors
If you get any errors;
1. make sure you have zipped up everything properly as warned before.
2. make sure you have included Google API packages in your BOOTCLASSPATH in step (3).
3. Try to "clean-up" the Java by: "Right-Click" ==> Source ==> "Clean Up...".
4. Google them
5. Ignore them
6. Give up. Not! But I can't help you!
If it still doesn't work, try to download inazaruk's pre-compiled set of internal android.jar's from here.
(For android 7,8,10,15.)
​
WIP! <here be dragons2>
For a project using internal package imports, see my thread:
"[TOOL][APP][WIP] Native AT Command Injector"
<here be more dragons>
Following the instructions in posts 1-2 above, may not always work. It is not known to me at this time, why it shouldn't. One theory is that it can have something to do with how Eclipse and Android.jar is packaging their files and the resulting sizes.
This was mentioned in this Stackoverflow post:
"Jar files: why does extracting then compression a jar file create a file of a different size to the original?"
Then reading the man pages for "jar" we can inform ourselves with:
Code:
[SIZE=2] c Creates a new archive file named jarfile (if f is specified) or to
standard output (if f and jarfile are omitted). Add to it the
files and directories specified by inputfiles.
u Updates an existing file jarfile (when f is specified) by adding
to it files and directories specified by inputfiles.
x Extracts files and directories from jarfile (if f is specified) or
standard input (if f and jarfile are omitted). If inputfiles is
specified, only those specified files and directories are
extracted. Otherwise, all files and directories are extracted.
t Lists the table of contents from jarfile (if f is specified) or
standard input (if f and jarfile are omitted). If inputfiles is
specified, only those specified files and directories are listed.
Otherwise, all files and directories are listed.
i Generate index information for the specified jarfile and its
dependent jar files.
[/SIZE]
More info is provided here:
The JAR Overview @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jarGuide.html
The JAR File Specification @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
The JARIndex Spec @
http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
JAR Tutorial @
http://java.sun.com/docs/books/tutorial/jar/
pack200 Reference Page @
http://java.sun.com/javase/6/docs/technotes/tools/share/pack200.html
Another theory is that it may have something to do with what seem to be, that Google have revoked the the use of MODIFY_PHONE_STATE since Android 2.3, and that this influences the Eclipse behavior, when using and modifying older android.jar's. This was mentioned here and here.
Any help would be very much appreciated!
< bump >
Hi, thanks for the info, I made it using linux and worked really nice, these were the lines that I used, hope be useful.
This is my Android folder at home
Code:
Android/
├── eclipse
├── ndk
├── platforms-internals
├── sdk
└── tools
Start an avd running the desired API to modify in this case API-17
Code:
$ emulator -avd avd_api_17 -no-window &
Get the framework
Code:
$ cd ~/Android/
$ mkdir _framework
$ cd _framework
$ adb -s emulator-5554 pull /system/framework .
Grab BOOTCLASSPATH
Code:
$ adb -s emulator-5554 shell cat init.rc | grep BOOTCLASSPATH > bootclasspath
I didn't have the tools used in this tutorial, so I included the steps for getting them
Decompile with baskmali
Code:
$ cd ~/Android/tools
$ wget https://smali.googlecode.com/files/baksmali-1.4.2.jar
$ cd ~/Android/_framework
$ java -Xmx1024m -jar ../tools/baksmali-1.4.2.jar -a 17 -c core.jar:core-junit.jar:bouncycastle.jar:ext.jar:framework.jar:telephony-common.jar:mms-common.jar:android.policy.jar:services.jar:apache-xml.jar -x framework.odex
The parameter -a for baksmali refers to the API we are working with.
Generate out.dex with smali
Code:
$ cd ~/Android/tools
$ wget https://smali.googlecode.com/files/smali-1.4.2.jar
$ cd ~/Android/_framework
$ java -jar ../tools/smali-1.4.2.jar out
Get internal and hidden classes using dex2jar
Code:
$ cd ~/Android
$ wget https://dex2jar.googlecode.com/files/dex2jar-0.0.9.15.zip
$ unzip dex2jar-0.0.9.15.zip
$ rm dex2jar-0.0.9.15.zip
$ cd _framework/
$ ../tools/dex2jar-0.0.9.15/d2j-dex2jar.sh out.dex
$ unzip out-dex2jar.jar -d framework-classes
Add these classes to plataform's default android.jar
Code:
$ cd ~/Android
$ unzip sdk/platforms/android-17/android.jar -d custom-android
$ cp -r _framework/framework-classes/* custom-android/
$ rm -r _framework
$ cd custom-android
$ zip -r ../custom-android.jar *
$ cd ..
$ rm -r custom-android
Create new extended platform
Code:
$ cd ~/Android
$ cp -r sdk/platforms/android-17 platforms-internals/android-17-internals
$ mv custom-android.jar platforms-internals/android-17-internals/android.jar
$ vi platforms-internals/android-17-internals/build.prop
ro.build.version.release=4.2.2
ro.build.version.release=4.2.2.internal
$ ln -s ~/Android/platforms-internals/android-17-internals ~/Android/sdk/platforms/android-17-internals
I use a symlink for keep it a little organized
Hack ADT
Code:
$ cd ~/Android
$ unzip eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar -d hacked_adt
Go to right folder
Code:
$ cd hacked_adt/com/android/ide/eclipse/adt/internal/project/
Find file where is our desired string
Code:
$ strings -f -a -t x * | grep "android\/internal"
Edit with an hex editor
Code:
$ bless AndroidClasspathContainerInitializer.class &
Here we change the l for the x.
Replace original file making a backup
Code:
$ cd ~/Android
$ cp eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar.original
$ cd hacked_adt/
$ zip -r ../eclipse/plugins/com.android.ide.eclipse.adt_22.0.4.v201307151829--741630.jar *
$ cd ..
$ rm -r hacked_adt
This worked for me... thanks E:V:A
I got just one error related to a dropbox class, but i think this is not important... hope that
lenieto3 said:
...Start an avd running the desired API to modify in this case API-17... This worked for me... I got just one error related to a dropbox class, but i think this is not important...
Click to expand...
Click to collapse
Thanks and sorry for late reply. I'm very happy to hear these instructions still works with API-17! Could you also upload your hacked JAR somewhere so that people can save some time when experimenting?
I was just here to check-in and try to bump this thread to see if it is still useful to anyone.
E:V:A said:
Thanks and sorry for late reply. I'm very happy to hear these instructions still works with API-17! Could you also upload your hacked JAR somewhere so that people can save some time when experimenting?
I was just here to check-in and try to bump this thread to see if it is still useful to anyone.
Click to expand...
Click to collapse
ive got access to ActivityManager's hidden methods.
I want to use the removeTask method, but it keeps saying that I dont have the REMOVE_TASKS permissions even though I added it to the manifest (and turned off lint).
Permission Denial: removeTask() from pid=9963, uid=10179 requires android.permission.REMOVE_TASKS
Does someone know if there are any automated tools to do/performs steps 1-9?
I'd like to see a tool to automatically pull (from phone), extract and create a compatible android.jar.
@Mohammad_Adib: Sorry, this is the wrong thread for those type of questions.
see this link stackoverflow.com|questions|30656933|android-system-framework-jar-files

Commander: [Cygwin + Cmder]

Commander:
Cygwin + Cmder, this pack is intended for Android, but does much more. I consolidated the pack myself, and thought it might help others using Windows.
Features:
Easy admin and shell switching, with tabs and multi shell support.
Full drag and drop "to-path" support, even as admin.
Various user defined settings and features.
Fully portable (usb for example).
----
Shortcut:
Right click "Cmder.exe" and select "create shortcut", then right click it and "rename" it to "Commander".
Press the "Windows key + R" and copy-paste the following directory location:
%ProgramData%\Microsoft\Windows\Start Menu\Programs
Right click and "cut" your shortcut, then right click "paste" into the folder, then close the folder.
Note: You can also change the icon of the shortcut, there are more in the "icons" folder.
----
Change the "startup shell" if you want to replace-combine CMD and PowerShell.
----
I take no credit for the app and binary's, I simply consolidated the two and pre-configured it.
http://www.mediafire.com/folder/lzsf7xd2wwsm4/Commander
Current version: 2019-03-14 (14-03-2019, UK), stable.
----
Screenshots and more info below
----
Example usage and path strings:
https://ibb.co/nQML4zd
https://ibb.co/GQJsRvM
https://ibb.co/k1VYkCx
Add path to environmental path:
https://ibb.co/KqvM2v0
Optional install method:
https://ibb.co/jkkM3r9
----
How to setup working directories, plus a few other tricks. In this guide I will be using 'bootimg' which unpacks-repacks boot.img and recovery.img files, it also requires a working directory.
Method 1 is the quickest, but teaches much less. Method 2 takes longer but teaches you a few tricks along the way.
----
Method 1:
First I make a 'TMP' folder on my 'D:' drive || mkdir D:\TMP
Next I move my 'boot.img' to 'TMP' || mv D:\Files\Desktop\boot.img D:\TMP
Now I check all is well || ls D:\TMP
Next to set the working directory || cd /d D:\TMP
Now I run 'bootimg' || bootimg --unpack-bootimg boot.img
https://ibb.co/6nV8dCw
Method 2:
First I make a working directory || mkdir %commander%\rom
Next I check that worked || ls %commander%
Now I move 'bootimg.exe' to '\rom' || mv %commander%\bin\bootimg.exe %commander%\rom
Next I check that worked || ls %commander%\rom
https://ibb.co/ZxRQhXz
Now I make a winlink as 'admin', making things easier || mklink %commander%\bin\bootimg.exe %commander%\rom\bootimg.exe
https://ibb.co/YbYPwm9
Now I check the symlink is working' || bootimg /?
Next I copy my 'boot.img' to '\rom' || xcopy D:\Files\Desktop\boot.img %commander%\rom
https://ibb.co/yW2mVP5
Now I set the working directory || cd /d %commander%\rom
Next I run 'bootimg' || bootimg --unpack-bootimg boot.img
https://ibb.co/njZ2fdz
Note: %commander% is an environmental path, which points to my Commander location (see post 2).
----
Notes:
You can run more than one command per line, by using '&' or '&&' (and then), which can be used more than once.
Make a folder and explore it || mkdir %commander%\rom & explorer %commander%\rom
Winlinks are symlinks, they also accept 'posixpath' as strings, example: "/vendor".
----
Useful apps (limited use with Android): OSFMount | Ext2fsd | VirtualBox
VB Images: https://www.osboxes.org/virtualbox-images/
----
Screenshot weblinks fixed, I apologize.
----
How to customize, and in some part produce a rom from another rom (ideally a stock one), without data corruption and incorrect metadata, corrupt other.
Note: OSFMount + Ext2fsd, and also FreeBSD (Unix) do not interface with non-standard data for android partitions (ext4, lightly modded).
----
Interestingly both OSFMount + Ext2fsd and FreeBSD fail at the same general issue, metadata and file attributes (ext is not native).
With FreeBSD, chattr and lsattr do not function, they run, but read and write nothing, 'noatime' is not applied to files.
Note: FreeBSD will allow you to change permissions on symlinks (chmod -h), whereas linux does not.
----
First, it's likely the 'system.img' file is a sparse one, and cannot be mounted, so you will need to convert it to a raw 'system.img'.
simg2img Path-to-in\system.img Path-to-out\system.img
----
Now you will need to setup a debian distro on VirtualBox, I suggest 'Lubuntu', it's lighter and faster, and fully compatible., here is a quick after install guide:
Install guest additions via the iso, and terminal as 'root' (sudo), simply type 'sudo' and drag and drop the linux setup file into the console.
Setup shares for the current user || sudo usermod -aG vboxsf YOURUSERNAME
Full install guide: https://linuxhint.com/install_ubuntu_18-04_virtualbox/
Share: https://www.whonix.org/wiki/VirtualBox/Guest_Additions
----
Once you have setup shared folders (in my case 'D:\Files' as '/home/ferather/Files') copy the 'system.img' to '/'.
You can now mount it, and modify almost everything without metadata corruption.
Lubuntu (18.10):
sudo mkdir /system & sudo mount /system.img /system & sudo pcmanfm-qt /system
or
sudo mkdir /system & sudo losetup -fP /system.img & sudo mount -o noatime /dev/loop1 /system & sudo pcmanfm-qt /system
NomadBSD (1.2):
sudo mkdir /system & sudo mdconfig -a -t vnode -f /system.img -u 1 & sudo mount -t ext2fs -o noatime /dev/md1 /system & sudo pcmanfm /system
Note: 'pcmanfm-qt' and 'pcmanfm' are file managers, with root icons and theme.
----
How to boot:
You will need to unpack your 'boot.img', see post 3 for more details. Once unpacked you will need to modify the 'fstab.xxxx', where xxx varies with device.
I am using 'Programmers notepad' to modify linux files under windows, it's fully compatible with LF and CR line endings.
Now open your 'fstab.xxx' file, and find /system, and remove the verify part, example:
Old || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata
New || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait
Now you will need to repack your modified boot back into 'boot.img', for good measure you should unpack and do the same to the 'recovery.img'.
Note: If you wish to add tweaks to a '.prop' file, but want to maintain stock and verify, add them to 'default.prop' in 'boot.img'.
----
Tips:
Using 7-zip on windows you can inspect the raw 'system.img', which includes permissions, file attributes and symlink targets.
If you go to 'File > Properties' you can also see additional drive and-or partition information, and hidden bits.
Setting attributes (noatime) to symlinks may be difficult with Linux and Unix, try Android (xattr?).
Cygwin symlinks are actual files, and can have file attributes (using 'chattr').
You can also run Lubuntu direct from live cd-dvd or usb.
----
If you need to install the 'VirtualBox Extension Pack', use Commader as Admin:
https://ibb.co/nwBbnd7
----
Helpful commands for Android, alter to suit, various commands also work with Commander, enjoy:
https://www.mediafire.com/file/t03wq2gutu1ek11/Commands.zip
----
How to convert a less common drive image into a more common drive image, and then convert it into a virtual drive image, which is dynamic and is 12GB in size.
In this example I will be using 'NomadBSD' which normally flashes to a USB, and has no drive install method (setup for current drive, usb).
First I need to convert the '.efi' file into an '.img' file using Commander || dd if=D:\Files\Downloads\nomadbsd-1.2-RC2.efi of=D:\Files\Downloads\NomadBSD.img
Next I convert it into a dynamic '.vdi' file || "C:\Program Files\Virtual Box\VBoxManage" convertfromraw -format VDI "D:\Files\Downloads\NomadBSD.img" "D:\Files\Downloads\NomadBSD.vdi" --variant Standard
Now I want to resize it to 12GB || "C:\Program Files\Virtual Box\VBoxManage" modifyhd "D:\Files\Downloads\NomadBSD.vdi" --resize 12288
I prefer another format '.vmdk' || "C:\Program Files\Virtual Box\VBoxManage" clonehd "D:\Files\Downloads\NomadBSD.vdi" "D:\Virtual\NomadBSD.vmdk" --format vmdk
Next I delete unused files || del /f D:\Files\Downloads\NomadBSD.img & del /f D:\Files\Downloads\NomadBSD.vdi
For good measure I check before closing || ls D:\Files\Downloads\ & ls D:\Virtual\
https://ibb.co/3NW22Wz
Now setup VirtualBox, when at the drive setup part, drag and drop your created drive into the VirtualBox created folder, in this case 'D:\Virtual\Nomad\'.
Select 'Existing drive' and add your created drive image, I have a SSD, so I also check the 'SSD' option within the machine preferences.
----
How to setup nomad as a virtual guest:
sudo su
pkg update && pkg upgrade
pkg install virtualbox-ose
pw groupmod vboxusers -m nomad
pw groupmod operator -m nomad
pkg autoremove
geany /boot/loader.conf
Add || vboxdrv_load="YES"
Add || vboxvfs_load="YES"
geany /etc/rc.conf
Add || vboxservice_enable="YES"
Add || vboxguest_enable="YES"
reboot
--
How to mount a drive img:
After mdconfig (see post 4) || sudo dsbmc || This will open the mount manager as 'root'.
Generic method || sudo mount -t FILESYSTEM /DEVICE /LOCATION
--
How to fix the screen resolution:
Menu > Settings > ARandR > Outputs > Select a supported resolution > Save as: monitor > Open Pcmanfm > View > Show Hidden > .screenlayout > Edit 'monitor.sh' to suit.
https://ibb.co/1sCK0qP
Menu > Settings > DSBAutostart > Add: ~./screenlayout/monitor.sh > Move up to the top > Delete: redphase, batterymon and the audio monitor.
https://ibb.co/ZVpHrhM
--
How to setup shared folders:
In your virtual machine, select: Settings > Shared Folders > Add > Select your folder, but don't bother with auto-mount as it does not work with FreeBSD.
https://ibb.co/p3KQ4dx
Now I make a folder to mount my shared folder || mkdir ~/Files & chmod 777 ~/Files || Note '~' means current user home: /home/nomad
https://ibb.co/3pzDbqR
Next I create a script that will auto-mount drives || >~/.config/shared.sh
Now I need to edit the script || geany ~/.config/shared.sh
Header: #!/bin/sh || Code: mount -t vboxvfs Files ~/Files
https://ibb.co/qgkJ3Zb
Next I add the script to auto start || dsbautostart
https://ibb.co/4YD3VhD
reboot
----
Note for Lubuntu:
To install Lubuntu on virtualbox, disconnect the network cable (in preferences), I believe a web address has changed.
Do not 'disable' the virtual adapter, otherwise the install will not setup any drivers by default.
https://ibb.co/fXGqN3p
----
How to create a shared storage drive:
This method uses a virtual drive with NTFS as a universal filesystem bridge between OS's.
The drive can be mounted via Windows, which allows you to transfer files.
https://ibb.co/6RmzT5t
https://ibb.co/3Fr3g3m
https://ibb.co/qyzKRvs
https://ibb.co/71y5TVr
https://ibb.co/d2DMG99
https://ibb.co/2nvpqJZ
https://ibb.co/kSvDw4T
https://ibb.co/gSWmwNd
https://ibb.co/j4PtzCj
https://ibb.co/DwLjfgJ
Tips:
Drive image files (example, system.img) can be directly mounted from the storage.
Remember to unmount, detach the virtual disk in Windows.
----
If you have 'su', superuser on your phone, you can use Commander as the terminal:
adb shell || Then || su || To test || ls /system/bin
----
Helpful links:
Linux manual | FreeBSD manual | A-Z bash commands | ADB shell manual
----
Android for PC, can be used in VirtualBox, or installed to a hard-drive or usb-flash.
Recommended: PrimeOS - I tested the classic edition.
Other: PhoenixOS, Bliss ROM's, Android-x86.
My UEFI motherboard allows me to fully power down internal sata devices.
This prevents boot installers from overwriting the current one.
Tip: You can download apps (example: Terminal) via the market or Chrome.
----
Guide updated slightly, also the command 'cp' can preserve attributes, including symlink attributes (noatime).
http://man7.org/linux/man-pages/man1/cp.1.html

Categories

Resources