Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #198 from offensive-security/2019.2-dev
Browse files Browse the repository at this point in the history
2019.2 dev
  • Loading branch information
Re4son authored Feb 25, 2019
2 parents 1632985 + 0caf91a commit f1ab685
Show file tree
Hide file tree
Showing 52 changed files with 2,100 additions and 345 deletions.
7 changes: 4 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<uses-permission android:name="com.offsec.nhterm.permission.RUN_SCRIPT_SU" />
<uses-permission android:name="com.offsec.nhterm.permission.RUN_SCRIPT_NH" />
<uses-permission android:name="com.offsec.nhterm.permission.RUN_SCRIPT_NH_LOGIN" />
<uses-permission android:name="com.offsec.nhvnc.permission.OPEN_VNC_CONN" />
<!-- <uses-permission android:name="com.offsec.nhvnc.permission.OPEN_VNC_CONN" /> -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
Expand Down Expand Up @@ -89,9 +89,10 @@
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":runAtBoot" />
<service
android:name="gps.LocationUpdateService"
android:name=".gps.LocationUpdateService"
android:enabled="true"
android:exported="false" />
</application>

</manifest>
</manifest>

76 changes: 73 additions & 3 deletions assets/etc/init.d/50userinit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/system/bin/sh

log running userinit.sh
if [ -x /system/xbin/busybox ]; then
busybox=/system/xbin/busybox
Expand All @@ -14,6 +15,72 @@ fi

log Running userinit.sh...

mount_sdcard() {
mountpoint -q "$mnt/sdcard" && return 0

for sdcard in \
"$EXTERNAL_STORAGE" \
/storage/emulated/0 \
/storage/emulated/legacy \
/storage/sdcard0 \
/sdcard
do
[ -d "$sdcard" ] &&
$busybox mount -o bind "$sdcard" "$mnt/sdcard" &&
return 0
done
return 1
}

mount_external_sd() {
mountpoint -q "$mnt/external_sd" && return 0

for external_sd in \
/storage/extSdCard \
/storage/sdcard1 \
/storage/external_sd \
/external_sd
do
[ -d "$external_sd" ] &&
$busybox mount -o bind "$external_sd" "$mnt/external_sd" &&
return 0
done
return 1
}

mount_usbdisk() {
mountpoint -q "$mnt/mnt/usbdisk" && return 0

for usbdisk in /storage/usb*; do
[ -d "$usbdisk" ] &&
$busybox mount -o bind "$usbdisk" "$mnt/mnt/usbdisk" &&
return 0
done
return 1
}

mount_external_storage() {
external_sd_mounted=false
usbdisk_mounted=false
mount_external_sd && external_sd_mounted=true
mount_usbdisk && usbdisk_mounted=true

# try marshmallow storage names
for storage in /storage/*-*; do
# if both mount successfully then skip
$external_sd_mounted && $usbdisk_mounted && return
if [ -d "$storage" ]; then
if ! $external_sd_mounted; then
$busybox mount -o bind "$storage" "$mnt/external_sd" &&
external_sd_mounted=true
elif ! $usbdisk_mounted; then
$busybox mount -o bind "$storage" "$mnt/usbdisk" &&
usbdisk_mounted=true
fi
fi
done
}

######### EXPORT #########
#mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export bin=/system/bin
Expand All @@ -27,8 +94,10 @@ export LOGNAME=root

######### MOUNT #########
$busybox mount -o remount,suid /data
$busybox mount -o bind /system $mnt/system
$busybox mount -o bind /sdcard $mnt/sdcard
$busybox mount -r -o bind /system $mnt/system
mount_sdcard
mount_external_storage
##$busybox mount -o bind /sdcard $mnt/sdcard
$busybox mount -o bind /dev $mnt/dev
$busybox mount -t devpts devpts $mnt/dev/pts
$busybox mount -t proc proc $mnt/proc
Expand Down Expand Up @@ -66,4 +135,5 @@ echo "kali" > $mnt/proc/sys/kernel/hostname

# execute startup script

log userinit.sh is completed.
log userinit.sh is completed.

Loading

0 comments on commit f1ab685

Please sign in to comment.