├── README.md ├── debdroidv4.zip └── src ├── META-INF ├── CERT.RSA ├── CERT.SF ├── MANIFEST.MF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script └── system ├── bin ├── debdroid ├── debkill └── debshell └── etc ├── debdroid.conf └── init.d └── 09debdroid /README.md: -------------------------------------------------------------------------------- 1 | Debdroid V4 2 | ======== 3 | 4 | ##Linux Chroot Daemon for Android 5 | ##Supports Android 2.3 through 5.0 6 | #Overview: 7 | Debdroid is a tool for the Android platform which runs a full Linux distribution as a daemon. 8 | Any rooted device can run fully supported ARM distributions such as Kali, Debian, Ubuntu, etc. 9 | 10 | Debdroid has been successfully tested on Android 2.3 and up to 5.0. Confirmed working on N9 5.0. 11 | 12 | #How To Install: 13 | ###1. Download the git repo 14 | ###2. Place ARM image at /sdcard/linux.img 15 | ###3. Flash the zip file in twrp 16 | 17 | #How To Use: 18 | ###1. debshell "cmd" - run any command under linux 19 | ###2. debshell "passwd" - change root pass 20 | ###3. debshell "/etc/init.d/ssh restart" - starts ssh 21 | ###4. debshell bash - full access to a bash chroot 22 | -------------------------------------------------------------------------------- /debdroidv4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasmoover/debdroid/2f7c2ff0c5105097f6fcc27696b16308808a5b9e/debdroidv4.zip -------------------------------------------------------------------------------- /src/META-INF/CERT.RSA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasmoover/debdroid/2f7c2ff0c5105097f6fcc27696b16308808a5b9e/src/META-INF/CERT.RSA -------------------------------------------------------------------------------- /src/META-INF/CERT.SF: -------------------------------------------------------------------------------- 1 | Signature-Version: 1.0 2 | Created-By: 1.0 (JRummy Apps Inc.) 3 | SHA1-Digest-Manifest: mC2kxGle6nXCFOz4eVKZKRH4dq8= 4 | 5 | Name: META-INF/com/google/android/update-binary 6 | SHA1-Digest: A1e3bS87qeP0suypQEZd5JkBY8E= 7 | 8 | Name: system/etc/init.d/09debdroid 9 | SHA1-Digest: Rq+WfpAJ1BuyxGD307hjawgw9Fs= 10 | 11 | Name: META-INF/com/google/android/updater-script 12 | SHA1-Digest: LhxnyOHT0belfvWhny7w4JpRba0= 13 | 14 | Name: system/bin/debdroid 15 | SHA1-Digest: K4pwS7Efo0uLMgMorEu4vuNI4fw= 16 | 17 | Name: system/bin/debshell 18 | SHA1-Digest: BYPqBaVgwfX82MyI7p85wad9r50= 19 | 20 | Name: system/bin/debkill 21 | SHA1-Digest: smcZ046mzL0dpTK96tWOEi+Wov4= 22 | 23 | -------------------------------------------------------------------------------- /src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.0 (JRummy Apps Inc.) 3 | 4 | Name: system/etc/init.d/09debdroid 5 | SHA1-Digest: w82mKFi0xehTjIL4A+8FSZDu5GU= 6 | 7 | Name: META-INF/com/google/android/update-binary 8 | SHA1-Digest: ygSP0NefcGv5SErY1AZLNH7HpZM= 9 | 10 | Name: system/bin/debdroid 11 | SHA1-Digest: 9R0csMBV4X59Ndpp2ZoQhszCh54= 12 | 13 | Name: META-INF/com/google/android/updater-script 14 | SHA1-Digest: 9MucLHDZeJ5g8TZ7F24um1An6So= 15 | 16 | Name: system/bin/debshell 17 | SHA1-Digest: +E01TYL3AlFxqdnpjnpPxU9Dcyk= 18 | 19 | Name: system/bin/debkill 20 | SHA1-Digest: 9e5PByFRo9S9Yy3IRhvpPk6iM9o= 21 | 22 | -------------------------------------------------------------------------------- /src/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasmoover/debdroid/2f7c2ff0c5105097f6fcc27696b16308808a5b9e/src/META-INF/com/google/android/update-binary -------------------------------------------------------------------------------- /src/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | ui_print("****************************************"); 2 | ui_print("* Script generated by JRummy Apps Inc. *"); 3 | ui_print("* Follow us on Facebook! *"); 4 | ui_print("* http://www.facebook.com/JRummyApps *"); 5 | ui_print("****************************************"); 6 | ui_print(""); 7 | ui_print(""); 8 | 9 | show_progress(1.000000, 0); 10 | ui_print("Mounting filesystems..."); 11 | run_program("/sbin/busybox", "mount", "/system"); 12 | set_progress(0.100000); 13 | 14 | ui_print("Extracting files..."); 15 | package_extract_dir("system", "/system"); 16 | set_progress(0.300000); 17 | 18 | ui_print("Setting permissions..."); 19 | set_perm(1000, 1000, 0660, "/system/bin/debdroid"); 20 | set_perm(0, 0, 0755, "/system/bin/debkill"); 21 | set_perm(0, 0, 0755, "/system/bin/debshell"); 22 | set_perm(0, 0, 0755, "/system/etc/init.d/09debdroid"); 23 | set_perm(0, 0, 0700, "/system/linux"); 24 | set_progress(0.400000); 25 | set_progress(0.500000); 26 | set_progress(0.700000); 27 | 28 | # Unmounting filesystems... 29 | run_program("/sbin/busybox", "umount", "/system"); 30 | set_progress(0.900000); 31 | 32 | 33 | set_progress(1.000000); 34 | ui_print("****************************************"); 35 | ui_print("* Install Complete! *"); 36 | ui_print("****************************************"); 37 | -------------------------------------------------------------------------------- /src/system/bin/debdroid: -------------------------------------------------------------------------------- 1 | #echo revision 9001 2 | source /etc/debdroid.conf 3 | init() { 4 | 5 | #required for mount -o to function 6 | #ifconfig wlan0 promisc #must be initialized or will crash when doing it on debian 7 | #mtdblock012 - olympus 8 | #mtdblock3 - supersonic, incredible 9 | 10 | export kit=$mnt 11 | export bin=/system/bin 12 | 13 | export mnt=$mnt 14 | export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH 15 | export TERM=linux 16 | export USER=root 17 | export HOME=/root 18 | } 19 | 20 | 21 | loop() { 22 | loop="/dev/block/loop$loopno" 23 | mknod $loop b 7 $loopno 2>> /dev/null 24 | mkdir /system/linux 25 | losetup /dev/block/loop$loopno $img 26 | mount -t ext4 /dev/block/loop$loopno $mnt 27 | #echo "MOUNTED FS" 28 | #mkdir /system/linux 29 | cd $mnt 30 | mkdir proc sys dev 31 | mkdir -p /system/linux/android/ 32 | mkdir -p /system/linux/storage/emulated/0/ 33 | mount -o bind /system /system/linux/android/system 34 | #mkdir -p /system/linux/android/sdcard 35 | #mkdir -p /system/linux/android/data 36 | mount -o bind /sdcard /system/linux/storage/emulated/0/ 37 | mount -o bind /data /system/linux/android/data 38 | } 39 | 40 | sysmount() { 41 | mount -t proc proc $mnt/proc 42 | mount -t sysfs sysfs $mnt/sys 43 | mount -o bind /dev $mnt/dev 44 | mount -t devpts devpts $mnt/dev/pts 45 | #mount -o bind $sharedir $mnt/mnt/share 2>> /dev/null 46 | #echo "$sharedir mounted to /mnt/share" 47 | echo "Native Filesystem mounted to /android" 48 | } 49 | 50 | networking() { 51 | sysctl -w net.ipv4.ip_forward=12 >> /dev/null 52 | #echo "Setting /etc/resolv.conf to DNS $nameserver1 and $nameserver2" 53 | echo "nameserver $nameserver1" > $mnt/etc/resolv.conf 2>> /dev/null 54 | echo "nameserver $nameserver2" >> $mnt/etc/resolv.conf 2>> /dev/null 55 | #echo "Setting localhost on /etc/hosts " 2>> /dev/null 56 | echo "127.0.0.1 localhost" > $mnt/etc/hosts 2>> /dev/null 57 | echo "$chostname" > $mnt/etc/hostname 58 | } 59 | 60 | 61 | mountrw 62 | echo "Initializing chroot filesystem" 63 | init 64 | loop 65 | echo 66 | echo "Mounting proc, sysfs, dev, devpts" 67 | sysmount 68 | echo 69 | echo "Setting up DNS and Networking" 70 | echo 71 | networking 72 | echo "Debdroid deployed succesfully, opening chroot." 73 | #mount -o bind /system $mnt/mnt/android 74 | chroot $mnt bash -c "hostname $chostname" 75 | chroot $mnt /bin/bash 76 | #After exit command is executed clear it all up 77 | echo 78 | 79 | #umount $mnt/mnt/share 80 | #umount $mnt/dev/pts 81 | #umount $mnt/dev 82 | #umount $mnt/proc 83 | #umount $mnt/sys 84 | #umount $mnt 85 | #echo "Exiting chroot" 86 | #echo "Filesystem unmounted" 87 | 88 | -------------------------------------------------------------------------------- /src/system/bin/debkill: -------------------------------------------------------------------------------- 1 | export mnt=/data/local/debdroid 2 | umount $mnt/dev/pts 3 | umount $mnt/dev 4 | umount $mnt/proc 5 | umount $mnt/sys 6 | umount $mnt/mnt/share/ 7 | umount $mnt/mnt/android/ 8 | umount $mnt 9 | echo "Exiting $chostname chroot" 10 | echo "Filesystem unmounted" 11 | losetup -d /dev/block/loop$loopno 12 | 13 | -------------------------------------------------------------------------------- /src/system/bin/debshell: -------------------------------------------------------------------------------- 1 | source /etc/debdroid.conf 2 | 3 | #required for mount -o to function 4 | #ifconfig eth0 promisc #must be initialized or will crash when doing it on debian 5 | 6 | export kit=$mnt 7 | export bin=/system/bin 8 | 9 | export mnt=$mnt 10 | export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH 11 | export TERM=linux 12 | export USER=root 13 | export HOME=/root 14 | echo "$chostname" > $mnt/etc/hostname 15 | 16 | echo "Opening $chostname chroot on loop$loopno" 17 | chroot $mnt bash -c "$1" 18 | #echo "Dropping to $chostname shell" 19 | #chroot $mnt /bin/bash 20 | #After exit command is executed clear it all up 21 | echo 22 | #echo "Exiting $chostname chroot - System is still running" 23 | 24 | -------------------------------------------------------------------------------- /src/system/etc/debdroid.conf: -------------------------------------------------------------------------------- 1 | # Debdroid General Config 2 | 3 | # Name server configuration 4 | nameserver1=8.8.8.8 5 | nameserver2=8.8.4.4 6 | 7 | # Chroot Hostname 8 | chostname="debdroid" 9 | 10 | # Loop Device Number, keep 255 if you want apps2sd support 11 | loopno=255 12 | 13 | # Path to Linux Image 14 | img="/sdcard/linux.img" 15 | 16 | # Shared Folder 17 | #sharedir="/sdcard/debdroid/share/" 18 | 19 | mnt="/system/linux" 20 | -------------------------------------------------------------------------------- /src/system/etc/init.d/09debdroid: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | #debdroid sub-system 3 | 4 | debdroid & 5 | echo "excecuted debdroid on $(date +"%d-%m-%Y %r" )" >> /data/daemons.log 6 | --------------------------------------------------------------------------------