├── fishing ├── .gitignore ├── fishfood.release ├── callmeFIsH ├── FIsH.me ├── gofishing.sh ├── FIsH.porting └── FIsH ├── .github ├── PULL_REQUEST_TEMPLATE.md └── issue_template.md ├── README.md ├── COPYING.LESSER ├── doc └── installguide_XDA_format.txt ├── install.sh └── COPYING /fishing/.gitignore: -------------------------------------------------------------------------------- 1 | /fishfood.gz 2 | /busybox 3 | -------------------------------------------------------------------------------- /fishing/fishfood.release: -------------------------------------------------------------------------------- 1 | UNDEFINED - check fishfood.release 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # WE DO NOT MERGE PULL REQUESTS SUBMITTED HERE 2 | 3 | You will need to submit it through [Our Gerrit](https://gerrit.nailyk.fr/#/admin/projects/android_FIsH) 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NEW LOCATION *** NEW LOCATION !! 2 | 3 | https://code.binbash.it:8443/Android/android_FIsH 4 | 5 | # android_FIsH 6 | Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 7 | 8 | # XDA thread with all the details 9 | 10 | https://tinyurl.com/FISHatXDA 11 | 12 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Disclaimer 2 | 3 | _FIsH does NOT unlock your bootloader or root your phone - it requires root to work though! 4 | FIsH itself will NOT let you "install" anything. 5 | FIsH is actually the FRAMEWORK(!) for a custom FIsHFOOD (ramdisk) you want to load (e.g. TWRP). 6 | FIsH does not ship with any FIsHFOOD so you need to compile/add your own!_ 7 | 8 | _For problems with the FIsHFOOD (e.g. TWRP) contact the developer of the FIsHFOOD instead! 9 | Nevertheless if you feel that FIsH is responsible for an issue with the FIsHFOOD proceed_ 10 | 11 | - [X] I know and understand that FIsH provides the **FRAMEWORK** for custom ramdisks only 12 | 13 | ### Contribution 14 | 15 | _Any help in the development is welcome so if you want to add new functionality or fixing a bug in FIsH just went over to:_ 16 | 17 | _[Our Gerrit](https://gerrit.nailyk.fr/#/admin/projects/android_FIsH)!_ 18 | 19 | 20 | ### Vendor & Model 21 | 22 | **PROVIDE THE EXACT MODEL NAME OF YOUR DEVICE!** 23 | 24 | _(remove all not matching lines)_ 25 | 26 | - issue is not related to a specific device or vendor 27 | - HTC 28 | - Samsung 29 | - LG 30 | - other (TELL ME WHICH!) 31 | 32 | ### Description 33 | 34 | _describe your bug report, feature request and be as detailed as possible_ 35 | _Logfiles and bigger pastes better goes to an external pastebin service like for example: http://paste.omnirom.org_ 36 | 37 | - Detailed description of the issue: 38 | 39 | 40 | ### Logs 41 | 42 | _Catch the FIsH logs! **WITHOUT THEM NO HELP!**_ 43 | 44 | 1. _when in TWRP (or other ramdisk providing adb shell): 45 | adb shell "cat /cache/fish/fish.log" 46 | adb shell "cat /tmp/recovery.log" 47 | 1. OR - when in Android: 48 | adb shell "su -c cat /cache/fish/fish.log" 49 | adb shell "su -c cat /cache/fish/fish.log.old" 50 | adb shell "su -c tar cvzf recoverylogs.tgz /cache/recovery" 51 | 1. adb pull recoverylogs.tgz 52 | 1. Upload the output to https://paste.omnirom.org and paste the link in the IRC channel_ 53 | 54 | - add your link(s) to the FIsH logs here: 55 | 56 | ### Links 57 | 58 | _If you have any other ressource might helping to solve the issue (XDA post, screenshot,...) add them here_ -------------------------------------------------------------------------------- /fishing/callmeFIsH: -------------------------------------------------------------------------------- 1 | ##################################################################################################### 2 | # 3 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 4 | # 5 | # Copyright (C) 2017 steadfasterX 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # 20 | # 21 | ###################################################################################################### 22 | 23 | FISHME=/system/fish/FIsH.me 24 | FISHPORT=/system/fish/FIsH.porting 25 | 26 | [ ! -f $FISHME ] && echo "ERROR missing FIsH.me" && exit 3 27 | [ ! -f $FISHPORT ] && echo "ERROR missing FIsH.porting" && exit 3 28 | source $FISHME 29 | source $FISHPORT 30 | 31 | # overwrite the regular bins 32 | BTMGRPATH="/system/fish" 33 | BUSYBOX="${BTMGRPATH}/busybox" 34 | 35 | # setup cmds 36 | CMD_SETUP 37 | 38 | # turn off the lights 39 | echo "0" > ${FISH_LED} 40 | echo "0" > ${BOOT_LED} 41 | echo "0" > ${WAIT_LED} 42 | 43 | # Logfile rotation 44 | if [ ! -d "${LOGPATH}" ];then 45 | ${MKDIR} ${LOGPATH} 46 | ${CHOWN} system.system ${LOGPATH} 47 | ${CHMOD} 770 ${LOGPATH} 48 | else 49 | if [ -f ${LOGFILE} ];then 50 | ${MV} ${LOGFILE} ${LOGFILE}.old 51 | fi 52 | ${TOUCH} ${LOGFILE} 53 | ${CHMOD} 660 ${LOGFILE} 54 | fi 55 | 56 | ## preparing a smooth start 57 | ECHOL "### moving busybox and FIsH.." 58 | EXECL $MOUNT -oremount,rw / 59 | EXECL [ -d /res/fish ] && $RM -rvf /res/fish 60 | EXECL $MKDIR /res/fish 61 | EXECL $CP -vf $BTMGRPATH/* /res/fish/ 62 | EXECL ${CHOWN} -R 0.0 /res/fish/ 63 | EXECL ${CHMOD} -R 0777 /res/fish/ 64 | 65 | if [ -x /res/fish/busybox ];then 66 | BUSYBOX="/res/fish/busybox" 67 | CMD_SETUP 68 | 69 | ECHOL "### calling the FIsH and exit" 70 | /res/fish/FIsH & 71 | else 72 | ECHOL "### calling the FIsH not possible because busybox install fail" 73 | EXECL $MOUNT -oremount,ro / 74 | fi 75 | -------------------------------------------------------------------------------- /fishing/FIsH.me: -------------------------------------------------------------------------------- 1 | ##################################################################################################### 2 | # 3 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 4 | # 5 | # Copyright (C) 2017 steadfasterX 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # 20 | # 21 | ###################################################################################################### 22 | 23 | ################################################################################################# 24 | # STOP HERE. No need to continue ;-) you only have to modify the file FIsH.porting!! 25 | ################################################################################################# 26 | 27 | # Command setup 28 | CMD_SETUP(){ 29 | ECHO="${BUSYBOX} echo" 30 | DMESG="${BUSYBOX} dmesg" 31 | DATE="${BUSYBOX} date" 32 | MKDIR="${BUSYBOX} mkdir" 33 | CHOWN="${BUSYBOX} chown" 34 | CHMOD="${BUSYBOX} chmod" 35 | CHROOT="${BUSYBOX} chroot" 36 | MV="${BUSYBOX} mv" 37 | TOUCH="${BUSYBOX} touch" 38 | CAT="${BUSYBOX} cat" 39 | SLEEP="${BUSYBOX} sleep" 40 | KILL="${BUSYBOX} kill" 41 | RM="${BUSYBOX} rm" 42 | PS="${BUSYBOX} ps" 43 | GREP="${BUSYBOX} grep" 44 | EGREP="${BUSYBOX} egrep" 45 | AWK="${BUSYBOX} awk" 46 | SED="${BUSYBOX} sed" 47 | EXPR="${BUSYBOX} expr" 48 | MOUNT="${BUSYBOX} mount" 49 | UMOUNT="${BUSYBOX} umount" 50 | TAR="${BUSYBOX} tar" 51 | GZIP="${BUSYBOX} gzip" 52 | CPIO="${BUSYBOX} cpio" 53 | CHROOT="${BUSYBOX} chroot" 54 | LS="${BUSYBOX} ls" 55 | LSOF="${BUSYBOX} lsof" 56 | HEXDUMP="${BUSYBOX} hexdump" 57 | CP="${BUSYBOX} cp" 58 | SH="${BUSYBOX} sh" 59 | TIMEOUT="${BUSYBOX} timeout" 60 | FIND="$BUSYBOX find" 61 | FUSER="$BUSYBOX fuser" 62 | TR="$BUSYBOX tr" 63 | SORT="$BUSYBOX sort" 64 | } 65 | 66 | #Function definition for get property 67 | F_GETPROP(){ 68 | # Get the property from getprop 69 | PROP=`/system/bin/getprop $*` 70 | PROP=`grep "$*" /system/build.prop | $AWK -F'=' '{ print $NF }'` 71 | echo $PROP 72 | } 73 | 74 | # Function definition for logging 75 | ECHOL(){ 76 | _DATETIME=`${BUSYBOX} date +"%F %T"` 77 | echo -e "${_DATETIME}: $*" >> ${LOGFILE} 78 | return 0 79 | } 80 | 81 | # function definition for log exec command 82 | EXECL(){ 83 | _DATETIME=`${BUSYBOX} date +"%F %T"` 84 | echo "${_DATETIME}: $*" >> ${LOGFILE} 85 | $* 2>> ${LOGFILE} 86 | _RET=$? 87 | echo "${_DATETIME}: RET=${_RET}" >> ${LOGFILE} 88 | return ${_RET} 89 | } 90 | 91 | # PS implementation that just WORKS! 92 | # Busybox ps is crap. mainly: -o doesnt work there as expected 93 | F_PS(){ 94 | # returns: "PID:NAME" 95 | for proci in $(find /proc/[0-9]* -maxdepth 1 |egrep "cmdline|comm" );do 96 | unset CMD 97 | # exclude not (anymore) available proc ids 98 | [ -f $proci ] && CMD=$(cat $proci) 99 | if [ ! -z "$CMD" ] ;then 100 | fpid=$(echo $proci | cut -d "/" -f3) 101 | echo "$fpid:$CMD" 102 | fi 103 | done 104 | } 105 | 106 | 107 | ### FIsH definitions 108 | 109 | LOGPATH="/cache/fish" 110 | LOGFILE="${LOGPATH}/fish.log" 111 | WORKDIR="${LOGPATH}" 112 | BTMGRPATH="/res/fish" 113 | BUSYBOX="${BTMGRPATH}/busybox" 114 | _DT=$(${BUSYBOX} date +"%F %T") 115 | FISHVER="v3.3-2" 116 | 117 | -------------------------------------------------------------------------------- /fishing/gofishing.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | ##################################################################################################### 3 | # 4 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 5 | # 6 | # Copyright (C) 2017 steadfasterX 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU Lesser General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with this program. If not, see . 20 | # 21 | # 22 | ###################################################################################################### 23 | 24 | FISHFOOD=fishfood.gz # <-- do not change. or if: change it in the whole FIsH 25 | FISHDIR=/system/fish 26 | TMPDIR=/data/local/tmpfish 27 | 28 | ####################################### 29 | # Functions 30 | ####################################### 31 | # Function to clean temp files 32 | CLEANFILES() { 33 | # cleaning temp files 34 | echo " " 35 | echo "------- Cleaning files ------" 36 | echo "cleaning -> $TMPDIR" 37 | busybox rm -rf $TMPDIR 38 | } 39 | 40 | # function to detect the device and version installed 41 | 42 | ####################################### 43 | # Main script 44 | ####################################### 45 | echo "" 46 | echo "--- mounting system as rw ---" 47 | 48 | # remounting system as read and write 49 | chmod 755 $TMPDIR/busybox 50 | $TMPDIR/busybox mount -o remount, rw /system 51 | 52 | echo "" 53 | echo "--- installing busybox ------" 54 | echo "" 55 | 56 | [ -d $FISHDIR ] && rm -Rf $FISHDIR && echo previous FIsH installation removed 57 | 58 | # add recovery dirs 59 | echo "adding $FISHDIR dir..." 60 | mkdir $FISHDIR 61 | 62 | # adding custom busybox 63 | echo "copying files..." 64 | dd if=$TMPDIR/fishfood.release of=$FISHDIR/fishfood.release 65 | dd if=$TMPDIR/busybox of=$FISHDIR/busybox 66 | chown root.shell $FISHDIR/busybox 67 | chmod 755 $FISHDIR/busybox 68 | dd if=$TMPDIR/busybox of=/system/xbin/busybox 69 | chown root.shell /system/xbin/busybox 70 | chmod 755 /system/xbin/busybox 71 | echo "" 72 | echo "installing..." 73 | /system/xbin/busybox --install -s /system/xbin 74 | echo " [OK]" 75 | 76 | echo "" 77 | echo "---- preparing the FIsHFOOD ----" 78 | 79 | # FIsHFOOD RAMdisk 80 | if [ -f $FISHDIR/$FISHFOOD ]; then 81 | rm $FISHDIR/$FISHFOOD 82 | echo "" 83 | echo "old FIsHFOOD ramdisk removed..." 84 | fi 85 | 86 | # adding FIsHFOOD 87 | echo "" 88 | echo "adding FIsHFOOD Ramdisk..." 89 | dd if=$TMPDIR/$FISHFOOD of=$FISHDIR/$FISHFOOD 90 | chown root.shell $FISHDIR/$FISHFOOD 91 | chmod 644 $FISHDIR/$FISHFOOD 92 | 93 | # create su.d if needed 94 | if [ ! -d /system/su.d ]; then 95 | echo "" 96 | echo "preparing su dir" 97 | mkdir /system/su.d 98 | fi 99 | 100 | # adding fish 101 | echo "" 102 | echo "adding FIsH..." 103 | dd if=$TMPDIR/callmeFIsH of=/system/su.d/callmeFIsH 104 | dd if=$TMPDIR/FIsH of=/$FISHDIR/FIsH 105 | dd if=$TMPDIR/FIsH.me of=/$FISHDIR/FIsH.me 106 | dd if=$TMPDIR/FIsH.porting of=/$FISHDIR/FIsH.porting 107 | chown root.shell /system/su.d/callmeFIsH 108 | chmod 755 /system/su.d/callmeFIsH 109 | 110 | # cleaning temp files 111 | CLEANFILES 112 | 113 | # verifying 114 | echo "" 115 | if [ -f /system/su.d/callmeFIsH ] && [ -f $FISHDIR/$FISHFOOD ] && [ -f $FISHDIR/busybox ] && [ -f $FISHDIR/FIsH ];then 116 | echo "FIsH successfully prepared! Enjoy the meal!" 117 | else 118 | echo "Something goes wrong!!!!" 119 | fi 120 | 121 | echo " " 122 | echo " [ all done! ] " 123 | echo " " 124 | 125 | # remounting system as read only 126 | mount -o remount, ro /system 127 | -------------------------------------------------------------------------------- /COPYING.LESSER: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | 167 | -------------------------------------------------------------------------------- /fishing/FIsH.porting: -------------------------------------------------------------------------------- 1 | ##################################################################################################### 2 | # 3 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 4 | # 5 | # Copyright (C) 2017 steadfasterX 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # 20 | # 21 | ###################################################################################################### 22 | 23 | 24 | # Modify these variables to your needs/requirements 25 | 26 | 27 | ################################################################################## 28 | ### GLOBAL settings ### 29 | 30 | # RUNONCE means FIsH will be removed after run once!! 31 | RUNONCE=0 32 | 33 | # enable DEBUG mode for FIsH: 34 | # - more log output 35 | # - FOODBIN will be executed in the background and generates debug output afterwards 36 | # - FIsH will commit suicide after the defined SUICIDETIME (default 25 minutes) 37 | # - optional: execute any command of your choice after FOODBIN has started by DEBUGEXTRACMD 38 | DEBUG=0 39 | SUICIDETIME= # Default is 25 minutes! Leave empty for default value. Uses the "sleep" syntax 40 | DEBUGEXTRACMD= # any commmand u wanna exec before the debug goes into sleep (e.g: /sbin/recovery) 41 | 42 | # time in seconds for how long you want to wait for the magic key press 43 | # if you set this too long Android may been booted up completely and if u make it 44 | # too low users may complain that they can not get into FIsH.. so it may or may not 45 | # need to be adjusted 46 | KEYWAIT=3 47 | 48 | # FIsH boots whatever ramdisk you like. To prepare your fishfood (your ramdisk u wanna load): 49 | # create a gziped cpio of your initial ramdisk u wanna load 50 | # example of a twrp image: 51 | # abootimg -x twrp.img (will extract the twrp image) 52 | # file initrd.img (should tell something like: gzip compressed data. if NOT: gzip it!) 53 | # mv initrd.img fishing/fishfood.gz (moves the extracted initial ramdisk) 54 | # Some Notes: 55 | # - this cpio has to be compressed with gzip (.gz file ending!) 56 | # - the name of this file is your FISHFOOD variable 57 | # - edit or add a file fishing/fishfood.release and type in what ur fishfood is (e.g. TWRP) 58 | # and the version of it course (e.g. TWRP v3.1.0-1) 59 | 60 | FISHFOOD="fishfood.gz" # <--- I highly recommend to NOT change this variable. It will break several things! Just rename your initrd to this instead. 61 | 62 | 63 | # After FIsH has finished it's work its time to start your FIsHFOOD so the ramdisk you 64 | # want to start. This gets auto extracted and prepared but FIsH needs to know the start the full 65 | # path with the binary name (WITHOUT the leading slash). Normally this would be "init" but can be different depending on the ramdisk. 66 | # For TWRP and MultiROM it's just init for other ramdisk or tools you want to load this may be different. 67 | # so in short this HAS TO MATCH -YOUR- ramdisk. if it doesnt have an init but another executable update this. 68 | # if u r unsure leave it as it is and check the fish log later. 69 | FOODBIN="init" 70 | 71 | ### GLOBAL end ### 72 | ################################################################################## 73 | 74 | ################################################################################## 75 | ### PORTING SECTION / DEVICE SPECIFIC SETTINGS ### 76 | 77 | # vibrate definition 78 | # - Porting instructions - 79 | # should be ok but if not maybe something like this helps u out: 80 | # find /sys -name vibrator 81 | VIBRATE="/sys/class/timed_output/vibrator/enable" 82 | 83 | # LED brightness definition 84 | # - Porting instructions - 85 | # should be ok but if not maybe something like this helps u: 86 | # find /sys -name leds 87 | # find /sys -name led 88 | # find /sys -name green 89 | # find /sys -name brightness 90 | # BOOT_LED: the default LED which shines on normal boot 91 | BOOT_LED="/sys/class/leds/blue/brightness" 92 | # WAIT_LED: the LED which indicates that FIsH is NOW waiting for the magic key press of the user 93 | WAIT_LED="/sys/class/leds/green/brightness" 94 | # FISHB: the LED which indicates that the FIsHFOOD gets activated and the actual hack starts/ends 95 | FISH_LED="/sys/class/leds/red/brightness" 96 | 97 | # MAGIC key press to allow FIsH to boot it's food 98 | # - Porting instructions - 99 | # A) dmesg (better handling for the script but may differ for all devices) 100 | # use dmesg to find out the line matching your needs. 101 | # press the desired key and check the ouput 102 | # in my case code 114 means Volume Down key and this together with a value of 2 means it is still not released 103 | # the qpnp_pon_... part may differ completely from yours 104 | # B) getevent (better multi device support but blocks and is not that flexible) 105 | # --> main issue with getevent is that one cannot really CATCH its output?! sorry i havent found a smooth 106 | # way to do so yet. e.g. try to use getevent -l | grep DOWN => this will NOT work!! same goes for 107 | # | hexdump and whatever u can think of. Even CAT doesnt work here. 108 | # the only way it really can be saved somewhere is: "cat /dev/input/eventX > mylog.file &" 109 | # the ampersand at the end is DAMN important. without it it will NOT work. 110 | # prob: the generated file contains unreadable output ofc so u need to use e.g od or hexdump to make 111 | # it parseable. All of them are not nice solutions but may work at least. 112 | # thats y I prefer the dmesg method.. 113 | # identify the input device by executing (on running Android): 114 | # $> getevent -i 115 | # Then u can watch live with the identified input device while pressing the desired key(s): 116 | # $> getevent -l /dev/input/eventX (e.g. event1) 117 | # It is possible that u have to watch different input devices when using multiple keys like 118 | # on my device (volume up is on event2 while vol down on event1). 119 | # If you prefer getevent over dmesg keep also in mind that you have to use an ampersand at the end otherwise 120 | # u can not continue a normal boot 121 | F_KEYPRESS(){ 122 | # dmesg example for power pressed (and not released!) 123 | #KEYACT=$($DMESG | ${GREP} 'qpnp_pon_input_dispatch: code(116)' | $GREP 'value(1)' |tail -n1 | $GREP -c value) 124 | #ECHOL "Power button check: $PWRACT" 125 | 126 | # dmesg example for vol_down pressed (and not released!) 127 | KEYACT=$($DMESG | ${GREP} 'qpnp_pon_input_dispatch: code(114)' | $GREP 'value(2)'| tail -n1 | $GREP -c value) 128 | 129 | # the following getevent implementation means: if desired key pressed once - released or not! 130 | # -l labels the events to human readable 131 | # -c 1 exits after 1 event (whatever it is) 132 | 133 | # the key u wanna choose to boot into FIsH 134 | # Normally this will be one of: KEY_VOLUMEDOWN, KEY_VOLUMEUP, KEY_POWER 135 | #FISHKEY="KEY_VOLUMEDOWN" 136 | 137 | # you do NOT need to touch the following. The FISHKEY above should be enough. 138 | # TIMEOUT -t KEYWAIT is f*** important here!!! RTFM and use ur brain if u wonder y. 139 | #KEYACT=$(${TIMEOUT} -t $KEYWAIT getevent -l | $GREP $FISHKEY |tr -d ' '| $GREP -c "EV_KEY{$FISHKEY}DOWN") 140 | #KEYACT=$(getevent -l | $GREP $FISHKEY |tr -d ' '| $GREP -c "EV_KEY{$FISHKEY}DOWN") 141 | 142 | # that means if the expected key was found we will have KEYACT=1 otherwise 0 143 | ECHOL "VolDown button check: $KEYACT" 144 | return "$KEYACT" 145 | } 146 | 147 | # device specific mount points 148 | # - Porting instructions - 149 | # use the command "mount" to find out yours and adjust this variable accordingly 150 | # The ORDER is IMPORTANT! 151 | # (means u have to umount all submounts first before u can unmount the main one) 152 | MOUNTS="/acct \ 153 | /mnt/secure \ 154 | /mnt/asec \ 155 | /mnt/obb \ 156 | /mnt/pstore \ 157 | /mnt/sdcard \ 158 | /mnt/shell/emulated \ 159 | /mnt/shell \ 160 | /storage/external_SD \ 161 | /storage/sdcard0 \ 162 | /storage/emulated/legacy \ 163 | /storage/emulated/0 \ 164 | /storage/emulated \ 165 | /data/media \ 166 | /data \ 167 | /persist \ 168 | /firmware \ 169 | /sns \ 170 | /persist-lg \ 171 | /mpt \ 172 | /cust" 173 | 174 | # device specific mount points - OS special 175 | # - Porting instructions - 176 | # system near mounts like /proc and /sys should be unmounted at the end first. 177 | # those should be listed here. 178 | # use the command "mount" to find out yours and adjust this variable accordingly. 179 | # The ORDER is IMPORTANT! 180 | # (means u have to umount all submounts first before u can unmount the main one) 181 | SPECMOUNTS="/dev/usb-ffs/adb \ 182 | /sys/fs/selinux \ 183 | /sys/kernel/debug \ 184 | /sys/fs/cgroup \ 185 | /sys/fs/pstore \ 186 | /dev/pts \ 187 | /dev/cpuctl \ 188 | /proc \ 189 | /sys" 190 | 191 | 192 | # once FIsH starts to unmount filesystems it will first try to stop all unneeded services 193 | # and kill all processes currently accessing that mountpoint. 194 | # 195 | # You can specify here to exclude: 196 | # - service names (u can see all in Android like this: getprop | grep svc ) 197 | # - process name(s) (FIsH checks the arg so e.g. when /bin/sh starts a script u can 198 | # filter on that script name) 199 | # 200 | # Even when you could even exclude PID(s) this makes no sense in most cases as the pid 201 | # is nothing you can predict and is though completely dynamic 202 | # init is 1 always and the main reason why it exists. 203 | # 204 | # ATTENTION: 205 | # - multiple service/process names have to be separated by a PIPE: | 206 | # - service/process names are CASE SENSITIVE and not strict! 207 | # (means: "FISH" will match "FIsH" but also "FISHing" or "myfish") 208 | # - special chars are not tested! 209 | EXCLUDESERVICES="ueventd|qseecomd" 210 | EXCLUDEPROCS="kworker|irq|interrupt|watchdog|busybox|FIsH" 211 | 212 | 213 | # ensure 1 is always set here! If u wanna add more.. feel free but keep in mind that 214 | # everything else then init (pid 1) is dynamic and change on each boot 215 | # ATTENTION: multiple PIDs have to be separated by a PIPE: | 216 | EXCLUDEPIDS="1" 217 | 218 | ### PORTING SECTION END ### 219 | ################################################################################## 220 | -------------------------------------------------------------------------------- /doc/installguide_XDA_format.txt: -------------------------------------------------------------------------------- 1 | [SIZE="5"]About[/SIZE] 2 | 3 | write some beautiful own words here ;) 4 | 5 | 6 | [SIZE="5"]Requirements[/SIZE] 7 | 8 | Here are the pre-requirements you have to met! 9 | If you can't get them: [B][U]Close this page and FORGET it (until the day you met those reqs)![/U][/B] 10 | 11 | Here are the 2 simple requirements you have to met: 12 | 13 | [LIST] 14 | [*][B]1. root by SuperSU >=v2.76[/B] (greater or equal v2.76) 15 | --> to test this requirement just start the installer of FIsH with --check (see next lines) which will check for all requirements and abort if its not possible 16 | --> for many devices - if not all - this means you HAVE TO downgrade/install LL. It also means that you have to upgrade your SuperSU to this version by e.g. FlashFire if you have a lower version installed! 17 | --> SU by phh is NOT supported => It needs a modified /boot and this would void the boot signing chain! 18 | --> Magisk is NOT supported => It needs a modified /boot and this would void the boot signing chain! 19 | --> I will NOT provide downgrading guides there are plenty of them so search and read. 20 | --> I will NOT provide any guides in rooting your device 21 | --> Before you think about downgrading to LL read about ANTI-ROLLBACK protection some devices and may have! Anti-Rollback means you CAN NOT downgrade - it would HARD-BRICK your device (wtf thinking the vendors who we are?? Is this even legal?!)! Check that before!! 22 | [*][B]2. you have to be able to disable SELinux[/B] in your booted Android 23 | --> You do NOT need to set SELinux [B]permanently[/B] to permissive. Just [B][U]CHECK[/U][/B] if you [B][U]COULD[/U][/B] get it [B][U]MANUALLY[/U][/B]. If you can get it OK. If not.. you obviously have not full root access but check the forums maybe there is something you can do about this. 24 | --> I will NOT provide any guides enabling SELinux but some lines later you will see how u can execute the very simple check 25 | --> to test this requirement just start the installer of FIsH with --check (see next lines) which will check for all requirements and abort if its not possible 26 | [/LIST] 27 | 28 | Those above are hard facts so it may NEVER work with MM. Google has changed the way on how the boot chain will be verified and that means changes in /system will void it from now on. 29 | If MM can get fully rooted somehow/somewhen on your device with SuperSU installed and you are able to disable SELinux the method will work there as well. 30 | 31 | If you can not meet ALL of the above 2 requirements lay down and cry. 32 | For the others: calm down and read on! 33 | 34 | [B]You can simply test those both requirements by downloading the FIsH package and execute the installer with the following test parameter: 35 | 36 | [SIZE="4"][/B][COLOR="blue"][B]./install.sh --check[/B][/COLOR][/SIZE] 37 | 38 | This way nothing get installed but you will see if it would work on your device or not. 39 | 40 | [SIZE="5"][COLOR="Red"]Limitations![/COLOR][/SIZE] 41 | 42 | Keep in mind what I said above: FIsH does NOT unlock your bootloader! 43 | That means with TWRP-in-FIsH you can [B][U]NOT[/U][/B]: 44 | [LIST] 45 | [*]Install a custom ROM like CM/Lineage (this will modify boot = SOFT-BRICK) 46 | [*]Install a custom Kernel (this will modify boot = SOFT-BRICK) 47 | [*]Install a custom recovery (this will modify recovery = may SOFT-BRICK) 48 | [*]In short: do nothing which modifies boot or recovery partitions. Those changes will BREAK your boot signing chain. 49 | [*]You can of course flash everything which is modifying /system /data only (e.g. xposed, Audio mods, etc...) 50 | [*]You're able to backup and restore as well of course and doing any other modifications which you may can't while the Android system is running. 51 | [/LIST] 52 | 53 | 54 | [U][SIZE="4"]Download[/SIZE][/U] 55 | 56 | READ THE [COLOR="red"][B][U]REQUIREMENTS[/U][/B][/COLOR] above before proceeding! 57 | Then [B][U][COLOR="red"]UNDERSTAND[/COLOR][/U][/B] the requirements before proceeding! <-- omg this is crucial important!!!! Ensure that you really do not skip this step! 58 | 59 | READ THE [COLOR="red"][B][U]LIMITATIONS[/U][/B][/COLOR] above before proceeding! 60 | Then [B][U][COLOR="red"]UNDERSTAND[/COLOR][/U][/B] the limitations before proceeding! <-- omg this is crucial important!!!! Ensure that you really do not skip this step! 61 | 62 | ... and [B][U]NEVER[/U][/B] ask for ETA's! ;) 63 | 64 | if you can say: 65 | [B][I]Yes! I have read and [U]totally[/U] understood the [U]limitations[/U] AND the [U]requirements[/U]![/I][/B] 66 | then proceed. Otherwise read again until you got it. 67 | [HIDE]Keep in mind that this is a HACK. It may soft-brick your device. you have been warned! 68 | The concept is the same for all models but again no guarantees here for anything. 69 | There is [B][U]ALWAYS[/U][/B] a risk and you should better [B][U]backup[/U][/B] what you do not want to loose before starting downloading this. 70 | 71 | Go to the [B][U]DOWNLOADS[/U][/B] tab in this thread. 72 | [/HIDE] 73 | 74 | [U][SIZE="4"]Installation (Linux)[/U][/SIZE] 75 | 76 | You can just install any newer version over an old one. 77 | 78 | [LIST=1] 79 | [*]boot Android and connect USB cable 80 | [*]download the newest version to your PC and open a terminal in that directory 81 | [*]tar xzf TWRP-in-FIsH*.tgz 82 | [*]cd android_FIsH 83 | [*]./install.sh 84 | [*]check the output of that script. you should not see any errors there (hopefully) 85 | [/LIST] 86 | 87 | [U][SIZE="4"]Installation (Windows)[/SIZE] 88 | [/U] 89 | use [URL="http://tinyurl.com/FWULatXDA"]FWUL[/URL] or be patient.. maybe i or someone else release an installer... maybe... 90 | 91 | 92 | [U][SIZE="4"]First run (no PC required)[/U][/SIZE] 93 | 94 | This FIsH gets installed [B]PERMANENTLY[/B]! That means: 95 | You can boot up TWRP the same way as described here again without re-installing. 96 | If you re-install your STOCK image you have to re-install TWRPinFIsH as well. 97 | 98 | [LIST=1] 99 | [*]reboot Android 100 | [*]you should now see: LED goes from blue to [U][B][COLOR="green"][U]GREEN[/U][/COLOR][/B][/U] 101 | [*]NOW [B]directly[/B] when u see this [COLOR="green"][B][U]GREEN[/U][/B][/COLOR] LED press [B]VOLUME DOWN [/B]and [B]do NOT release[/B] 102 | [*]wait [B]until the device vibrates[/B] and the LED changed to [COLOR="red"][B][U]RED[/U][/B][/COLOR]. Then release the Volume Down button. 103 | [*]Wait until FIsH completed and TWRP should be shown --> This means FIsH has done it's job well! 104 | [*]This is a good time to do a full backup isn't it ? ;) Manually mount the SYSTEM partition as it gets not auto mounted atm and do a full backup 105 | [*]reboot from here (safely ignore the msg "no OS installed" and reboot anyways) and you should see Android booting (hopefully ... if not see bottom) 106 | [/LIST] 107 | 108 | [U][SIZE="4"]Daily Usage (no PC required)[/U][/SIZE] 109 | 110 | [LIST=1] 111 | [*]reboot Android 112 | [*]you should now see: LED goes from blue to [U][B][COLOR="green"][U]GREEN[/U][/COLOR][/B][/U] 113 | [*]NOW [B]directly[/B] when u see this [COLOR="green"][B][U]GREEN[/U][/B][/COLOR] LED press [B]VOLUME DOWN [/B]and [B]do NOT release[/B] 114 | [*]wait [B]until the device vibrates[/B] and the LED changed to [COLOR="red"][B][U]RED[/U][/B][/COLOR]. Then release the Volume Down button. 115 | [*]Wait until FIsH completed and TWRP should be shown --> This means FIsH is doing it's job still very well :) 116 | [*][COLOR="red"][B][U]AGAIN[/U][/B]: keep your mind up! You HAVE to ensure that whatever you do and whatever you flash -> [B][U]NEVER TOUCH BOOT/RECOVERY[/U][/B]! If you flash a ZIP ensure first that it do not modify them! Otherwise you WILL [U][B]softbrick[/B][/U]. You have been warned (several times now)[/COLOR] 117 | [/LIST] 118 | 119 | [U][SIZE="4"]Trouble / Bootloop fix[/SIZE] 120 | [/U]if you encounter a bootloop (should never happen but who knows) you have 3 choices at least: 121 | [LIST=1] 122 | [*]Option 1a: (TWRP-Bootloop) Within TWRP open Advanced -> File Manager -> Goto: /system/su.d and click "select" button -> Delete 123 | Option 1b: (TWRP-Bootloop) From your PC: [COLOR="Blue"]adb shell rm -rf /system/su.d/[/COLOR] 124 | [B][U]Important[/U][/B]: Catch the fish log (see next topic) 125 | [*]Option 2 (this works also for a bootloop without twrp): boot into download mode and use [URL="https://github.com/Lekensteyn/lglaf"]LGLaf[/URL] to get a shell 126 | then: 127 | [COLOR="Blue"]setenforce 0[/COLOR] <-- if that doesn't work you may have to do a FULL restore to stock 128 | [COLOR="blue"]mount -oremount,rw /system 129 | rm -rf /system/su.d/[/COLOR] 130 | reboot. You are out of the bootloop. 131 | [B][U]Important[/U][/B]: Catch the fish log (see next topic) 132 | [*]Option 3: Last resort: Reflash STOCK. sorry.. there is always a risk.. 133 | [/LIST] 134 | 135 | [U]Catch the FIsH logs[/U][LIST] 136 | [*]when in TWRP (or other ramdisk providing adb shell): 137 | [COLOR="Blue"]adb shell "cat /cache/fish/fish.log"[/COLOR] 138 | [COLOR="Blue"]adb shell "cat /tmp/recovery.log"[/COLOR] 139 | [*]OR - when in Android: 140 | [COLOR="Blue"]adb shell "su -c cat /cache/fish/fish.log"[/COLOR] 141 | [COLOR="Blue"]adb shell "su -c cat /cache/fish/fish.log.old"[/COLOR] 142 | [COLOR="Blue"]adb shell "su -c tar cvzf recoverylogs.tgz /cache/recovery"[/COLOR] 143 | [COLOR="Blue"]adb pull recoverylogs.tgz[/COLOR] 144 | [*]Upload the output to [url]https://paste.omnirom.org[/url] and paste the link in the IRC channel (see next topic) 145 | [/LIST] 146 | 147 | [U][SIZE="4"]Support / IRC Channel[/SIZE] 148 | [/U]IRC means Internet Relay Chat and you will get best support here only. 149 | Choose how to get in: 150 | [LIST] 151 | [*][B]PC[/B] ([URL="https://hexchat.github.io/"]HexChat[/URL] and [URL="http://www.pidgin.im/"]Pidgin[/URL] are only 2 of them! This list is not complete!) 152 | [*][B]Android[/B] ([URL="https://play.google.com/store/apps/details?id=org.yaaic"]Yaaic[/URL], [URL="https://play.google.com/store/apps/details?id=net.andchat"]AndChat[/URL], [URL="https://play.google.com/store/apps/details?id=com.fusionx.lightirc"]HoloIRC[/URL], [URL="https://play.google.com/store/apps/details?id=com.androirc"]AndroIRC[/URL] are only a few of them! This list is not complete!) 153 | [*][B]Web[/B] ([URL="https://kiwiirc.com/client"]KiwiIRC-Web[/URL],[URL="http://webchat.freenode.net/?channels=Carbon-user"]FreenodeWebchat[/URL]]) 154 | 155 | [*]When you have to choose a channel it is: [B][I]#Carbon-user[/I][/B] 156 | [*]When you will be asked for a server network choose: [B][I]freenode[/I][/B] 157 | [/LIST] 158 | 159 | [COLOR="red"][SIZE="4"][B][U]Known issues (may never get fixed)[/U][/B][/SIZE] 160 | [/COLOR] 161 | Due to the fact that FIsH is a BRUTAL hijack of the booting process several things may not work as expected. 162 | This will normally not harm anything but you have to know about. 163 | 164 | [U]ZIP / ROM flashing:[/U] 165 | omg really you wanna hear that again? OK: DON'T TOUCH BOOT / RECOVERY. And you be safe. 166 | When you try to install a ROM it will modify at least BOOT. That means soft-brick! 167 | When you try to install a custom Kernel.. omg really? It will definitively SOFT-BRICK! Maybe you should read the limitations again?? :p 168 | When you try to install a ZIP like xposed, supersu, Vipermod and others ensure that those are not modifying BOOT or RECOVERY partitions. For those mentioned it would be very unlikely but who knows. 169 | 170 | [U]XXXXXX partition:[/U] 171 | cannot be mounted - even not manually. You have to live with it. 172 | 173 | 174 | [U][SIZE="5"]Credits (without them - no FIsH!!!)[/SIZE][/U] 175 | If you feel that someone / you is missing on this list lemme know! 176 | [LIST] 177 | [*]Chainfire for [URL="https://forum.xda-developers.com/apps/supersu/stable-2016-09-01supersu-v2-78-release-t3452703"]SuperSU[/URL]! This is the main part of FIsH. 178 | [*]TeamWin for [URL="http://twrp.me"]TWRP[/URL] 179 | [*]@cray_Doze, @dssmex, @Aaahh and @KeiranFTW for their hijack implementations (e.g. [url]https://forum.xda-developers.com/showthread.php?t=2608408[/url], [URL="https://forum.xda-developers.com/verizon-g4/development/twrp-twrp-lg-g4-bl-locked-untested-t3481967"]first steps to a G4 hijack[/URL]) 180 | [*]steadfasterX for the [URL="https://forum.xda-developers.com/android/software-hacking/locked-fish-hack-to-boot-want-device-t3578373"]android FIsH [/URL]! ;) 181 | [/LIST] -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ##################################################################################################### 3 | # 4 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 5 | # 6 | # Copyright (C) 2017 steadfasterX 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU Lesser General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU Lesser General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with this program. If not, see . 20 | # 21 | # 22 | ###################################################################################################### 23 | 24 | cat < 27 | 28 | This program comes with ABSOLUTELY NO WARRANTY! 29 | This is free software, and you are welcome to redistribute it 30 | under certain conditions. 31 | 32 | The complete license and copying can be found in the file 33 | COPYING and COPYING.LESSER 34 | 35 | 36 | ********************************************************************* 37 | ** Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack ** 38 | ********************************************************************* 39 | 40 | EOCP 41 | 42 | # The full URL to the busybox version compatible to your device: 43 | BUSYBOXURI="https://busybox.net/downloads/binaries/1.26.2-defconfig-multiarch/busybox-armv6l" 44 | 45 | # the required android sdk version -> have to match the fishfood you are about to package 46 | # (e.g. TWRP have to be compatible with that version) 47 | # This version here means the minimum(!) STOCK ROM version you expect for this package! 48 | # find the correct SDK version e.g. here: https://en.wikipedia.org/wiki/Android_version_history 49 | MINSDK="22" 50 | 51 | # minimal required SuperSU version. TRUST me u will encounter problems with >2.79! 52 | # well 2.67 should work but i will not tell anyone ;) (totally untested) 53 | MINSU="279" 54 | 55 | ##### Check to see if this script is running on Android or PC ##### 56 | 57 | if [ -f /system/build.prop ];then 58 | echo "Installer is running on Android" 59 | device="Android" 60 | else 61 | echo "Installer is running on PC" 62 | device="PC" 63 | fi 64 | 65 | ############################################################################################## 66 | 67 | # check if there is --check ANYWHERE on the parameter list to be 100% sure that no bad things happen when unwanted 68 | echo "$@" | grep "check" >> /dev/null 69 | if [ $? -eq 0 ];then 70 | CHKMODE=yes 71 | echo "Installer is running in CHECK-ONLY mode!" 72 | else 73 | CHKMODE=no 74 | echo "Installer is running in REAL-INSTALLATION mode!" 75 | fi 76 | 77 | # we do not want to distribute busybox to avoid licensing issues so u need to download it (wget cmd may missing when running on Android..): 78 | echo -e "\n############# Checking for busybox" 79 | [ ! -f fishing/busybox ] && echo "...downloading busybox" && wget "$BUSYBOXURI" -O fishing/busybox && chmod 755 fishing/busybox 80 | [ ! -f fishing/busybox ] && echo "ERROR: MISSING BUSYBOX! Download it manually and place it in the directory: ./fishing/ and name it " && exit 3 81 | 82 | # preparing your system 83 | if [ $device == "PC" ];then 84 | adb start-server 85 | echo -e "Waiting for your device... (you may have to switch to PTP mode on some devices!!)" 86 | adb wait-for-device 87 | fi 88 | 89 | # precheck min requirement adb: 90 | adb version 91 | [ $? -ne 0 ]&& echo "ADB is not installed?! Use FWUL (https://tinyurl.com/FWULatXDA) you FOOL! :)" && exit 92 | 93 | F_ERR(){ 94 | ERR=${1/*=/} 95 | [ -z "$ERR" ]&& echo "ERROR IN ERROR HANDLING! $1 was cut down to: $ERR" && exit 96 | 97 | if [ "$ERR" -ne 0 ];then 98 | echo "--> ERROR!! ABORTED WITH ERROR $ERR! Check the above output!" 99 | exit 3 100 | else 101 | echo "-> command ended successfully ($1)" 102 | fi 103 | } 104 | 105 | echo "############# checking Android version" 106 | REQSDK=nok 107 | 108 | if [ $device == "Android" ];then 109 | AVER=$(getprop ro.build.version.sdk| tr -d '\r') 110 | else 111 | AVER=$(adb shell getprop ro.build.version.sdk| tr -d '\r') 112 | fi 113 | 114 | if [ "$CHKMODE" == "yes" ];then 115 | echo -e "You have Android SDK ${AVER} running on your device" 116 | REQSDK=checkmode_yourSDK_is_${AVER} 117 | else 118 | if [ "$AVER" -lt "$MINSDK" ];then 119 | echo -e "\n\n***************************************************************" 120 | echo -e "You have Android $AVER running but $MINSDK is set to required by the FIsH dev.\nFIsH might not be able to boot!" 121 | echo 122 | echo -e "This check ensures that the FIsHFOOD is 100% compatible with the ramdisk we hijack" 123 | echo -e "and it seems that this is not the case or the dev just had forgotten to change the MINSDK :p" 124 | echo -e "You can adjust MINSDK on your own in this script but ensure the FISHFOOD is compatible first!" 125 | echo -e "***************************************************************\n\n" 126 | exit 3 127 | else 128 | if [ "$AVER" -gt "$MINSDK" ];then 129 | echo -e "\n\n***************************************************************" 130 | echo -e "Your SDK version ($AVER) is HIGHER then $MINSDK\nFIsH might not be able to boot!" 131 | echo 132 | echo -e "This check ensures that the FIsHFOOD is 100% compatible with the ramdisk we hijack" 133 | echo -e "and it seems that this is not the case or the dev just had forgotten to change the MINSDK :p" 134 | echo -e "You can adjust MINSDK on your own in this script but ensure the FISHFOOD is compatible first!" 135 | echo -e "***************************************************************\n\n" 136 | exit 3 137 | else 138 | echo "-> Good. Matching exact the required Android SDK: $MINSDK" 139 | REQSDK=ok 140 | fi 141 | fi 142 | fi 143 | 144 | echo "############# checking SuperSU version" 145 | REQSU=notok 146 | 147 | if [ $device == "Android" ];then 148 | SUVER=$(su -v|cut -d ":" -f1 |tr -d '.'| tr -d '\r') 149 | else 150 | SUVER=$(adb shell su -v|cut -d ":" -f1 |tr -d '.'| tr -d '\r') 151 | fi 152 | 153 | if [ "$SUVER" -ge "$MINSU" ];then 154 | echo "-> Matching required SuperSU version: $SUVER" 155 | REQSU=ok 156 | else 157 | echo "ERROR! You have SuperSU $SUVER running but $MINSU is required. FIsH will not be able to boot!" 158 | echo "Update to at least v${MINSU} with e.g. FlashFire or similar." 159 | if [ "$CHKMODE" == "yes" ];then REQSU=notok; else exit 3; fi 160 | fi 161 | 162 | echo "############# temporary disable SELinux" 163 | if [ $device == "Android" ];then 164 | CURSELINUX=$(getenforce |tr -d '\r') 165 | RET=$(su -c setenforce 0; echo err=$? | grep err=|tr -d '\r') 166 | F_ERR $RET 167 | SEL="$(getenforce|tr -d '\r')" 168 | echo "SELinux mode: $SEL" 169 | if [ "$SEL" != "Permissive" ];then 170 | echo -e 'YOU CAN NOT GET PERMISSIVE SELINUX MODE! Do you really have a FULL rooted device? It seems not..\nTry this in an adb shell: "su -c setenforce permissive"' 171 | if [ "$CHKMODE" == "yes" ];then 172 | REQSEL=notok 173 | else 174 | exit 3 175 | fi 176 | else 177 | REQSEL=ok 178 | fi 179 | else 180 | CURSELINUX=$(adb shell getenforce |tr -d '\r') 181 | RET=$(adb shell 'su -c setenforce 0; echo err=$?' | grep err=|tr -d '\r') 182 | F_ERR $RET 183 | SEL="$(adb shell getenforce|tr -d '\r')" 184 | echo "SELinux mode: $SEL" 185 | if [ "$SEL" != "Permissive" ];then 186 | echo -e 'YOU CAN NOT GET PERMISSIVE SELINUX MODE! Do you really have a FULL rooted device? It seems not..\nTry this in an adb shell: "su -c setenforce permissive"' 187 | if [ "$CHKMODE" == "yes" ];then 188 | REQSEL=notok 189 | else 190 | exit 3 191 | fi 192 | else 193 | REQSEL=ok 194 | fi 195 | fi 196 | 197 | # if we run in testing mode revert things and exit here 198 | if [ "$CHKMODE" == "yes" ];then 199 | echo "... restoring SELinux mode to $CURSELINUX" 200 | if [ $device == "Android" ];then 201 | su -c setenforce $CURSELINUX 202 | else 203 | adb shell "su -c setenforce $CURSELINUX" 204 | fi 205 | echo -e "\n\nT############# Test results" 206 | echo -e "\nREQSDK=$REQSDK\nREQSU=$REQSU\nREQSEL=$REQSEL\n" 207 | echo -e "\nTests finished! Check the above output!" 208 | echo -e "If any of the REQxxx are set to then FIsH will not work for you atm." 209 | echo -e "Check the above messages to fix this and re-run the check afterwards." 210 | echo -e "Exiting here because in checking mode. Nothing got installed.\n\n" 211 | exit 212 | fi 213 | 214 | if [ $device == "Android" ];then 215 | echo "############# remount /system" 216 | RET=$(su -c 'mount -oremount,rw /system; echo err=$?' | grep err=|tr -d '\r') # bullshit.. mount do not return a valid errorcode! 217 | #F_ERR $RET 218 | echo "############# cleaning" 219 | RET=$(su -c rm -Rf /data/local/tmpfish/; echo err=$? | grep err= |tr -d '\r') 220 | F_ERR $RET 221 | RET=$(su -c rm -f /system/su.d/FIsH; echo err=$? | grep err= |tr -d '\r') 222 | F_ERR $RET 223 | RET=$(su -c rm -f /system/su.d/callmeFIsH; echo err=$? | grep err= |tr -d '\r') 224 | F_ERR $RET 225 | RET=$(su -c rm -Rf /system/fish; echo err=$? | grep err= |tr -d '\r') 226 | F_ERR $RET 227 | echo "############# creating temporary directory" 228 | RET=$(su -c mkdir /data/local/tmpfish; echo err=$? | grep err=|tr -d '\r') 229 | F_ERR $RET 230 | RET=$(su -c chmod 777 /data/local/tmpfish; echo err=$? | grep err=|tr -d '\r') 231 | F_ERR $RET 232 | echo "############# pushing files" 233 | for fishes in $(find fishing/ -type f );do cp $fishes /data/local/tmpfish/;done 234 | RET=$(su -c chmod 755 /data/local/tmpfish/gofishing.sh; echo err=$? | grep err=|tr -d '\r') 235 | F_ERR $RET 236 | echo "############# injecting the FIsH" 237 | RET=$(su -c /data/local/tmpfish/gofishing.sh; echo err=$? | grep err=|tr -d '\r') 238 | F_ERR $RET 239 | echo "############# remount /system RO again" 240 | RET=$(su -c mount -oremount,ro /system; echo err=$? | grep err=|tr -d '\r') # bullshit.. mount do not return a valid errorcode! 241 | #F_ERR $RET 242 | echo "############# restoring SELinux mode to $CURSELINUX" 243 | RET=$(su -c setenforce $CURSELINUX; echo err=$? | grep err= |tr -d '\r') 244 | F_ERR $RET 245 | else 246 | echo "############# remount /system" 247 | RET=$(adb shell "su -c 'mount -oremount,rw /system; echo err=$?'" | grep err=|tr -d '\r') # bullshit.. mount do not return a valid errorcode! 248 | #F_ERR $RET 249 | echo "############# cleaning" 250 | RET=$(adb shell 'su -c rm -Rf /data/local/tmpfish/; echo err=$?' | grep err= |tr -d '\r') 251 | F_ERR $RET 252 | RET=$(adb shell 'su -c rm -f /system/su.d/FIsH; echo err=$?' | grep err= |tr -d '\r') 253 | F_ERR $RET 254 | RET=$(adb shell 'su -c rm -f /system/su.d/callmeFIsH; echo err=$?' | grep err= |tr -d '\r') 255 | F_ERR $RET 256 | RET=$(adb shell 'su -c rm -Rf /system/fish; echo err=$?' | grep err= |tr -d '\r') 257 | F_ERR $RET 258 | echo "############# creating temporary directory" 259 | RET=$(adb shell 'su -c mkdir /data/local/tmpfish; echo err=$?' | grep err=|tr -d '\r') 260 | F_ERR $RET 261 | RET=$(adb shell 'su -c chmod 777 /data/local/tmpfish; echo err=$?' | grep err=|tr -d '\r') 262 | F_ERR $RET 263 | echo "############# pushing files" 264 | for fishes in $(find fishing/ -type f );do adb push $fishes /data/local/tmpfish/;done 265 | RET=$(adb shell 'su -c chmod 755 /data/local/tmpfish/gofishing.sh; echo err=$?' | grep err=|tr -d '\r') 266 | F_ERR $RET 267 | echo "############# injecting the FIsH" 268 | RET=$(adb shell 'su -c /data/local/tmpfish/gofishing.sh; echo err=$?' | grep err=|tr -d '\r') 269 | F_ERR $RET 270 | echo "############# remount /system RO again" 271 | RET=$(adb shell 'su -c mount -oremount,ro /system; echo err=$?' | grep err=|tr -d '\r') # bullshit.. mount do not return a valid errorcode! 272 | #F_ERR $RET 273 | echo "############# restoring SELinux mode to $CURSELINUX" 274 | RET=$(adb shell "su -c setenforce $CURSELINUX; echo err=$?" | grep err= |tr -d '\r') 275 | F_ERR $RET 276 | fi 277 | echo "ALL DONE! Reboot and enjoy the FIsH." 278 | echo 279 | echo -e "Get support on IRC:\n" 280 | echo -e "\tInstall HexChat (https://hexchat.github.io) -> channel #Carbon-user on freenode" 281 | echo -e "\tor" 282 | echo -e "\tjust open http://webchat.freenode.net/?channels=Carbon-user" 283 | echo 284 | echo 285 | -------------------------------------------------------------------------------- /fishing/FIsH: -------------------------------------------------------------------------------- 1 | ##################################################################################################### 2 | # 3 | # This is Android FIsH: [F]luffy [I]ncredible [s]teadfasterX [H]ijack 4 | # 5 | # Copyright (C) 2017 steadfasterX 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # 20 | # 21 | ###################################################################################################### 22 | 23 | 24 | ################################################################################################# 25 | # STOP HERE. No need to continue ;-) you only have to modify the FIsH.vars!! 26 | ################################################################################################# 27 | 28 | 29 | ################################################################################################# 30 | ########### NOW CODE ONLY ####################################################################### 31 | ################################################################################################# 32 | 33 | # do not touch this. If those files are missing check callmeFIsH first! 34 | TMPFISHDIR=/res/fish 35 | 36 | PID=$$ 37 | FISHME=$TMPFISHDIR/FIsH.me 38 | FISHPORT=$TMPFISHDIR/FIsH.porting 39 | 40 | [ ! -f $FISHME ] && echo "ERROR missing FIsH.me" && exit 3 41 | [ ! -f $FISHPORT ] && echo "ERROR missing FIsH.porting" && exit 3 42 | source $FISHME 43 | source $FISHPORT 44 | 45 | # initialize commands 46 | CMD_SETUP 47 | 48 | ${MOUNT} -o remount,rw rootfs / 49 | echo "${_DT} - $0 loaded" >> /$LOGFILE 50 | 51 | # get version details 52 | AVER=$(getprop ro.build.version.release| tr -d '\r') 53 | AREL=$(getprop ro.com.google.gmsversion| tr -d '\r') 54 | ABUILD=$(getprop ro.build.date| tr -d '\r') 55 | AFP=$(getprop ro.build.fingerprint| tr -d '\r') 56 | ASDK=$(getprop ro.build.version.sdk| tr -d '\r') 57 | SUVER=$(su -v|cut -d ":" -f1 |tr -d '.'| tr -d '\r') 58 | FFVER=$($CAT ${BTMGRPATH}/fishfood.release) 59 | 60 | echo "${_DT} - Detected versions:" >> $LOGFILE 61 | echo -e "\tFIsH: $FISHVER" >> $LOGFILE 62 | echo -e "\tFIsHFOOD: $FFVER" >> $LOGFILE 63 | echo -e "\tAndroid: $AVER" >> $LOGFILE 64 | echo -e "\tRelease level: $AREL" >> $LOGFILE 65 | echo -e "\tBuild date: $ABUILD" >> $LOGFILE 66 | echo -e "\tFingerprint: $AFP" >> $LOGFILE 67 | echo -e "\tSDK Level: $ASDK" >> $LOGFILE 68 | echo -e "\tSU version: $SUVER" >> $LOGFILE 69 | 70 | # this requires a patched /system with SuperSU but is required for everything in here: 71 | # selinux=permissive 72 | # we will save the default selinux mode for your device to not leaving your STOCK ROM 73 | # to permissive if u may don't want to. 74 | SELINUXBOOT=$(getenforce |tr -d '\r') 75 | echo "${_DT} - booted selinux mode <$(getenforce)>" >> /$LOGFILE 76 | setenforce 0 77 | echo "${_DT} - selinux is now: <$(getenforce)>" >> /$LOGFILE 78 | 79 | # turn off the lights 80 | echo "0" > ${FISH_LED} 81 | echo "0" > ${BOOT_LED} 82 | echo "0" > ${WAIT_LED} 83 | 84 | # Turn on WAIT-led -> NOW the user should press the key combo - until he feels the vibrate and red led! 85 | echo "255" > ${WAIT_LED} 86 | $SLEEP $KEYWAIT 87 | 88 | # for debugging.. 89 | $DMESG > ${LOGPATH}/dmesg.log 90 | 91 | # trigger vibration so user can release buttons now! 92 | echo '200' > $VIBRATE 93 | 94 | $PS -T -o pid,comm,args > ${LOGPATH}/ps.log 95 | ${CHMOD} 660 ${LOGPATH}/ps.log 96 | 97 | # check FIsH flag 98 | [ -f /cache/recovery/boot ] && FISH_FLAG=true 99 | 100 | # see if we want to start FIsH or not 101 | if [ "$FISH_FLAG" == "true" ];then 102 | ECHOL "### Enforcing FIsH boot mode by boot flag file.." 103 | RAMDISK="$FISHFOOD" 104 | else 105 | # check for the magic key press 106 | F_KEYPRESS 107 | KEYRET="$?" 108 | if [ "$KEYRET" -eq 1 ];then 109 | ECHOL "### FIsH boot mode by key press..." 110 | RAMDISK="$FISHFOOD" 111 | else 112 | # boot normally 113 | RAMDISK="" 114 | fi 115 | fi 116 | 117 | # Boot FIsH food if it exists 118 | EXECL cd / 119 | if [ -f ${BTMGRPATH}/${RAMDISK} ];then 120 | ECHOL "### ${RAMDISK} exists..." 121 | 122 | ECHOL "Your FIsHFOOD is: $($CAT ${BTMGRPATH}/fishfood.release)" >> $LOGFILE 123 | 124 | # removing flag to start FIsH 125 | if [ -f /cache/recovery/boot ]; then 126 | EXECL ${RM} /cache/recovery/boot 127 | fi 128 | 129 | # notify that we will be able to boot the FOOD because the desired ramdisk exists 130 | echo "0" > ${WAIT_LED} 131 | echo "255" > ${FISH_LED} 132 | ${SLEEP} 1 133 | 134 | ECHOL "### Checking device model..." 135 | MODEL=$(getprop ro.product.model) 136 | VERSION=$(getprop ro.product.name) 137 | MODEL2=$(getprop ro.build.product) 138 | ECHOL "Model found: $MODEL / $MODEL2 ($VERSION)" 139 | 140 | # remount rootfs to rw. 141 | ECHOL "### remount rootfs to rw..." 142 | EXECL ${MOUNT} -o remount,rw rootfs / 143 | 144 | # Install exfat module to support exfat file system 145 | ECHOL "### Install exfat module..." 146 | LIBP=/system/lib/modules 147 | EXECL lsmod |grep fat 148 | if [ $? -ne 0 ];then 149 | if [ "$LIBP/exfatfs.ko" ];then 150 | EXECL insmod $LIBP/exfatfs.ko 151 | else 152 | [ "$LIBP/texfat.ko" ]&& EXECL insmod $LIBP/texfat.ko 153 | fi 154 | else 155 | ECHOL "### Skipped exfat module (already loaded)..." 156 | fi 157 | 158 | # Stop init services. 159 | ECHOL "### stop init services..." 160 | ECHOL "All service states before:" 161 | getprop | ${GREP} -E '^\[init\.svc\..*\]:' >> $LOGFILE 162 | 163 | ECHOL "Excluded services: $EXCLUDESERVICES" 164 | 165 | for SVCRUNNING in $(getprop | ${GREP} -E '^\[init\.svc\..*\]: \[running\]' | ${EGREP} -v "($EXCLUDESERVICES)") 166 | do 167 | # set counter 168 | CNT=0 169 | SVCNAME=$(${EXPR} ${SVCRUNNING} : '\[init\.svc\.\(.*\)\]:.*') 170 | # try to stop a service it up to 3 times (we cannot get a valid service error state so this way..) 171 | while [ $CNT -lt 3 ];do 172 | if [ ! -z "$SVCNAME" ];then 173 | EXECL stop ${SVCNAME} 174 | CNT=$((CNT +1)) 175 | ECHOL "increased counter for $SVCNAME to $CNT" 176 | else 177 | # break out 178 | CNT=99 179 | fi 180 | done 181 | done 182 | 183 | ECHOL "All service states after:" 184 | getprop | ${GREP} -E '^\[init\.svc\..*\]:' >> $LOGFILE 185 | 186 | # Kill remaining processes under /system/bin 187 | ECHOL "### Kill /system/bin and /system/xbin processes (ps based)..." 188 | ${PS} | e${GREP} '(/system/bin|/system/xbin)' >> $LOGFILE 189 | for RUNNINGPRC in $(${PS} | e${GREP} '(/system/bin|/system/xbin)' | ${GREP} -v grep | ${GREP} -v $0 | ${AWK} '{print $1}' ) 190 | do 191 | EXECL ${KILL} -9 ${RUNNINGPRC} 192 | done 193 | 194 | ECHOL "### Kill /system/bin and /system/xbin processes (lsof based)..." 195 | $LSOF | e${GREP} '(/system/bin|/system/xbin)' >> $LOGFILE 196 | for RUNNINGPRC in $(${LSOF} | e${GREP} '(/system/bin|/system/xbin)' | ${GREP} -v grep | ${GREP} -v $0 | ${AWK} '{print $1}' ) 197 | do 198 | EXECL ${KILL} -9 ${RUNNINGPRC} 199 | done 200 | 201 | # Kill remaining processes under /sbin 202 | ECHOL "### Kill /sbin processes..." 203 | $PS -T -o pid,comm,args | ${GREP} /sbin >> $LOGFILE 204 | for RUNNINGPRC in $(${PS} | ${GREP} /sbin | ${GREP} -v grep | $AWK '{print $1}' ) 205 | do 206 | EXECL ${KILL} -9 ${RUNNINGPRC} 207 | done 208 | 209 | # MOVED to CALLMEFISH 210 | ### Moving Busybox to /res 211 | #ECHOL "### moving busybox.." 212 | #EXECL ${RM} -rf /res 213 | #EXECL ${MKDIR} /res 214 | #EXECL ${CHOWN} 0.0 /res 215 | #EXECL ${CHMOD} 0777 /res 216 | #EXECL ${CP} ${BUSYBOX} /res 217 | #BUSYBOX="$TMPFISHDIR/busybox" 218 | # Setup busybox commands to the new path 219 | #CMD_SETUP 220 | 221 | ## Move and decompress ramdisk to /res 222 | #ECHOL "### moving ${RAMDISK}..." 223 | #EXECL ${CP} ${BTMGRPATH}/${RAMDISK} /res 224 | ECHOL "### decompress ${RAMDISK}..." 225 | EXECL ${GZIP} -d $TMPFISHDIR/${RAMDISK} 226 | $LS -la $TMPFISHDIR >> $LOGFILE 227 | 228 | ################################################################## 229 | # 230 | ECHOL " ### NOW IT GET SERIOUS! LEAN BACK AND ENJOY THE FIsH!" 231 | # 232 | ################################################################## 233 | 234 | echo "\n\n ***** inotifies before we killing the wale ***** \n" >> $LOGFILE 235 | $PS $($FIND /proc/*/fd/* -type l -lname 'anon_inode:inotify' -print 2> /dev/null | $SED -e 's/^\/proc\/\([0-9]*\)\/.*/\1/') >> $LOGFILE 236 | lsmod >> $LOGFILE 237 | $BUSYBOX lsmod >> $LOGFILE 238 | 239 | # umount partitions, stripping the ramdisk to bare metal 240 | ECHOL " ### Unmounting partitions but before: here all current mounts" 241 | $MOUNT >> $LOGFILE 242 | 243 | #in order to completely remove them later we remount them rw before 244 | #for i in $($MOUNT |$GREP 'ro,'|grep -v remount-ro |$SED 's/ /|/g' | cut -d '|' -f3);do 245 | # ECHOL "### Remounting $i RW" 246 | # EXECL $MOUNT -oremount,rw $i 247 | #done 248 | EXECL $MOUNT -oremount,rw /system 249 | 250 | ECHOL " # Generating pid exclusion list based on EXCLUDEPROCS..." 251 | # create list of excluded PIDs based on given names 252 | unset FILTERPIDS 253 | NAMEMAP=$(F_PS |$EGREP "$EXCLUDEPROCS" |cut -d ":" -f1 | $TR "\n" "|" |sed 's/||//g;s/|$//g'|$SORT -u) 254 | ECHOL "based on >$EXCLUDEPROCS< these pid(s) were found: <$NAMEMAP>" 255 | [ ! -z "$NAMEMAP" ]&& FILTERPIDS="$NAMEMAP" 256 | 257 | #DEBUG: 258 | #ECHOL "These pids of PROCESS NAMES get excluded from being killed <$FILTERPIDS> as defined in EXCLUDEPROCS ($EXCLUDEPROCS)" 259 | 260 | # if filter pids were specified add them as well 261 | [ ! -z "$EXCLUDEPIDS" ] && [ ! -z "$FILTERPIDS" ] && FILTERPIDS="$FILTERPIDS|$EXCLUDEPIDS|$PID" 262 | [ ! -z "$EXCLUDEPIDS" ] && [ -z "$FILTERPIDS" ] && FILTERPIDS="$EXCLUDEPIDS|$PID" 263 | 264 | #DEBUG: 265 | #ECHOL "These PIDs get excluded from being killed as defined in EXCLUDEPIDS: <$EXCLUDEPIDS>\nIn sum all these PIDs get excluded from being killed: <$FILTERPIDS> ($PID is FIsH itself ;))" 266 | 267 | # umount all normal mounts (no /system yet!) 268 | ECHOL "### killing all processes accessing defined mountpoints (if any can be found by fuser and not excluded)" 269 | MOUNTS=$(for mountp in $MOUNTS;do [ -e "$mountp" ] && echo $mountp ;done) 270 | # convert newlines in MOUNTS variable into spaces 271 | SPACEMNT=$($ECHO $MOUNTS) 272 | TOKILL=$($FUSER -m $SPACEMNT | $TR ' ' '\n' | $SORT -u | $EGREP -v "$FILTERPIDS" | $TR '\n' ' ') 273 | PSGREP=$($ECHO "$TOKILL" | $SED -e 's/\([0-9]*\)/^\1:|/g;s/ //g;s/||//g;s/\^:|//g;s/|$//g') 274 | ECHOL "$FUSER -m $SPACEMNT | $TR ' ' '\\n' | $EGREP -v '$FILTERPIDS' | $TR '\\n' ' '" 275 | 276 | if [ ! -z "$TOKILL" ];then 277 | echo "Trying to kill ($PSGREP):" >> $LOGFILE 278 | F_PS | $EGREP "$PSGREP" >> $LOGFILE 279 | $ECHO "cmd: $KILL -9 $TOKILL" >> $LOGFILE 280 | $KILL -9 $TOKILL >> $LOGFILE 2>&1 281 | #ECHOL "KILLING $PSGREP IS DISABLED" 282 | else 283 | ECHOL "Empty pid skipped..!" 284 | fi 285 | ECHOL "### unmounting all defined (and also available) partitions" 286 | for i in $MOUNTS;do 287 | if [ -e $i ];then 288 | EXECL ${UMOUNT} $i || EXECL ${UMOUNT} -f $i || EXECL ${UMOUNT} -l $i 289 | else 290 | ECHOL "Skipped requested unmount because it does not exist ($i)" 291 | fi 292 | done 293 | 294 | ECHOL " ### Partitions after umounting" 295 | $MOUNT >> /$LOGFILE 296 | 297 | # prevent bootloops in testing mode 298 | if [ "$RUNONCE" -eq 1 ];then 299 | ECHOL "### RUNONCE DETECTED! WILL REMOVING FIsH FROM NEXT BOOT!!!" 300 | EXECL ${MOUNT} -oremount,rw /system 301 | EXECL ${RM} -rf /system/su.d/ $BTMGRPATH $TMPFISHDIR 302 | fi 303 | 304 | # AS OF HERE NO MORE BUSYBOX SYMLINKS IN $PATH!!!! 305 | ECHOL "### umounting system ..." 306 | EXECL ${UMOUNT} /system || EXECL ${UMOUNT} -f /system || EXECL ${UMOUNT} -l /system 307 | export PATH="/sbin" 308 | 309 | # rm symlinks & files. 310 | ECHOL "### Remove symlinks and files in rootfs" 311 | for rootfile in $(${BUSYBOX} find . -maxdepth 1 \( -type l -o -type f \)|$GREP -v './init$');do 312 | ${RM} -fv $rootfile 313 | done 314 | 315 | # Remove some directories 316 | ECHOL "### Remove directories..." 317 | for directory in `${BUSYBOX} find . -maxdepth 1 -type d`; do 318 | if [ "$directory" != "." -a "$directory" != ".." -a "$directory" != "./" -a "$directory" != "./dev" -a "$directory" != "./proc" -a "$directory" != "./sys" -a "$directory" != "./res" -a "$directory" != "./cache" ]; then 319 | $LS -la $directory >> $LOGFILE 320 | EXECL ${RM} -vrf $directory 2>&1 321 | fi 322 | done 323 | 324 | _DT=`${BUSYBOX} date +"%F %T"` 325 | echo "${_DT} - Will cook the FIsH now -> ${RAMDISK} \n" >> $LOGFILE 326 | 327 | # log process before extract ramdisk 328 | echo -e "\n\n ***** processes before extracting ramdisk ***** \n" >> $LOGFILE 329 | $PS -T -o pid,comm,args >> $LOGFILE 330 | echo -e "\n\n ***** directories before extracting ramdisk ***** \n-e " >> $LOGFILE 331 | ${LS} -la >> $LOGFILE 332 | 333 | # extract the food 334 | ECHOL "### Extracting uncompressed ramdisk (${RAMDISK/.gz}).." 335 | EXECL ${CPIO} -i -u < $TMPFISHDIR/${RAMDISK/.gz} 336 | # busybox cpio does not support exclusions by pattern .. 337 | [ -d /res/food ] && EXECL $RM -rf /res/food 338 | #EXECL $MKDIR /res/food 339 | #EXECL cd /res/food 340 | #EXECL ${CPIO} -i -u < $TMPFISHDIR/${RAMDISK/.gz} 341 | #EXECL $MV /res/food/* / 342 | #EXECL cd / 343 | 344 | echo -e "\n\n ***** directory before exec init ***** \n" >> $LOGFILE 345 | ${LS} -la >> $LOGFILE 346 | 347 | # TODO: validations of the above?! to avoid extraction errors etc.. 348 | 349 | DATETIME=`${BUSYBOX} date +"%F %T"` 350 | ECHOL "########### Executing the FIsHFOOD! YOU SHOULD SMELL THE FIsH ALREADY!" 351 | 352 | echo -e "\n\n ***** process before exec init ***** \n" >> $LOGFILE 353 | $PS -T -o pid,comm,args >> $LOGFILE 354 | 355 | echo -e "\n\n ***** lsof before exec init ***** \n" >> $LOGFILE 356 | ${LSOF} >> $LOGFILE 357 | 358 | echo -e "\n\n ***** inotifies before exec init ***** \n" >> $LOGFILE 359 | $PS $($FIND /proc/*/fd/* -type l -lname 'anon_inode:inotify' -print 2> /dev/null | $SED -e 's/^\/proc\/\([0-9]*\)\/.*/\1/') >> $LOGFILE 360 | 361 | # umount all special mounts 362 | for i in $SPECMOUNTS;do 363 | EXECL ${UMOUNT} $i || EXECL ${UMOUNT} -f $i || EXECL ${UMOUNT} -l $i 364 | done 365 | 366 | # wait 367 | ${SLEEP} 2 368 | 369 | # Kill remaining processes under /sbin again just to be sure 370 | ECHOL "### Kill /sbin processes (again!)..." 371 | $PS -T -o pid,comm,args| ${GREP} /sbin >> $LOGFILE 372 | for RUNNINGPRC in $(${PS} | ${GREP} /sbin | ${GREP} -v grep | $AWK '{print $1}' ) 373 | do 374 | EXECL ${KILL} -9 ${RUNNINGPRC} 375 | done 376 | 377 | $LSOF 378 | 379 | # turnoff LEDs 380 | $ECHO "0" > ${FISH_LED} 381 | $ECHO "0" > ${WAIT_LED} 382 | $ECHO "0" > ${BOOT_LED} 383 | 384 | # run 385 | export PATH="/sbin" 386 | export LD_LIBRARY_PATH=".:/sbin" 387 | 388 | # let the FISHFOOD takeover! 389 | #$CHROOT / /init 390 | if [ -x $FOODBIN ];then 391 | ECHOL "... now its all over ;) 1 ms before executing <$FOODBIN>! Hope u will enjoy this tasty FIsH!" 392 | # debugging a FIsHFOOD can be a PITA so FIsH comes with a special DEBUG mode to help you out there 393 | if [ "$DEBUG" -eq 1 ];then 394 | # clean dmesg 395 | dmesg -c >> /dev/null 2>&1 396 | ECHOL "!!!!!!!!!!! DEBUG MODE ENABLED - FIsH will commit suicide in 25 minutes !!!!!!!!!!!!" 397 | exec /$FOODBIN >> $LOGFILE 2>&1 \ 398 | & ECHOL "FOODBIN executed! These are the processes now:\n*********************************************************\n$(/res/fish/busybox ps)" 399 | ECHOL "dmesg output:\n******************************************\n$(/res/fish/busybox dmesg -c)" 400 | 401 | # try to enable adb 402 | adbd --root_seclabel=u:r:su:s0 --device_banner=recovery >>$LOGFILE 2>&1 403 | service adbd start >>$LOGFILE 2>&1 404 | 405 | # execute any extra commands if defined 406 | if [ ! -z "$DEBUGEXTRACMD" ];then 407 | ECHOL "$($DEBUGEXTRACMD 2>&1)" 408 | ECHOL "$DEBUGEXTRACMD executed! These are the processes now:\n*********************************************************\n$(/res/fish/busybox ps)" 409 | ECHOL "dmesg output (after >$DEBUGEXTRACMD<):\n******************************************\n$(/res/fish/busybox dmesg -c)" 410 | fi 411 | 412 | # ensure FIsH will not die too fast for debugging purposes 413 | SUICIDETIME="${SUICIDETIME:-25m}" 414 | ECHOL "after advanced time syntax: $SUICIDETIME" 415 | [ -z "$SUICIDETIME" ] && SUICIDETIME=26m 416 | ECHOL "after bulletproof time syntax: $SUICIDETIME" 417 | /res/fish/busybox sleep $SUICIDETIME 418 | 419 | # even when FIsHFOOD was executed fine FIsH will be do suicide as we are in debug mode 420 | ECHOL "FIsH suicide initiated!!! bye bye............" 421 | exit 0 422 | else 423 | exec /$FOODBIN >> $LOGFILE 2>&1 424 | fi 425 | else 426 | ECHOL "ERROR: ABORTED!!!! FOODBIN <$FOODBIN> does not exists or is not marked executable!!" 427 | fi 428 | # reboot when an error occurs 429 | # well.. this may causing bootloops 430 | #reboot 431 | else 432 | ECHOL "### RAMDISK ${RAMDISK} missing or normal boot mode!" 433 | fi 434 | 435 | # Show LED for normal boot 436 | echo "0" > ${FISH_LED} 437 | echo "0" > ${WAIT_LED} 438 | echo "255" > ${BOOT_LED} 439 | 440 | # set selinux to its previous state 441 | ECHOL "Will set SELinux back to: <$SELINUXBOOT>" 442 | EXECL setenforce $SELINUXBOOT 443 | ECHOL "${_DT} - selinux is now: <$($BUSYBOX getenforce)>" 444 | 445 | # remount everything RO again for a normal boot 446 | ${MOUNT} -o remount,ro rootfs / 447 | $ECHO "${_DT} - $0 ended without booting into FIsH" >> /$LOGFILE 448 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | --------------------------------------------------------------------------------