├── .gitignore ├── README.md ├── extra.sh ├── img4.sh ├── jinstall.sh ├── libimobiledevice.sh ├── make_ipa.sh ├── prometheus.sh └── update-jtool2.sh /.gitignore: -------------------------------------------------------------------------------- 1 | WD 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ios-scripts 2 | Scripts I use to setup a new macOS/Linux machine for iOS research 3 | 4 | - `libimobiledevice.sh` : build [libimobiledevice](https://github.com/libimobiledevice) 5 | - `img34.sh` : build [xpwn](https://github.com/xerub/xpwn) + [img4tool](https://github.com/xerub/img4tool) (no macOS support) 6 | - `jinstall` : install some tools by [J Levin](https://twitter.com/Morpheus______) 7 | - `prometheus.sh` : install [tihmstar](https://github.com/tihmstar)'s downgrade tools 8 | - `extra.sh` : some extras (libs & tools) 9 | 10 | I wrote these scripts for Ubuntu/Debian and macOS. Feel free to contribute. 11 | 12 | -------------------------------------------------------------------------------- /extra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -d "WD" ]; then 3 | echo "Removing WD" 4 | sudo rm -rf WD 5 | fi 6 | 7 | mkdir WD 8 | cd WD 9 | 10 | # crappy code I use to enter in recovery mode without udid 11 | git clone https://gist.github.com/0c272be43e70ad02012242921dd418be.git ideviceenterrecovery 12 | gcc ideviceenterrecovery/ideviceenterrecovery.c -o ideviceenterrecovery/ideviceenterrecovery.c -limobiledevice 13 | sudo cp ideviceenterrecovery/ideviceenterrecovery /usr/local/bin 14 | 15 | # Useful if you don't want to dl entire firmware 16 | git clone https://github.com/matteyeux/libcrippy && cd libcrippy 17 | ./autogen.sh && sudo make install 18 | cd .. 19 | 20 | git clone https://github.com/matteyeux/libpartialzip && cd libpartialzip 21 | ./autogen.sh && sudo make install 22 | if [[ $(uname) == 'Linux' ]]; then 23 | sudo ldconfig 24 | fi 25 | cd .. 26 | 27 | git clone https://github.com/radare/radare2 && cd radare2 28 | ./sys/install.sh 29 | cd .. 30 | 31 | git clone https://github.com/matteyeux/iBoot32Patcher 32 | make -C iBoot32Patcher install 33 | 34 | # I use it with qwertyoruiop's serialsh 35 | git clone https://github.com/matteyeux/term.git 36 | sudo make -C term install 37 | 38 | if [[ $(uname) == 'Darwin']]; then 39 | brew install boost curl 40 | else 41 | sudo apt-get install -y libboost-dev libcurl-dev 42 | fi 43 | 44 | git clone https://github.com/ABeltramo/otachecker-u 45 | make -C otachecker-u && cp bin/otachecker /usr/local/bin 46 | 47 | if [[ $(uname) == 'Linux' ]]; then 48 | wget https://d2ap6ypl1xbe4k.cloudfront.net/Hopper-v4-4.2.10-Linux.deb 49 | sudo dpkg -i Hopper-v4-4.2.10-Linux.deb 50 | fi 51 | -------------------------------------------------------------------------------- /img4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # you may have to install openssl first 3 | if [[ "$(whoami)" != "root" ]]; then 4 | echo "Please run this script as root" 5 | exit 1 6 | fi 7 | 8 | git clone --recursive https://github.com/xerub/img4lib ~/Documents/img4lib 9 | cd ~/Documents/img4lib 10 | make -C lzfse && make 11 | sudo cp img4 /usr/local/bin/ 12 | -------------------------------------------------------------------------------- /jinstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ####################################################################### 3 | # 4 | # Project......: jinstall 5 | # Creator......: matteyeux 6 | # Description..: Script to install or update some tools made by J Levin 7 | # (Too lazy to download and extract myself) 8 | # Type.........: Public 9 | # 10 | 11 | INSTALL_DIR='/usr/local/bin/' 12 | WD=~/.tmp_update #Working Directory 13 | 14 | function jtinstall { 15 | wget http://newosxbook.com/tools/jtool2.tgz -P /tmp/ 16 | tar zxvf /tmp/jtool2.tgz -C /tmp/ 17 | 18 | if [[ $(uname) == 'Darwin' ]]; then 19 | sudo cp /tmp/jtool2 /usr/local/bin 20 | elif [[ $(uname) == 'Linux' ]]; then 21 | sudo cp /tmp/jtool2.ELF64 /usr/local/bin/jtool2 22 | else 23 | echo "$(uname) not supported" 24 | fi 25 | 26 | echo -e "\033[1;32mInstalled jtool2 to $INSTALL_DIR" 27 | } 28 | 29 | function jokerinstall { 30 | wget http://www.newosxbook.com/tools/joker.tar 31 | tar xvf joker.tar 32 | if [[ $(uname) == 'Darwin' ]]; then 33 | cp joker.universal /usr/local/bin/joker 34 | else 35 | mv joker.ELF64 joker 36 | sudo cp joker $INSTALL_DIR 37 | fi 38 | echo -e "\033[1;32mInstalled joker to $INSTALL_DIR" 39 | } 40 | 41 | function disarm_install { 42 | wget http://newosxbook.com/tools/disarm.tar 43 | tar xvf disarm.tar 44 | if [[ $(uname) == 'Darwin' ]]; then 45 | cp disarm /usr/local/bin/ 46 | else 47 | rm disarm 48 | mv disarm.ELF64 disarm 49 | sudo cp disarm $INSTALL_DIR 50 | fi 51 | echo -e "\033[1;32mInstalled disarm to $INSTALL_DIR" 52 | } 53 | 54 | function otastuff { 55 | git clone https://gist.github.com/683ec721655f3729f9fad23b052384e3.git pbzx 56 | cd pbzx 57 | gcc pbzx.c -o pbzx 58 | cd .. 59 | git clone https://gist.github.com/be2a4f32a3ba49ad477b34292d728914.git ota 60 | cd ota 61 | gcc ota.c -o ota 62 | cd .. 63 | sudo cp pbzx/pbzx ota/ota $INSTALL_DIR 64 | echo -e "\033[1;32mInstalled OTA stuff to $INSTALL_DIR" 65 | } 66 | 67 | function main { 68 | if [[ $(uname) == 'Linux' && $(arch) == 'x86_64' || $(uname) == 'Darwin' ]]; then 69 | echo "starting script..." 70 | else 71 | echo "This script is only for Linux 64 bits or macOS" 72 | exit 1 73 | fi 74 | if [[ -e $WD ]]; then 75 | rm -rf $WD 76 | fi 77 | mkdir $WD 78 | cd $WD 79 | jtinstall 80 | jokerinstall 81 | disarm_install 82 | #otastuff 83 | echo -e "\033[1;32mAll tools are installed" 84 | echo -e "\033[1;32mCleaning" 85 | rm -rf $WD 86 | echo -e "\033[1;32mDone" 87 | } 88 | 89 | main 90 | -------------------------------------------------------------------------------- /libimobiledevice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ####################################################################### 3 | # 4 | # Project......: autobuild.sh 5 | # Creator......: Dev-Jam remasterized by matteyeux on 27/12/15 6 | ####################################################################### 7 | 8 | echo -e "\033[31mDev-Jam 12/01/2015 - Script to build & install Libimobiledevice\033[0m" 9 | echo -e "\033[32m\033[1m\033[4m\033[5m\033[7mCreated by Dev-Jam, improved by @matteyeux on 27/12/15\033[0m" 10 | 11 | function linux_depends(){ 12 | 13 | if [[ $(which apt-get) ]]; then 14 | sudo apt-get install -y git build-essential make autoconf \ 15 | automake libtool openssl tar perl binutils gcc g++ \ 16 | libc6-dev libssl-dev libusb-1.0-0-dev \ 17 | libcurl4-gnutls-dev fuse libxml2-dev \ 18 | libgcc1 libreadline-dev libglib2.0-dev libzip-dev \ 19 | libclutter-1.0-dev \ 20 | libfuse-dev cython python2.7 \ 21 | libncurses5 22 | else 23 | echo "Package manager is not supported" 24 | exit 1 25 | fi 26 | } 27 | 28 | function macos_depends(){ 29 | # Install Hombrew. 30 | if [[ ! -e $(which brew) ]]; then 31 | echo "Brew is not installed..." 32 | echo "installing brew..." 33 | sleep 1 34 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 35 | else 36 | echo "Brew already installed" 37 | fi 38 | 39 | # Ask for the administrator password upfront. 40 | sudo -v 41 | 42 | # Keep-alive: update existing `sudo` time stamp until the script has finished. 43 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 44 | 45 | # Make sure we’re using the latest Homebrew. 46 | brew update 47 | 48 | # Upgrade any already-installed formulae. 49 | brew upgrade 50 | 51 | # Install Development Packages; 52 | brew install libxml2 53 | brew install libzip 54 | brew install libplist 55 | brew install usbmuxd 56 | 57 | # Install Software; 58 | brew install automake 59 | brew install cmake 60 | brew install colormake 61 | brew install autoconf 62 | brew install libtool 63 | brew install pkg-config 64 | brew install gcc 65 | brew install libusb 66 | brew install glib 67 | 68 | # Install Optional; 69 | brew install Caskroom/cask/osxfuse 70 | 71 | 72 | # Install other useful binaries. 73 | brew install ack 74 | brew install git 75 | 76 | # Remove outdated versions from the cellar. 77 | brew cleanup 78 | 79 | # OpenSSL shit 80 | git clone https://github.com/openssl/openssl.git 81 | cd openssl 82 | ./config 83 | make && sudo make install 84 | cd .. 85 | rm -rf openssl # clean 86 | } 87 | 88 | function build_libimobiledevice(){ 89 | libs=( "libplist" "libusbmuxd" "libimobiledevice" "usbmuxd" "libirecovery" \ 90 | "ideviceinstaller" "libideviceactivation" "idevicerestore" "ifuse" ) 91 | 92 | buildlibs() { 93 | for i in "${libs[@]}" 94 | do 95 | echo -e "\033[1;32mFetching $i..." 96 | git clone https://github.com/libimobiledevice/${i}.git 97 | cd $i 98 | echo -e "\033[1;32mConfiguring $i..." 99 | ./autogen.sh 100 | echo -e "\033[1;32mBuilding $i..." 101 | make && sudo make install 102 | echo -e "\033[1;32mInstalling $i..." 103 | cd .. 104 | done 105 | } 106 | 107 | buildlibs 108 | if [[ -e $(which ldconfig) ]]; then 109 | ldconfig 110 | else 111 | echo " " 112 | fi 113 | } 114 | 115 | if [[ $(uname) == 'Linux' ]]; then 116 | linux_depends 117 | elif [[ $(uname) == 'Darwin' ]]; then 118 | macos_depends 119 | fi 120 | build_libimobiledevice 121 | echo -e "\033[32m\033[1m\033[4m\033[5m\033[7mLibimobiledevice successfully installed thanks for using this script\033[0m" 122 | -------------------------------------------------------------------------------- /make_ipa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # From to.panga repository 3 | # just added a simple var when ppl ask me to build multiple IPAs 4 | APP=g0blin 5 | $(which xcodebuild) clean build CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" -sdk `xcrun --sdk iphoneos --show-sdk-path` -arch arm64 6 | mv build/Release-iphoneos/$APP.app $APP.app 7 | mkdir Payload 8 | mv $APP.app Payload/$APP.app 9 | zip -r9 $APP.ipa Payload/$APP.app 10 | rm -rf build Payload 11 | -------------------------------------------------------------------------------- /prometheus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -d "WD" ]; then 3 | echo "Removing WD" 4 | sudo rm -rf WD 5 | fi 6 | 7 | mkdir WD 8 | cd WD 9 | 10 | 11 | 12 | if [[ $(uname) == 'Darwin' ]]; then 13 | tool=futurerestore_macos 14 | elif [[ $(uname) == 'Linux' ]]; then 15 | tool=futurerestore_linux 16 | else 17 | echo "$(uname) not supported" 18 | fi 19 | 20 | git clone https://github.com/tihmstar/libfragmentzip && cd libfragmentzip 21 | ./autogen.sh && sudo make install 22 | cd .. 23 | 24 | git clone --recursive https://github.com/tihmstar/tsschecker 25 | ./tsschecker/autogen.sh 26 | sudo make -C tsschecker install 27 | 28 | mkdir tmp && cd tmp 29 | wget http://api.tihmstar.net/builds/futurerestore/futurerestore-latest.zip 30 | unzip futurerestore-latest.zip 31 | 32 | chmod +x $tool && sudo cp $tool /usr/local/bin/futurerestore 33 | cd ../ && rm -rf tmp 34 | -------------------------------------------------------------------------------- /update-jtool2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # will merge with jinstall.sh once jtool2 hits beta/release stage 3 | wget http://newosxbook.com/tools/jtool2.tgz -P /tmp/ 4 | tar zxvf /tmp/jtool2.tgz -C /tmp/ 5 | 6 | if [[ $(uname) == 'Darwin' ]]; then 7 | sudo cp /tmp/jtool2 /usr/local/bin 8 | elif [[ $(uname) == 'Linux' ]]; then 9 | sudo cp /tmp/jtool2.ELF64 /usr/local/bin/jtool2 10 | else 11 | echo "$(uname) not supported" 12 | fi 13 | --------------------------------------------------------------------------------