Guest User

Untitled

a guest
Apr 20th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.08 KB | None | 0 0
  1. #!/system/bin/sh
  2.  
  3. PATH=/sbin:/system/bin:/system/xbin
  4.  
  5. # Run original binary
  6. /system/bin/mot_boot_mode.bin "$@"
  7.  
  8. # Get USB mode (if fail, boot USB enumeration mode)
  9. USBMODE=$(getprop ro.usb_mode)
  10.  
  11. # Write date to log
  12. RUNDATE=`date`
  13.  
  14. # Write uid/gid to log
  15. RUNAS=`id`
  16.  
  17. # Set old and new init.rc locations
  18. OLDINIT=/init.rc
  19. NEWINITRC=/system/etc/rootfs/init.rc
  20.  
  21. # Get md5 sums for old and new init.rc
  22. OLDMD5=`cat $OLDINIT | md5sum`
  23. NEWMD5=`cat $NEWINIT | md5sum`
  24.  
  25. # Set additional root files locations
  26. NEWMAPPHONE=/system/etc/rootfs/init.olympus.rc
  27. NEWPHONEUEVENTD=/system/etc/rootfs/ueventd.olympus.rc
  28. NEWPROP=/system/etc/rootfs/default.prop
  29. NEWINIT=/system/etc/rootfs/init
  30. NEWUVENTD=/system/etc/rootfs/ueventd.rc
  31. # Check log dir
  32. if [ ! -d /data/2nd-init ]; then
  33.     mkdir /data/2nd-init
  34. fi
  35.  
  36. echo "Run date: $RUNDATE." >> /data/2nd-init/log
  37. echo "Running as: $RUNAS." >> /data/2nd-init/log
  38. echo "Usb mode is: $USBMODE." >> /data/2nd-init/log
  39.  
  40. # Run 2nd-init if not in debug mode
  41. if [ "$USBMODE" = "debug" ]; then
  42.     # Compare md5 hash to determine useful copy
  43.     if [ "$OLDMD5" != "$NEWMD5" ]; then
  44.         # Remount rootfs read/write to copy new files
  45.         mount -o remount,rw rootfs / >> /data/2nd-init/log 2>&1
  46.         mount -o remount,rw /system/
  47. #        mv /sbin/adbd /sbin/adbd.old
  48.         setprop ctl.stop runtime
  49.         setprop ctl.zygote
  50.         setprop persist.service.adb.enable 1
  51.         # Copy new root files
  52.     cp -p /system/bin/fixboot.sh /sbin
  53.     cp -p /system/bin/hijack.killall /sbin
  54.     cp -p /system/xbin/busybox /sbin
  55.     chmod 777 /sbin/busybox
  56.     cp -p /system/etc/rootfs/* /.
  57.     cp -p /system/etc/rootfs/sbin/* /sbin
  58.         #Setup BusyBox
  59.         cd /sbin
  60.         ln -s busybox [
  61.         ln -s busybox [[
  62.         ln -s busybox ash
  63.         ln -s busybox awk
  64.         ln -s busybox basename
  65.         ln -s busybox bbconfig
  66.         ln -s busybox bunzip2
  67.         ln -s busybox bzcat
  68.         ln -s busybox bzip2
  69.         ln -s busybox cal
  70.         ln -s busybox cat
  71.         ln -s busybox catv
  72.         ln -s busybox chattr
  73.         ln -s busybox chgrp
  74.         ln -s busybox chmod
  75.         ln -s busybox chown
  76.         ln -s busybox chroot
  77.         ln -s busybox cksum
  78.         ln -s busybox clear
  79.         ln -s busybox cmp
  80.         ln -s busybox cp
  81.         ln -s busybox cpio
  82.         ln -s busybox cut
  83.         ln -s busybox date
  84.         ln -s busybox dc
  85.         ln -s busybox dd
  86.         ln -s busybox depmod
  87.         ln -s busybox devmem
  88.         ln -s busybox df
  89.         ln -s busybox diff
  90.         ln -s busybox dirname
  91.         ln -s busybox dmesg
  92.         ln -s busybox dos2unix
  93.         ln -s busybox du
  94.         ln -s busybox echo
  95.         ln -s busybox egrep
  96.         ln -s busybox env
  97.         ln -s busybox expand
  98.         ln -s busybox expr
  99.         ln -s busybox false
  100.         ln -s busybox fdisk
  101.         ln -s busybox fgrep
  102.         ln -s busybox find
  103.         ln -s busybox fold
  104.         ln -s busybox free
  105.         ln -s busybox freeramdisk
  106.         ln -s busybox fuser
  107.         ln -s busybox getopt
  108.         ln -s busybox grep
  109.         ln -s busybox groups
  110.         ln -s busybox gunzip
  111.         ln -s busybox gzip
  112.         ln -s busybox head
  113.         ln -s busybox hexdump
  114.         ln -s busybox id
  115.         ln -s busybox insmod
  116.         ln -s busybox install
  117.         ln -s busybox kill
  118.         ln -s busybox killall
  119.         ln -s busybox killall5
  120.         ln -s busybox length
  121.         ln -s busybox less
  122.         ln -s busybox ln
  123.         ln -s busybox losetup
  124.         ln -s busybox ls
  125.         ln -s busybox lsattr
  126.         ln -s busybox lsmod
  127.         ln -s busybox lspci
  128.         ln -s busybox lsusb
  129.         ln -s busybox lzcat
  130.         ln -s busybox lzop
  131.         ln -s busybox lzopcat
  132.         ln -s busybox makedevs
  133.         ln -s busybox md5sum
  134.         ln -s busybox mkdir
  135.         ln -s busybox mkfifo
  136.         ln -s busybox mkfs.ext2
  137.         ln -s busybox mknod
  138.         ln -s busybox mkswap
  139.         ln -s busybox mktemp
  140.         ln -s busybox modinfo
  141.         ln -s busybox modprobe
  142.         ln -s busybox more
  143.         ln -s busybox mount
  144.         ln -s busybox mountpoint
  145.         ln -s busybox mv
  146.         ln -s busybox nanddump
  147.         ln -s busybox nandwrite
  148.         ln -s busybox nice
  149.         ln -s busybox nohup
  150.         ln -s busybox od
  151.         ln -s busybox patch
  152.         ln -s busybox pgrep
  153.         ln -s busybox pidof
  154.         ln -s busybox pkill
  155.         ln -s busybox printenv
  156.         ln -s busybox printf
  157.         ln -s busybox ps
  158.         ln -s busybox pstree
  159.         ln -s busybox pwd
  160.         ln -s busybox rdev
  161.         ln -s busybox readlink
  162.         ln -s busybox realpath
  163.         ln -s busybox renice
  164.         ln -s busybox reset
  165.         ln -s busybox resize
  166.         ln -s busybox rev
  167.         ln -s busybox rm
  168.         ln -s busybox rmdir
  169.         ln -s busybox rmmod
  170.         ln -s busybox run-parts
  171.         ln -s busybox sed
  172.         ln -s busybox seq
  173.         ln -s busybox setconsole
  174.         ln -s busybox setserial
  175.         ln -s busybox setsid
  176.         ln -s busybox sh
  177.         ln -s busybox sha1sum
  178.         ln -s busybox sha256sum
  179.         ln -s busybox sha512sum
  180.         ln -s busybox sleep
  181.         ln -s busybox sort
  182.         ln -s busybox split
  183.         ln -s busybox stat
  184.         ln -s busybox strings
  185.         ln -s busybox stty
  186.         ln -s busybox swapoff
  187.         ln -s busybox swapon
  188.         ln -s busybox sync
  189.         ln -s busybox sysctl
  190.         ln -s busybox tac
  191.         ln -s busybox tail
  192.         ln -s busybox tar
  193.         ln -s busybox tee
  194.         ln -s busybox test
  195.         ln -s busybox time
  196.         ln -s busybox top
  197.         ln -s busybox touch
  198.         ln -s busybox tr
  199.         ln -s busybox true
  200.         ln -s busybox tty
  201.         ln -s busybox umount
  202.         ln -s busybox uname
  203.         ln -s busybox unexpand
  204.         ln -s busybox uniq
  205.         ln -s busybox unix2dos
  206.         ln -s busybox unlzma
  207.         ln -s busybox unlzop
  208.         ln -s busybox unxz
  209.         ln -s busybox unzip
  210.         ln -s busybox uptime
  211.         ln -s busybox usleep
  212.         ln -s busybox uudecode
  213.         ln -s busybox uuencode
  214.         ln -s busybox watch
  215.         ln -s busybox wc
  216.         ln -s busybox which
  217.         ln -s busybox whoami
  218.         ln -s busybox xargs
  219.         ln -s busybox xzcat
  220.         ln -s busybox yes
  221.         ln -s busybox zcat
  222.         cd /
  223.  
  224.     #log file structs
  225.     ls -l / >> /data/2nd-init/rootstruct.txt
  226.     ls -l /sbin >> /data/2nd-init/sbinstruct.txt
  227.     ls -l /system/etc/rootfs >> /data/2nd-init/rootfsstruct.txt
  228.         #Run kill all
  229.         /sbin/hijack.killall >> /data/2nd-init/ka.log 2>&1 #Not working hijack worked?
  230.         ps -x >> /data/2nd-init/ps.log #nothing too ?  Because the killall worked?
  231.         # Set dual-core processor affinity
  232.         taskset -p -c 0 1
  233.  
  234.         # Sync buffer and write
  235.         sync
  236.  
  237.         # Set task to CPU 0 and run 2nd-init
  238.         taskset -c 0 /system/bin/2nd-init >> /data/2nd-init/log 2>&1 #not working hijack worked?
  239.  
  240.         echo "2nd-init completed successfully." >> /data/2nd-init/log #not working hijack worked?
  241.     fi
  242. fi
  243.  
  244. # Bump log for next time
  245. echo "" >> /data/2nd-init/log
Add Comment
Please, Sign In to add comment