Difference between revisions of "Android"

From HyperSecurity Wiki
Jump to: navigation, search
Line 40: Line 40:
 
  cd /dev/block/platform/msm_sdcc.1/by-name/
 
  cd /dev/block/platform/msm_sdcc.1/by-name/
 
  ls -las
 
  ls -las
 +
 +
 +
 +
== Back up of a single partition (tar = only files and folders) ==
 +
 +
In this case, you need the partition mounted. To see the list of mounted partitions type on Cygwin Terminal
 +
Code:
 +
 +
adb shell mount
 +
 +
Now you need to know where is mounted the partition you want to backup, for example the firmware is mounted on /system, which is the ROM.
 +
In this case you will have to open three terminals, because of android limitations:
 +
 +
Open one terminal and create a fifo, in /cache, for example, and redirect the tar there
 +
Code:
 +
 +
adb forward tcp:5555 tcp:5555
 +
adb shell
 +
su
 +
/system/xbin/busybox mkfifo /cache/myfifo
 +
/system/xbin/busybox tar -cvf /cache/myfifo /system
 +
 +
We have to do it this way because redirecting the tar to stdout (with - ) is broken on android and will corrupt the tar file.
 +
 +
Open a second terminal and type:
 +
Code:
 +
 +
adb forward tcp:5555 tcp:5555
 +
adb shell
 +
su
 +
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox cat /cache/myfifo
 +
 +
Open a third terminal and type:
 +
Code:
 +
 +
adb forward tcp:5555 tcp:5555
 +
cd /path/to/store/the/backup
 +
nc 127.0.0.1 5555 | pv -i 0.5 > system.tar
 +
 +
You can browse the tar file with Winrar, Total Commander, PeaZip and almost any compression tool. Note that you shouldn't extract files or edit it since the tar format saves the permission and owner data for each file, that is lost when extracted to FAT / NTFS partitions and you will mess things when restoring.

Revision as of 17:00, 3 June 2015

SDK Setup

http://xmodulo.com/how-to-run-android-emulator-on-ubuntu-or-debian.html

CID

CID would appear to stand for 'Country ID' - but LTE users have found flashing a different number CID firmware (than their original) broke network support. More here.
CID6 = XT1031 - CDMA (Republic Wireless US)
CID7 = XT1032 - European Global GSM (Single-SIM) or XT1033 - Retail Asia (Dual-SIM) 
CID9 = XT1031 - CDMA (Boost US) or XT1032 - Retail US Global GSM or XT1034 - Retail US AWS
CID12 = XT1032 - Latin America / Brazil Global GSM (Single-SIM) or XT1033 - Latin America / Brazil Global GSM (Dual-SIM) 
CID14 = XT1034 - Retail Canada AWS or XT1034 - Bell Canada AWS

IMEI

IMEI=$(cat /proc/config/imei/ascii)
echo 'AT+EGMR=1,14,'"$IMEI" > /dev/pttycmd1

Commands

List all files:

ls -lRa

Remount file system as read/write:

mount -o remount,rw /system

Symbolic Link:

ln -sf /system/efs

Change modes:

chmod 0555 filename

Busybox:

/system/xbin/busybox

Diag Mode:

setprop sys.usb.config diag,adb


Find all mount points:

cd /dev/block/platform/msm_sdcc.1/by-name/
ls -las


Back up of a single partition (tar = only files and folders)

In this case, you need the partition mounted. To see the list of mounted partitions type on Cygwin Terminal Code:

adb shell mount

Now you need to know where is mounted the partition you want to backup, for example the firmware is mounted on /system, which is the ROM. In this case you will have to open three terminals, because of android limitations:

Open one terminal and create a fifo, in /cache, for example, and redirect the tar there Code:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox mkfifo /cache/myfifo
/system/xbin/busybox tar -cvf /cache/myfifo /system

We have to do it this way because redirecting the tar to stdout (with - ) is broken on android and will corrupt the tar file.

Open a second terminal and type: Code:

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox cat /cache/myfifo

Open a third terminal and type: Code:

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > system.tar

You can browse the tar file with Winrar, Total Commander, PeaZip and almost any compression tool. Note that you shouldn't extract files or edit it since the tar format saves the permission and owner data for each file, that is lost when extracted to FAT / NTFS partitions and you will mess things when restoring.