Last active
November 11, 2025 13:55
-
-
Save miticollo/6e65b59d83b17bacc00523a0f9d41c11 to your computer and use it in GitHub Desktop.
Revisions
-
miticollo revised this gist
Jul 26, 2024 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,10 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbrea Starting from version 16.1.5 Frida supports rootless and rootfull JB. So you can add [https://build.frida.re/](https://build.frida.re/) to your package manager. ### New Instructions If you want to compile a new version of Frida (≥ 16.2.2) you can use my [new guide](https://gist.github.com/miticollo/12e3fff5ba8fab7dd707c874105a508f). ## Build Instructions ### Requirements -
miticollo revised this gist
Feb 29, 2024 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,13 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbrea ## TL;DR ~On [Dopamine/Fugu15 Max](https://github.com/opa334/Dopamine) or [palera1n](https://github.com/palera1n/palera1n) you can add [my repo](https://miticollo.github.io/repos/) (open the link in your favorite browser on your jailbroken iDevice).~ ~The [DEBs](https://github.com/miticollo/miticollo.github.io/tree/main/repos/my/debs/frida) you will install are build using the following instructions.~ ### Update 2024-02-29 Starting from version 16.1.5 Frida supports rootless and rootfull JB. So you can add [https://build.frida.re/](https://build.frida.re/) to your package manager. ## Build Instructions -
miticollo revised this gist
Aug 29, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,9 +124,9 @@ macOS is required because you need to use Apple's proprietary software like Xcod To get the rootless version of frida, you need to edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) - [`frida-core/tools/package-server-fruity.sh`](https://github.com/frida/frida-core/blob/main/tools/package-server-fruity.sh) (for Frida 16.1.3 and below) You can find an example based on Frida 16.1.4 in this gist. Now go to step [8](#xcode). -
miticollo revised this gist
Aug 29, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,9 +124,9 @@ macOS is required because you need to use Apple's proprietary software like Xcod To get the rootless version of frida, you need to edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) - [`frida-core/tools/package-server-fruity.sh`](https://github.com/frida/frida-core/blob/main/tools/package-server-fruity.sh) (for Frida 16.0.13 and below) You can find an example based on Frida 16.0.14 in this gist. Now go to step [8](#xcode). -
miticollo revised this gist
Jul 23, 2023 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,10 +70,15 @@ macOS is required because you need to use Apple's proprietary software like Xcod > **Note**<br> > To properly instrument **all applications**, all necessary architectures must be in place. > For instance, to instrument Safari, the `frida-agent.dylib` for ARM64e is required. > However, for Spotify, the required architecture is ARM64. > <span><!-- https://t.me/fridadotre/72269 --></span> > If the `frida-agent.dylib` does not contain both slices, you will likely encounter an `Incompatible Mach-O image` error when using the `frida` CLI tool.<br> > To check what I said, compare the output of the following two commands: > ```bash > file /Applications/MobileSafari.app/MobileSafari > file /var/containers/Bundle/Application/<UUID>/Spotify.app/Spotify > ``` 11. Make the universal [`frida-server`](https://github.com/frida/frida/blob/1b2bf7cbf86a862597465d57f23e373ddc62104e/.github/workflows/ci.yml#L221-L227) and [`frida-agent.dylib`](https://github.com/frida/frida/blob/1b2bf7cbf86a862597465d57f23e373ddc62104e/.github/workflows/ci.yml#L238-L249) - **rootless** -
miticollo revised this gist
Jul 23, 2023 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,15 @@ macOS is required because you need to use Apple's proprietary software like Xcod 1. Install the latest version of Xcode with command-line tools from the App Store. Without it, you **won't have** iPhoneOS SDKs. 2. Download Xcode 11.7 directly from Apple at the following link: [Xcode_11.7.xip](https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.7/Xcode_11.7.xip). You will need to authenticate with your Apple ID to download it. > <picture> > <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/light-theme/tip.svg"> > <img alt="Tip" src="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/main/blockquotes/badge/dark-theme/tip.svg"> > </picture><br> > > To better manage multiple Xcode versions, you can use a CLI tool called [`xcodes`](https://github.com/XcodesOrg/xcodes). > Alternatively, if you prefer an equivalent GUI app, you can use [XcodesApp](https://github.com/XcodesOrg/XcodesApp). 3. Once downloaded, opening the .xip archive will begin extracting it. After extraction, rename the app to avoid conflicting with your primary installation of Xcode and move it to `/Applications/` (e.g., `mv Xcode.app /Applications/Xcode-11.7.app`). 4. Download [this script](https://raw.githubusercontent.com/conda-forge/gdb-feedstock/main/recipe/macos-codesign/macos-setup-codesign.sh), change `gdb_codesign` to `frida-cert`, and then run it. 5. Run `brew install dpkg` to install `dpkg-deb`. -
miticollo revised this gist
Jun 24, 2023 . 2 changed files with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -98,19 +98,19 @@ macOS is required because you need to use Apple's proprietary software like Xcod ``` - **rootless** ```shell ./frida-core/tools/package-server-fruity.sh 'iphoneos-arm64' build/frida-ios-universal/var/jb build/"frida_${FRIDA_VERSION}_iphoneos-universal.deb" ``` - **rootfull** ```shell ./frida-core/tools/package-server-fruity.sh 'iphoneos-arm' build/frida-ios-universal build/"frida_${FRIDA_VERSION}_iphoneos-universal.deb" ``` 14. Check the `build/` directory to find your DEB file. Enjoy! ##### Rootless To get the rootless version of frida, you need to edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) - [`frida-core/tools/package-server-fruity.sh`](https://github.com/frida/frida-core/blob/main/tools/package-server-fruity.sh) You can find an example based on Frida 16.0.11 in this gist. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,12 +5,13 @@ if [ -z "$FRIDA_VERSION" ]; then exit 2 fi if [ $# -ne 3 ]; then echo "Usage: $0 arch path/to/prefix output.deb" > /dev/stderr exit 3 fi arch=$1 prefix=$2 output_deb=$3 executable=$prefix/usr/bin/frida-server if [ ! -f "$executable" ]; then @@ -75,7 +76,7 @@ Version: $FRIDA_VERSION Priority: optional Size: 1337 Installed-Size: $installed_size Architecture: $arch Description: Observe and reprogram running programs. Homepage: https://frida.re/ Maintainer: Ole André Vadla Ravnås <[email protected]> -
miticollo revised this gist
Jun 22, 2023 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,11 +39,7 @@ macOS is required because you need to use Apple's proprietary software like Xcod ```shell git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" ``` To go back to `origin/main`, run `git switch -`. 8. <span id="xcode"></span> (Optional) Select your preferred Xcode version: ```shel @@ -94,7 +90,7 @@ macOS is required because you need to use Apple's proprietary software like Xcod ``` > **Note**<br/> > I ran this command because otherwise on Dopamine/Fugu15 Max JB `frida-server` was being `Killed: 9`. 13. Package everything into a DEB file: ```shell -
miticollo revised this gist
Jun 22, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ The [DEBs](https://github.com/miticollo/miticollo.github.io/tree/main/repos/my/d ### Requirements - Make sure you have: - [Python 3](https://github.com/pyenv/pyenv).7+ in your PATH - [Node.js](https://github.com/nvm-sh/nvm) in your PATH - [`ldid`](https://github.com/ProcursusTeam/ldid) in your PATH -
miticollo revised this gist
May 3, 2023 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,11 +48,6 @@ cat >"$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" <<EOF <array> <string>/var/jb/usr/sbin/frida-server</string> </array> <key>UserName</key> <string>root</string> <key>POSIXSpawnType</key> -
miticollo revised this gist
May 1, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbrea On [Dopamine/Fugu15 Max](https://github.com/opa334/Dopamine) or [palera1n](https://github.com/palera1n/palera1n) you can add [my repo](https://miticollo.github.io/repos/) (open the link in your favorite browser on your jailbroken iDevice). The [DEBs](https://github.com/miticollo/miticollo.github.io/tree/main/repos/my/debs/frida) you will install are build using the following instructions. ## Build Instructions -
miticollo revised this gist
May 1, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,9 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbrea ## TL;DR On [Dopamine/Fugu15 Max](https://github.com/opa334/Dopamine) or [palera1n](https://github.com/palera1n/palera1n) you can add [my repo](https://miticollo.github.io/repos/) (open the link in your favorite browser on your jailbroken iDevice). The DEB you will install is build using the following instructions. ## Build Instructions -
miticollo revised this gist
May 1, 2023 . 1 changed file with 14 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,28 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbreaks. ## TL;DR On [Dopamine/Fugu15 Max](https://github.com/opa334/Dopamine) or [palera1n](https://github.com/palera1n/palera1n) you can add my repo: - [Add to Sileo](sileo://source/https://miticollo.github.io/repos/my) - [Add to Zebra](zbra://sources/add/https://miticollo.github.io/repos/my) ## Build Instructions ### Requirements - Make sure you have: - [Python 3](https://github.com/pyenv/pyenv) in your PATH - [Node.js](https://github.com/nvm-sh/nvm) in your PATH - [`ldid`](https://github.com/ProcursusTeam/ldid) in your PATH ### macOS macOS is required because you need to use Apple's proprietary software like Xcode, `lipo`, and `codesign`. > **Warning**<br/> > Before starting, read carefully up to the end. #### Build 1. Install the latest version of Xcode with command-line tools from the App Store. Without it, you **won't have** iPhoneOS SDKs. 2. Download Xcode 11.7 directly from Apple at the following link: [Xcode_11.7.xip](https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.7/Xcode_11.7.xip). You will need to authenticate with your Apple ID to download it. @@ -102,7 +110,7 @@ macOS is required because you need to use Apple's proprietary software like Xcod ``` 14. Check the `build/` directory to find your DEB file. Enjoy! ##### Rootless To get the rootless version of frida, you need to edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) @@ -112,7 +120,7 @@ You can find an example based on Frida 16.0.11 in this gist. Now go to step [8](#xcode). #### How to upgrade 1. Go back to `origin/main` ```shell git switch - @@ -124,7 +132,7 @@ Now go to step [8](#xcode). 3. If necessary solve conflicts. 4. Now go to step [7](#checkout). #### Clean up 1. Run ```shell make clean distclean -
miticollo revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -119,7 +119,7 @@ Now go to step [8](#xcode). ``` 2. Pull new commits ```shell git pull --recurse-submodules ``` 3. If necessary solve conflicts. 4. Now go to step [7](#checkout). -
miticollo revised this gist
Apr 15, 2023 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,8 @@ macOS is required because you need to use Apple's proprietary software like Xcod git clone --recurse-submodules https://github.com/frida/frida.git cd frida ``` 7. <span id="checkout"></span> (Optional) Check out the latest stable release: ```shell git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" ``` @@ -111,6 +112,18 @@ You can find an example based on Frida 16.0.11 in this gist. Now go to step [8](#xcode). ### How to upgrade 1. Go back to `origin/main` ```shell git switch - ``` 2. Pull new commits ```shell git pull ``` 3. If necessary solve conflicts. 4. Now go to step [7](#checkout). ### Clean up 1. Run ```shell -
miticollo revised this gist
Apr 4, 2023 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,7 +53,15 @@ macOS is required because you need to use Apple's proprietary software like Xcod ```shell make build/frida-ios-{arm64e,arm64,arm64eoabi}/usr/lib/pkgconfig/frida-core-1.0.pc ``` > **Note**<br> > To properly instrument **all applications**, all necessary architectures must be in place. > For instance, to instrument Safari, the `frida-agent.dylib` for ARM64e is required. > However, for Spotify, the required architecture is ARM64. > <span><!-- https://t.me/fridadotre/72269 --></span> > If the `frida-agent.dylib` does not contain both slices, you will likely encounter an `Incompatible Mach-O image` error when using the `frida` CLI tool. 11. Make the universal [`frida-server`](https://github.com/frida/frida/blob/1b2bf7cbf86a862597465d57f23e373ddc62104e/.github/workflows/ci.yml#L221-L227) and [`frida-agent.dylib`](https://github.com/frida/frida/blob/1b2bf7cbf86a862597465d57f23e373ddc62104e/.github/workflows/ci.yml#L238-L249) - **rootless** ```shell mkdir -vp ./build/frida-ios-universal/var/jb/usr/{bin,lib/frida}/ -
miticollo revised this gist
Mar 31, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,15 +60,15 @@ macOS is required because you need to use Apple's proprietary software like Xcod python ./releng/mkfatmacho.py ./build/frida-ios-{universal,arm64,arm64e,arm64eoabi}/var/jb/usr/bin/frida-server lipo ./build/frida-ios-{arm64,arm64e}/var/jb/usr/lib/frida/frida-agent.dylib -create -output ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib install_name_tool -id 'FridaAgent' ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib codesign -s "$IOS_CERTID" -fv --timestamp=none --generate-entitlement-der ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib ``` - **rootfull** ```shell mkdir -vp ./build/frida-ios-universal/usr/{bin,lib/frida}/ python ./releng/mkfatmacho.py ./build/frida-ios-{universal,arm64,arm64e,arm64eoabi}/usr/bin/frida-server lipo ./build/frida-ios-{arm64,arm64e}/usr/lib/frida/frida-agent.dylib -create -output ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib install_name_tool -id 'FridaAgent' ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib codesign -s "$IOS_CERTID" -fv --timestamp=none --generate-entitlement-der ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib ``` 12. <span id="fugu"></span> (Optional) Fake signing `frida-server`: -
miticollo revised this gist
Mar 29, 2023 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,7 +70,8 @@ macOS is required because you need to use Apple's proprietary software like Xcod install_name_tool -id 'FridaAgent' ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib codesign -s "$IOS_CERTID" -fv --generate-entitlement-der ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib ``` 12. <span id="fugu"></span> (Optional) Fake signing `frida-server`: ```shell ldid -S -M './build/frida-ios-universal/var/jb/usr/bin/frida-server' ``` -
miticollo revised this gist
Mar 29, 2023 . 3 changed files with 176 additions and 269 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,73 +1,110 @@ Here, I'll show you how to compile Frida for both rootfull and rootless jailbreaks. ## Requirements - Make sure you have: - [Python 3](https://github.com/pyenv/pyenv) in your PATH - [Node.js](https://github.com/nvm-sh/nvm) in your PATH - [`ldid`](https://github.com/ProcursusTeam/ldid) in your PATH ## macOS macOS is required because you need to use Apple's proprietary software like Xcode, `lipo`, and `codesign`. > **Warning**<br/> > Before starting, read carefully up to the end. ### Build 1. Install the latest version of Xcode with command-line tools from the App Store. Without it, you **won't have** iPhoneOS SDKs. 2. Download Xcode 11.7 directly from Apple at the following link: [Xcode_11.7.xip](https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.7/Xcode_11.7.xip). You will need to authenticate with your Apple ID to download it. 3. Once downloaded, opening the .xip archive will begin extracting it. After extraction, rename the app to avoid conflicting with your primary installation of Xcode and move it to `/Applications/` (e.g., `mv Xcode.app /Applications/Xcode-11.7.app`). 4. Download [this script](https://raw.githubusercontent.com/conda-forge/gdb-feedstock/main/recipe/macos-codesign/macos-setup-codesign.sh), change `gdb_codesign` to `frida-cert`, and then run it. 5. Run `brew install dpkg` to install `dpkg-deb`. 6. Clone the project: ```shell git clone --recurse-submodules https://github.com/frida/frida.git cd frida ``` 7. (Optional) Check out the latest stable release: ```shell git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" ``` To go back to `origin/main`, run `git switch -`. > **Note**<br/> > I had some compiling problems with the version update to the latest commit. 8. <span id="xcode"></span> (Optional) Select your preferred Xcode version: ```shel export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer ``` 9. Export the identity previously created in an enviroment variable called `IOS_CERTID`: ```shell export IOS_CERTID=frida-cert ``` 10. Build `frida-server` and `frida-agent.dylib` for 3 different architectures: - **rootless** ```shell make build/frida-ios-{arm64e,arm64,arm64eoabi}/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc ``` - **rootfull** ```shell make build/frida-ios-{arm64e,arm64,arm64eoabi}/usr/lib/pkgconfig/frida-core-1.0.pc ``` 11. Make the universal `frida-server` and `frida-agent.dylib` - **rootless** ```shell mkdir -vp ./build/frida-ios-universal/var/jb/usr/{bin,lib/frida}/ python ./releng/mkfatmacho.py ./build/frida-ios-{universal,arm64,arm64e,arm64eoabi}/var/jb/usr/bin/frida-server lipo ./build/frida-ios-{arm64,arm64e}/var/jb/usr/lib/frida/frida-agent.dylib -create -output ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib install_name_tool -id 'FridaAgent' ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib codesign -s "$IOS_CERTID" -fv --generate-entitlement-der ./build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib ``` - **rootfull** ```shell mkdir -vp ./build/frida-ios-universal/usr/{bin,lib/frida}/ python ./releng/mkfatmacho.py ./build/frida-ios-{universal,arm64,arm64e,arm64eoabi}/usr/bin/frida-server lipo ./build/frida-ios-{arm64,arm64e}/usr/lib/frida/frida-agent.dylib -create -output ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib install_name_tool -id 'FridaAgent' ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib codesign -s "$IOS_CERTID" -fv --generate-entitlement-der ./build/frida-ios-universal/usr/lib/frida/frida-agent.dylib ``` 12. (Optional) Fake signing `frida-server`: ```shell ldid -S -M './build/frida-ios-universal/var/jb/usr/bin/frida-server' ``` > **Note**<br/> > I ran this command because otherwise on Fugu15 Max JB `frida-server` was being `Killed: 9`. 13. Package everything into a DEB file: ```shell export FRIDA_VERSION=$(releng/frida_version.py) ``` - **rootless** ```shell ./frida-core/tools/package-server-ios.sh build/frida-ios-universal/var/jb build/"frida_${FRIDA_VERSION}_iphoneos-universal.deb" ``` - **rootfull** ```shell ./frida-core/tools/package-server-ios.sh build/frida-ios-universal build/"frida_${FRIDA_VERSION}_iphoneos-universal.deb" ``` 14. Check the `build/` directory to find your DEB file. Enjoy! #### Rootless To get the rootless version of frida, you need to edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) - [`frida-core/tools/package-server-ios.sh`](https://github.com/frida/frida-core/blob/main/tools/package-server-ios.sh) You can find an example based on Frida 16.0.11 in this gist. Now go to step [8](#xcode). ### Clean up 1. Run ```shell make clean distclean ``` 2. Go to step [8](#xcode). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,7 @@ include config.mk build_arch := $(shell releng/detect-arch.sh) ios_arm64eoabi_target := $(shell test -d /Applications/Xcode-11.7.app && echo build/frida-ios-arm64eoabi/usr/lib/pkgconfig/frida-core-1.0.pc) test_args := $(addprefix -p=,$(tests)) HELP_FUN = \ @@ -53,11 +48,7 @@ clean: clean-submodules rm -f build/*-clang* rm -f build/*-pkg-config rm -f build/*-stamp rm -f build/*.rc rm -f build/*.tar.bz2 rm -f build/*.txt rm -f build/frida-version.h @@ -78,10 +69,62 @@ clean-submodules: cd frida-tools && git clean -xfd define make-ios-env-rule build/frida-env-ios-$1.rc: releng/setup-env.sh build/frida-version.h @if [ $1 != $$(build_machine) ]; then \ cross=yes; \ else \ cross=no; \ fi; \ for machine in $$(build_machine) ios-$1; do \ if [ ! -f build/frida-env-$$$$machine.rc ]; then \ FRIDA_HOST=$$$$machine \ FRIDA_CROSS=$$$$cross \ FRIDA_PREFIX="$$(abspath build/frida-ios-$1/var/jb/usr)" \ FRIDA_ASAN=$$(FRIDA_ASAN) \ XCODE11="$$(XCODE11)" \ ./releng/setup-env.sh || exit 1; \ fi \ done endef $(eval $(call make-ios-env-rule,arm64)) $(eval $(call make-ios-env-rule,arm64e)) $(eval $(call make-ios-env-rule,arm64eoabi)) $(eval $(call make-ios-env-rule,x86_64-simulator)) $(eval $(call make-ios-env-rule,arm64-simulator)) build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-gum-1.0.pc: build/frida-env-ios-%.rc build/.frida-gum-submodule-stamp . build/frida-env-ios-$*.rc; \ builddir=build/tmp-ios-$*/frida-gum; \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,ios-$*) \ --prefix /var/jb/usr \ $(frida_gum_flags) \ frida-gum $$builddir || exit 1; \ fi \ && $(MESON) compile -C $$builddir \ && DESTDIR="$(abspath build/frida-ios-$*)" $(MESON) install -C $$builddir @touch $@ build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc: build/.frida-core-submodule-stamp build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-ios-$*.rc; \ builddir=build/tmp-ios-$*/frida-core; \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,ios-$*) \ --prefix /var/jb/usr \ $(frida_core_flags) \ -Dassets=installed \ frida-core $$builddir || exit 1; \ fi \ && $(MESON) compile -C $$builddir \ && DESTDIR="$(abspath build/frida-ios-$*)" $(MESON) install -C $$builddir @touch $@ gum-macos: build/frida-macos-$(build_arch)/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for macOS gum-ios: build/frida-ios-arm64/usr/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for iOS gum-watchos: build/frida_thin-watchos-arm64/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for watchOS gum-tvos: build/frida_thin-tvos-arm64/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for tvOS gum-android-x86: build/frida-android-x86/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/x86 gum-android-x86_64: build/frida-android-x86_64/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/x86-64 gum-android-arm: build/frida-android-arm/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/arm @@ -116,10 +159,10 @@ check-gum-macos: build/frida-macos-x86_64/lib/pkgconfig/frida-gum-1.0.pc endif core-macos: build/frida-macos-$(build_arch)/lib/pkgconfig/frida-core-1.0.pc ##@core Build for macOS core-ios: build/frida-ios-arm64/usr/lib/pkgconfig/frida-core-1.0.pc ##@core Build for iOS core-watchos: build/frida_thin-watchos-arm64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for watchOS core-tvos: build/frida_thin-tvos-arm64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for tvOS core-android-x86: build/frida-android-x86/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/x86 core-android-x86_64: build/frida-android-x86_64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/x86-64 core-android-arm: build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/arm @@ -284,113 +327,6 @@ build/tmp-android-%/frida-core/.frida-agent-stamp: build/tmp-android-%/frida-cor . build/frida-env-android-$*.rc && ninja -C build/tmp-android-$*/frida-core lib/agent/frida-agent.so @touch $@ ifeq ($(build_arch), arm64) check-core-macos: build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc ##@core Run tests for macOS build/tmp-macos-arm64/frida-core/tests/frida-tests $(test_args) @@ -403,18 +339,8 @@ check-core-macos: build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc build/tmp-macos-x86_64/frida-core/tests/frida-tests $(test_args) endif python-macos: build/tmp-macos-$(build_arch)/frida-$(PYTHON_NAME)/.frida-stamp ##@python Build Python bindings for macOS define make-python-rule build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-stamp build/$1-%$(PYTHON_PREFIX)/lib/pkgconfig/frida-core-1.0.pc @@ -423,61 +349,21 @@ build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-sta if [ ! -f $$$$builddir/build.ninja ]; then \ $$(call meson-setup-for-env,$1,$$*) \ --prefix $$(FRIDA)/build/$1-$$*$(PYTHON_PREFIX) \ $$(FRIDA_FLAGS_COMMON) \ -Dpython=$$(PYTHON) \ -Dpython_incdir=$$(PYTHON_INCDIR) \ frida-python $$$$builddir || exit 1; \ fi; \ $$(MESON) install -C $$$$builddir || exit 1 @touch $$@ endef $(eval $(call make-python-rule,frida,tmp)) $(eval $(call make-python-rule,frida_thin,tmp_thin)) check-python-macos: python-macos ##@python Test Python bindings for macOS export PYTHONPATH="$(shell pwd)/build/frida-macos-$(build_arch)/lib/$(PYTHON_NAME)/site-packages" \ && cd frida-python \ && $(PYTHON) -m unittest discover node-macos: build/frida-macos-$(build_arch)/lib/node_modules/frida ##@node Build Node.js bindings for macOS @@ -497,7 +383,6 @@ build/$1-%/lib/node_modules/frida: build/$1-%/lib/pkgconfig/frida-core-1.0.pc bu && mv build/Release/frida_binding.node ../$$@.tmp/build/ \ && rm -rf build \ && mv node_modules ../$$@.tmp/ \ && mv ../$$@.tmp ../$$@ endef $(eval $(call make-node-rule,frida,tmp)) @@ -519,7 +404,7 @@ check-node-macos: node-macos ##@node Test Node.js bindings for macOS $(call run-node-tests,frida-macos-$(build_arch),$(FRIDA),$(NODE_BIN_DIR),$(NODE),$(NPM)) tools-macos: build/tmp-macos-$(build_arch)/frida-tools-$(PYTHON_NAME)/.frida-stamp ##@tools Build CLI tools for macOS define make-tools-rule build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodule-stamp build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp @@ -536,54 +421,35 @@ build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodul endef $(eval $(call make-tools-rule,frida,tmp)) $(eval $(call make-tools-rule,frida_thin,tmp_thin)) check-tools-macos: tools-macos ##@tools Test CLI tools for macOS export PYTHONPATH="$(shell pwd)/build/frida-macos-$(build_arch)/lib/$(PYTHON_NAME)/site-packages" \ && cd frida-tools \ && $(PYTHON) -m unittest discover .PHONY: \ distclean clean clean-submodules git-submodules git-submodule-stamps \ gum-macos \ gum-ios gum-watchos gum-tvos \ gum-android-x86 gum-android-x86_64 \ gum-android-arm gum-android-arm64 \ check-gum-macos \ frida-gum-update-submodule-stamp \ core-macos \ core-ios core-watchos core-tvos \ core-android-x86 core-android-x86_64 \ core-android-arm core-android-arm64 \ check-core-macos \ frida-core-update-submodule-stamp \ python-macos \ python-macos-universal \ check-python-macos \ frida-python-update-submodule-stamp \ node-macos \ check-node-macos \ frida-node-update-submodule-stamp \ tools-macos \ check-tools-macos \ frida-tools-update-submodule-stamp .SECONDARY: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,13 +12,13 @@ fi prefix=$1 output_deb=$2 executable=$prefix/usr/bin/frida-server if [ ! -f "$executable" ]; then echo "$executable: not found" > /dev/stderr exit 4 fi agent=$prefix/usr/lib/frida/frida-agent.dylib if [ ! -f "$agent" ]; then echo "$agent: not found" > /dev/stderr exit 5 @@ -55,6 +55,8 @@ cat >"$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" <<EOF </dict> <key>UserName</key> <string>root</string> <key>POSIXSpawnType</key> <string>Interactive</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> @@ -92,11 +94,11 @@ cat >"$tmpdir/DEBIAN/extrainst_" <<EOF #!/bin/sh if [ "\$1" = upgrade ]; then launchctl unload /var/jb/Library/LaunchDaemons/re.frida.server.plist fi if [ "\$1" = install ] || [ "\$1" = upgrade ]; then launchctl load /var/jb/Library/LaunchDaemons/re.frida.server.plist fi exit 0 @@ -106,20 +108,22 @@ cat >"$tmpdir/DEBIAN/prerm" <<EOF #!/bin/sh if [ "\$1" = remove ] || [ "\$1" = purge ]; then launchctl unload /var/jb/Library/LaunchDaemons/re.frida.server.plist fi exit 0 EOF chmod 755 "$tmpdir/DEBIAN/prerm" dpkg_options="-Zxz --root-owner-group" dpkg-deb $dpkg_options --build "$tmpdir" "$output_deb" package_size=$(expr $(du -sk "$output_deb" | cut -f1) \* 1024) sed \ -e "s,^Size: 1337$,Size: $package_size,g" \ "$tmpdir/DEBIAN/control" > "$tmpdir/DEBIAN/control_" mv "$tmpdir/DEBIAN/control_" "$tmpdir/DEBIAN/control" dpkg-deb $dpkg_options --build "$tmpdir" "$output_deb" rm -rf "$tmpdir" -
miticollo revised this gist
Feb 6, 2023 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
miticollo renamed this gist
Feb 6, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
miticollo revised this gist
Feb 6, 2023 . No changes.There are no files selected for viewing
-
miticollo renamed this gist
Feb 6, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
miticollo renamed this gist
Feb 6, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
miticollo revised this gist
Feb 6, 2023 . No changes.There are no files selected for viewing
-
miticollo revised this gist
Feb 6, 2023 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,4 +60,14 @@ Choose this method **ONLY** if you have a full jailbreak (R/W on `/`). ```bash make distclean ``` 2. Go to <a href="#item2">step 2 of "Upgrade"</a>. ## Rootless To get rootless version of frida you must edit the following files: - [`Makefile.macos.mk`](https://github.com/frida/frida/blob/main/Makefile.macos.mk) - [`frida-core/tools/package-server-ios.sh`](https://github.com/frida/frida-core/blob/main/tools/package-server-ios.sh) ### Example Here you can find the files for frida 16.0.2. -
miticollo revised this gist
Feb 6, 2023 . 2 changed files with 714 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,589 @@ include config.mk build_arch := $(shell releng/detect-arch.sh) ifeq ($(build_arch), arm64) build_cpu_flavor := apple_silicon else build_cpu_flavor := intel endif ios_arm64eoabi_target := $(shell test -d /Applications/Xcode-11.7.app && echo build/frida-ios-arm64eoabi/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc) test_args := $(addprefix -p=,$(tests)) HELP_FUN = \ my (%help, @sections); \ while(<>) { \ if (/^([\w-]+)\s*:.*\#\#(?:@([\w-]+))?\s(.*)$$/) { \ $$section = $$2 // 'options'; \ push @sections, $$section unless exists $$help{$$section}; \ push @{$$help{$$section}}, [$$1, $$3]; \ } \ } \ $$target_color = "\033[32m"; \ $$variable_color = "\033[36m"; \ $$reset_color = "\033[0m"; \ print "\n"; \ print "\033[31mUsage:$${reset_color} make $${target_color}TARGET$${reset_color} [$${variable_color}VARIABLE$${reset_color}=value]\n\n"; \ print "Where $${target_color}TARGET$${reset_color} specifies one or more of:\n"; \ print "\n"; \ for (@sections) { \ print " /* $$_ */\n"; $$sep = " " x (23 - length $$_->[0]); \ printf(" $${target_color}%-23s$${reset_color} %s\n", $$_->[0], $$_->[1]) for @{$$help{$$_}}; \ print "\n"; \ } \ print "And optionally also $${variable_color}VARIABLE$${reset_color} values:\n"; \ print " $${variable_color}PYTHON$${reset_color} Absolute path of Python interpreter including version suffix\n"; \ print " $${variable_color}NODE$${reset_color} Absolute path of Node.js binary\n"; \ print "\n"; \ print "For example:\n"; \ print " \$$ make $${target_color}python-macos $${variable_color}PYTHON$${reset_color}=/usr/local/bin/python3.6\n"; \ print " \$$ make $${target_color}node-macos $${variable_color}NODE$${reset_color}=/usr/local/bin/node\n"; \ print "\n"; help: @LC_ALL=C perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) include releng/frida.mk distclean: clean-submodules rm -rf build/ rm -rf deps/ clean: clean-submodules rm -f build/*-clang* rm -f build/*-pkg-config rm -f build/*-stamp rm -f build/*-strip rm -f build/*.deb rm -f build/*.rc rm -f build/*.sh rm -f build/*.site rm -f build/*.tar.bz2 rm -f build/*.txt rm -f build/frida-version.h rm -rf build/frida-*-* rm -rf build/frida_thin-*-* rm -rf build/fs-*-* rm -rf build/ft-*-* rm -rf build/tmp-*-* rm -rf build/tmp_thin-*-* rm -rf build/fs-tmp-*-* rm -rf build/ft-tmp-*-* clean-submodules: cd frida-gum && git clean -xfd cd frida-core && git clean -xfd cd frida-python && git clean -xfd cd frida-node && git clean -xfd cd frida-tools && git clean -xfd gum-macos: gum-macos-$(build_cpu_flavor) ##@gum Build for macOS gum-macos-apple_silicon: build/frida-macos-arm64/lib/pkgconfig/frida-gum-1.0.pc build/frida-macos-arm64e/lib/pkgconfig/frida-gum-1.0.pc gum-macos-intel: build/frida-macos-x86_64/lib/pkgconfig/frida-gum-1.0.pc gum-ios: build/frida-ios-arm64/usr/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for iOS gum-android-x86: build/frida-android-x86/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/x86 gum-android-x86_64: build/frida-android-x86_64/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/x86-64 gum-android-arm: build/frida-android-arm/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/arm gum-android-arm64: build/frida-android-arm64/lib/pkgconfig/frida-gum-1.0.pc ##@gum Build for Android/arm64 define make-gum-rules build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/$1-env-%.rc build/.frida-gum-submodule-stamp . build/$1-env-$$*.rc; \ builddir=build/$2-$$*/frida-gum; \ if [ ! -f $$$$builddir/build.ninja ]; then \ $$(call meson-setup-for-env,$1,$$*) \ --prefix $$(FRIDA)/build/$1-$$* \ $$(frida_gum_flags) \ frida-gum $$$$builddir || exit 1; \ fi; \ $$(MESON) install -C $$$$builddir || exit 1 @touch -c $$@ endef $(eval $(call make-gum-rules,frida,tmp)) $(eval $(call make-gum-rules,frida_thin,tmp_thin)) ifeq ($(build_arch), arm64) check-gum-macos: build/frida-macos-arm64/lib/pkgconfig/frida-gum-1.0.pc build/frida-macos-arm64e/lib/pkgconfig/frida-gum-1.0.pc ##@gum Run tests for macOS build/tmp-macos-arm64/frida-gum/tests/gum-tests $(test_args) runner=build/tmp-macos-arm64e/frida-gum/tests/gum-tests; \ if $$runner --help &>/dev/null; then \ $$runner $(test_args); \ fi else check-gum-macos: build/frida-macos-x86_64/lib/pkgconfig/frida-gum-1.0.pc build/tmp-macos-x86_64/frida-gum/tests/gum-tests $(test_args) endif core-macos: core-macos-$(build_cpu_flavor) ##@core Build for macOS core-macos-apple_silicon: build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc core-macos-intel: build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc core-ios: build/frida-ios-universal/var/jb/usr/bin/frida-server ##@core Build for iOS core-android-x86: build/frida-android-x86/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/x86 core-android-x86_64: build/frida-android-x86_64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/x86-64 core-android-arm: build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/arm core-android-arm64: build/frida-android-arm64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/arm64 build/tmp-macos-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-macos-arm64/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-macos-arm64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,macos-arm64) \ --prefix $(FRIDA)/build/frida-macos-arm64 \ $(frida_core_flags) \ -Dhelper_modern=$(FRIDA)/build/tmp-macos-arm64e/frida-core/src/frida-helper \ -Dhelper_legacy=$(FRIDA)/build/tmp-macos-arm64/frida-core/src/frida-helper \ -Dagent_modern=$(FRIDA)/build/tmp-macos-arm64e/frida-core/lib/agent/frida-agent.dylib \ -Dagent_legacy=$(FRIDA)/build/tmp-macos-arm64/frida-core/lib/agent/frida-agent.dylib \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-macos-arm64e/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-macos-arm64e/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-macos-arm64e.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,macos-arm64e) \ --prefix $(FRIDA)/build/frida-macos-arm64e \ $(frida_core_flags) \ -Dhelper_modern=$(FRIDA)/build/tmp-macos-arm64e/frida-core/src/frida-helper \ -Dhelper_legacy=$(FRIDA)/build/tmp-macos-arm64/frida-core/src/frida-helper \ -Dagent_modern=$(FRIDA)/build/tmp-macos-arm64e/frida-core/lib/agent/frida-agent.dylib \ -Dagent_legacy=$(FRIDA)/build/tmp-macos-arm64/frida-core/lib/agent/frida-agent.dylib \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-macos-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-macos-x86_64/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-macos-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,macos-x86_64) \ --prefix $(FRIDA)/build/frida-macos-x86_64 \ $(frida_core_flags) \ -Dhelper_modern=$(FRIDA)/build/tmp-macos-x86_64/frida-core/src/frida-helper \ -Dagent_modern=$(FRIDA)/build/tmp-macos-x86_64/frida-core/lib/agent/frida-agent.dylib \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-android-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86/lib/pkgconfig/frida-gum-1.0.pc if [ "$(FRIDA_AGENT_EMULATED)" == "yes" ]; then \ agent_emulated_legacy=$(FRIDA)/build/tmp-android-arm/frida-core/lib/agent/frida-agent.so; \ fi; \ . build/frida-env-android-x86.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,android-x86) \ --prefix $(FRIDA)/build/frida-android-x86 \ $(frida_core_flags) \ -Dagent_emulated_legacy=$$agent_emulated_legacy \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-android-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86_64/lib/pkgconfig/frida-gum-1.0.pc if [ "$(FRIDA_AGENT_EMULATED)" == "yes" ]; then \ agent_emulated_modern=$(FRIDA)/build/tmp-android-arm64/frida-core/lib/agent/frida-agent.so; \ agent_emulated_legacy=$(FRIDA)/build/tmp-android-arm/frida-core/lib/agent/frida-agent.so; \ fi; \ . build/frida-env-android-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,android-x86_64) \ --prefix $(FRIDA)/build/frida-android-x86_64 \ $(frida_core_flags) \ -Dhelper_modern=$(FRIDA)/build/tmp-android-x86_64/frida-core/src/frida-helper \ -Dhelper_legacy=$(FRIDA)/build/tmp-android-x86/frida-core/src/frida-helper \ -Dagent_modern=$(FRIDA)/build/tmp-android-x86_64/frida-core/lib/agent/frida-agent.so \ -Dagent_legacy=$(FRIDA)/build/tmp-android-x86/frida-core/lib/agent/frida-agent.so \ -Dagent_emulated_modern=$$agent_emulated_modern \ -Dagent_emulated_legacy=$$agent_emulated_legacy \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-android-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-android-arm.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,android-arm) \ --prefix $(FRIDA)/build/frida-android-arm \ $(frida_core_flags) \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp-android-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm64/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-android-arm64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,android-arm64) \ --prefix $(FRIDA)/build/frida-android-arm64 \ $(frida_core_flags) \ -Dhelper_modern=$(FRIDA)/build/tmp-android-arm64/frida-core/src/frida-helper \ -Dhelper_legacy=$(FRIDA)/build/tmp-android-arm/frida-core/src/frida-helper \ -Dagent_modern=$(FRIDA)/build/tmp-android-arm64/frida-core/lib/agent/frida-agent.so \ -Dagent_legacy=$(FRIDA)/build/tmp-android-arm/frida-core/lib/agent/frida-agent.so \ frida-core $$builddir || exit 1; \ fi @touch $@ build/tmp_thin-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida_thin-%/lib/pkgconfig/frida-gum-1.0.pc . build/frida_thin-env-$*.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup-thin,$*) \ --prefix $(FRIDA)/build/frida_thin-$* \ $(frida_core_flags) \ frida-core $$builddir || exit 1; \ fi @touch $@ ifeq ($(FRIDA_AGENT_EMULATED), yes) legacy_agent_emulated_dep := build/tmp-android-arm/frida-core/.frida-agent-stamp modern_agent_emulated_dep := build/tmp-android-arm64/frida-core/.frida-agent-stamp endif build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-x86_64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-x86_64/frida-core/src/frida-data-{helper,agent}* . build/frida-env-macos-x86_64.rc && $(MESON) install -C build/tmp-macos-x86_64/frida-core @touch $@ build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-arm64/frida-core/.frida-helper-and-agent-stamp build/tmp-macos-arm64e/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-arm64/frida-core/src/frida-data-{helper,agent}* . build/frida-env-macos-arm64.rc && $(MESON) install -C build/tmp-macos-arm64/frida-core @touch $@ build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-arm64/frida-core/.frida-helper-and-agent-stamp build/tmp-macos-arm64e/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-arm64e/frida-core/src/frida-data-{helper,agent}* . build/frida-env-macos-arm64e.rc && $(MESON) install -C build/tmp-macos-arm64e/frida-core @touch $@ build/frida-android-x86/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp $(legacy_agent_emulated_dep) @rm -f build/tmp-android-x86/frida-core/src/frida-data-{helper,agent}* . build/frida-env-android-x86.rc && $(MESON) install -C build/tmp-android-x86/frida-core @touch $@ build/frida-android-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-android-x86_64/frida-core/.frida-helper-and-agent-stamp $(legacy_agent_emulated_dep) $(modern_agent_emulated_dep) @rm -f build/tmp-android-x86_64/frida-core/src/frida-data-{helper,agent}* . build/frida-env-android-x86_64.rc && $(MESON) install -C build/tmp-android-x86_64/frida-core @touch $@ build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm/frida-core/src/frida-data-{helper,agent}* . build/frida-env-android-arm.rc && $(MESON) install -C build/tmp-android-arm/frida-core @touch $@ build/frida-android-arm64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm64/frida-core/src/frida-data-{helper,agent}* . build/frida-env-android-arm64.rc && $(MESON) install -C build/tmp-android-arm64/frida-core @touch $@ build/frida_thin-%/lib/pkgconfig/frida-core-1.0.pc: build/tmp_thin-%/frida-core/.frida-ninja-stamp . build/frida_thin-env-$*.rc && $(MESON) install -C build/tmp_thin-$*/frida-core @touch $@ build/tmp-macos-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-macos-%/frida-core/.frida-ninja-stamp . build/frida-env-macos-$*.rc && ninja -C build/tmp-macos-$*/frida-core src/frida-helper lib/agent/frida-agent.dylib @touch $@ build/tmp-macos-%/frida-core/.frida-agent-stamp: build/tmp-macos-%/frida-core/.frida-ninja-stamp . build/frida-env-macos-$*.rc && ninja -C build/tmp-macos-$*/frida-core lib/agent/frida-agent.dylib @touch $@ build/tmp-android-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-android-%/frida-core/.frida-ninja-stamp . build/frida-env-android-$*.rc && ninja -C build/tmp-android-$*/frida-core src/frida-helper lib/agent/frida-agent.so @touch $@ build/tmp-android-%/frida-core/.frida-agent-stamp: build/tmp-android-%/frida-core/.frida-ninja-stamp . build/frida-env-android-$*.rc && ninja -C build/tmp-android-$*/frida-core lib/agent/frida-agent.so @touch $@ build/frida-macos-universal/lib/frida/frida-gadget.dylib: \ build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc \ build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc \ build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc @mkdir -p $(@D) . build/frida-env-macos-$(build_arch).rc \ && $$LIPO \ build/frida-macos-x86_64/lib/frida/frida-gadget.dylib \ build/frida-macos-arm64/lib/frida/frida-gadget.dylib \ build/frida-macos-arm64e/lib/frida/frida-gadget.dylib \ -create \ -output $@.tmp \ && $$INSTALL_NAME_TOOL -id @executable_path/../Frameworks/FridaGadget.dylib $@.tmp \ && $$CODESIGN -f -s "$$MACOS_CERTID" $@.tmp \ && mv $@.tmp $@ build/frida-ios-universal/var/jb/usr/bin/frida-server: \ build/frida-ios-arm64/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc \ build/frida-ios-arm64e/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc \ $(ios_arm64eoabi_target) @mkdir -p $(@D) build/frida-ios-universal/var/jb/usr/lib/frida . build/frida-env-ios-arm64e.rc \ && agent=build/frida-ios-universal/var/jb/usr/lib/frida/frida-agent.dylib \ && $$LIPO \ build/frida-ios-arm64/var/jb/usr/lib/frida/frida-agent.dylib \ build/frida-ios-arm64e/var/jb/usr/lib/frida/frida-agent.dylib \ -create \ -output $$agent \ && $$INSTALL_NAME_TOOL -id FridaAgent $$agent \ && $$CODESIGN -f -s "$$IOS_CERTID" $$agent \ && slices=() \ && for arch in arm64 arm64eoabi arm64e; do \ if [ -f build/frida-ios-$$arch/var/jb/usr/bin/frida-server ]; then \ cp build/frida-ios-$$arch/var/jb/usr/bin/frida-server $@-$$arch || exit 1; \ $$CODESIGN -f -s "$$IOS_CERTID" --entitlements frida-core/server/frida-server.xcent $@-$$arch || exit 1; \ slices+=($@-$$arch); \ fi \ done \ && ./releng/mkfatmacho.py $@.tmp "$${slices[@]}" \ && rm $@-* \ && mv $@.tmp $@ build/frida-ios-universal/usr/lib/frida/frida-gadget.dylib: \ build/frida-ios-x86_64/usr/lib/pkgconfig/frida-core-1.0.pc \ build/frida-ios-arm64/usr/lib/pkgconfig/frida-core-1.0.pc \ build/frida-ios-arm64e/usr/lib/pkgconfig/frida-core-1.0.pc @mkdir -p $(@D) . build/frida-env-ios-arm64e.rc \ && $$LIPO \ build/frida-ios-x86_64/usr/lib/frida/frida-gadget.dylib \ build/frida-ios-arm64/usr/lib/frida/frida-gadget.dylib \ build/frida-ios-arm64e/usr/lib/frida/frida-gadget.dylib \ -create \ -output $@.tmp \ && $$INSTALL_NAME_TOOL -id @executable_path/Frameworks/FridaGadget.dylib $@.tmp \ && $$CODESIGN -f -s "$$IOS_CERTID" $@.tmp \ && mv $@.tmp $@ define make-ios-env-rule build/frida-env-ios-$1.rc: releng/setup-env.sh build/frida-version.h @if [ $1 != $$(build_os_arch) ]; then \ cross=yes; \ else \ cross=no; \ fi; \ for os_arch in $$(build_os_arch) ios-$1; do \ if [ ! -f build/frida-env-$$$$os_arch.rc ]; then \ FRIDA_HOST=$$$$os_arch \ FRIDA_CROSS=$$$$cross \ FRIDA_PREFIX="$$(abspath build/frida-ios-$1/var/jb/usr)" \ FRIDA_ASAN=$$(FRIDA_ASAN) \ XCODE11="$$(XCODE11)" \ ./releng/setup-env.sh || exit 1; \ fi \ done endef $(eval $(call make-ios-env-rule,x86_64)) $(eval $(call make-ios-env-rule,arm64)) $(eval $(call make-ios-env-rule,arm64e)) $(eval $(call make-ios-env-rule,arm64eoabi)) build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-gum-1.0.pc: build/frida-env-ios-%.rc build/.frida-gum-submodule-stamp . build/frida-env-ios-$*.rc; \ builddir=build/tmp-ios-$*/frida-gum; \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,ios-$*) \ --prefix /var/jb/usr \ $(frida_gum_flags) \ frida-gum $$builddir || exit 1; \ fi \ && $(MESON) compile -C $$builddir \ && DESTDIR="$(abspath build/frida-ios-$*)" $(MESON) install -C $$builddir @touch $@ build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-core-1.0.pc: build/.frida-core-submodule-stamp build/frida-ios-%/var/jb/usr/lib/pkgconfig/frida-gum-1.0.pc . build/frida-env-ios-$*.rc; \ builddir=build/tmp-ios-$*/frida-core; \ if [ ! -f $$builddir/build.ninja ]; then \ $(call meson-setup,ios-$*) \ --prefix /var/jb/usr \ $(frida_core_flags) \ -Dassets=installed \ frida-core $$builddir || exit 1; \ fi \ && $(MESON) compile -C $$builddir \ && DESTDIR="$(abspath build/frida-ios-$*)" $(MESON) install -C $$builddir @touch $@ ifeq ($(build_arch), arm64) check-core-macos: build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc ##@core Run tests for macOS build/tmp-macos-arm64/frida-core/tests/frida-tests $(test_args) runner=build/tmp-macos-arm64e/frida-core/tests/frida-tests; \ if $$runner --help &>/dev/null; then \ $$runner $(test_args); \ fi else check-core-macos: build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc build/tmp-macos-x86_64/frida-core/tests/frida-tests $(test_args) endif gadget-macos: build/frida-macos-universal/lib/frida/frida-gadget.dylib ##@gadget Build for macOS gadget-ios: build/frida-ios-universal/usr/lib/frida/frida-gadget.dylib ##@gadget Build for iOS deb-ios: build/frida-ios-universal/usr/bin/frida-server export FRIDA_VERSION=$$(grep 'FRIDA_VERSION "' build/frida-version.h | awk '{ print $$3; }' | cut -f2 -d'"'); \ frida-core/tools/package-server.sh build/frida-ios-universal build/frida_$${FRIDA_VERSION}_iphoneos-arm.deb python-macos: python-macos-$(build_cpu_flavor) ##@python Build Python bindings for macOS python-macos-universal: build/frida-macos-universal/lib/$(PYTHON_NAME)/site-packages/frida build/frida-macos-universal/lib/$(PYTHON_NAME)/site-packages/_frida.so python-macos-apple_silicon: build/frida-macos-apple_silicon/lib/$(PYTHON_NAME)/site-packages/frida build/frida-macos-apple_silicon/lib/$(PYTHON_NAME)/site-packages/_frida.so python-macos-intel: build/frida-macos-intel/lib/$(PYTHON_NAME)/site-packages/frida build/frida-macos-intel/lib/$(PYTHON_NAME)/site-packages/_frida.so define make-python-rule build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-stamp build/$1-%$(PYTHON_PREFIX)/lib/pkgconfig/frida-core-1.0.pc . build/$1-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ $$(call meson-setup-for-env,$1,$$*) \ --prefix $$(FRIDA)/build/$1-$$*$(PYTHON_PREFIX) \ -Dpython=$$(PYTHON) \ -Dpython_incdir=$$(PYTHON_INCDIR) \ frida-python $$$$builddir || exit 1; \ fi; \ $$(MESON) install -C $$$$builddir || exit 1; \ $$$$STRIP $$$$STRIP_FLAGS build/$1-$$*$(PYTHON_PREFIX)/lib/$$(PYTHON_NAME)/site-packages/_frida.so @touch $$@ endef $(eval $(call make-python-rule,frida,tmp)) $(eval $(call make-python-rule,frida_thin,tmp_thin)) build/frida-macos-universal/lib/$(PYTHON_NAME)/site-packages/frida: build/tmp-macos-arm64e/frida-$(PYTHON_NAME)/.frida-stamp rm -rf $@ mkdir -p $(@D) cp -a build/frida-macos-arm64e/lib/$(PYTHON_NAME)/site-packages/frida $@ @touch $@ build/frida-macos-apple_silicon/lib/$(PYTHON_NAME)/site-packages/frida: build/tmp-macos-arm64e/frida-$(PYTHON_NAME)/.frida-stamp rm -rf $@ mkdir -p $(@D) cp -a build/frida-macos-arm64e/lib/$(PYTHON_NAME)/site-packages/frida $@ @touch $@ build/frida-macos-intel/lib/$(PYTHON_NAME)/site-packages/frida: build/tmp-macos-x86_64/frida-$(PYTHON_NAME)/.frida-stamp rm -rf $@ mkdir -p $(@D) cp -a build/frida-macos-x86_64/lib/$(PYTHON_NAME)/site-packages/frida $@ @touch $@ build/frida-macos-universal/lib/$(PYTHON_NAME)/site-packages/_frida.so: build/tmp-macos-arm64/frida-$(PYTHON_NAME)/.frida-stamp build/tmp-macos-arm64e/frida-$(PYTHON_NAME)/.frida-stamp build/tmp-macos-x86_64/frida-$(PYTHON_NAME)/.frida-stamp mkdir -p $(@D) cp build/frida-macos-arm64/lib/$(PYTHON_NAME)/site-packages/_frida.so $(@D)/_frida-arm64.so cp build/frida-macos-arm64e/lib/$(PYTHON_NAME)/site-packages/_frida.so $(@D)/_frida-arm64e.so cp build/frida-macos-x86_64/lib/$(PYTHON_NAME)/site-packages/_frida.so $(@D)/_frida-x86_64.so . build/frida-env-macos-$(build_arch).rc \ && $$LIPO $(@D)/_frida-arm64.so $(@D)/_frida-arm64e.so $(@D)/_frida-x86_64.so -create -output $@ rm $(@D)/_frida-arm64.so $(@D)/_frida-arm64e.so $(@D)/_frida-x86_64.so build/frida-macos-apple_silicon/lib/$(PYTHON_NAME)/site-packages/_frida.so: build/tmp-macos-arm64/frida-$(PYTHON_NAME)/.frida-stamp build/tmp-macos-arm64e/frida-$(PYTHON_NAME)/.frida-stamp mkdir -p $(@D) cp build/frida-macos-arm64/lib/$(PYTHON_NAME)/site-packages/_frida.so $(@D)/_frida-arm64.so cp build/frida-macos-arm64e/lib/$(PYTHON_NAME)/site-packages/_frida.so $(@D)/_frida-arm64e.so . build/frida-env-macos-$(build_arch).rc \ && $$LIPO $(@D)/_frida-arm64.so $(@D)/_frida-arm64e.so -create -output $@ rm $(@D)/_frida-arm64.so $(@D)/_frida-arm64e.so build/frida-macos-intel/lib/$(PYTHON_NAME)/site-packages/_frida.so: build/tmp-macos-x86_64/frida-$(PYTHON_NAME)/.frida-stamp mkdir -p $(@D) cp build/frida-macos-x86_64/lib/$(PYTHON_NAME)/site-packages/_frida.so $@ @touch $@ define run-python-tests export PYTHONPATH="$(shell pwd)/build/frida-macos-$1/lib/$(PYTHON_NAME)/site-packages" \ && cd frida-python \ && $2 $(PYTHON) -m unittest discover endef check-python-macos: check-python-macos-$(build_cpu_flavor) ##@python Test Python bindings for macOS check-python-macos-apple_silicon: python-macos-apple_silicon $(call run-python-tests,apple_silicon,) check-python-macos-intel: python-macos-intel $(call run-python-tests,intel,arch -x86_64) node-macos: build/frida-macos-$(build_arch)/lib/node_modules/frida ##@node Build Node.js bindings for macOS define make-node-rule build/$1-%/lib/node_modules/frida: build/$1-%/lib/pkgconfig/frida-core-1.0.pc build/.frida-node-submodule-stamp @$$(NPM) --version &>/dev/null || (echo -e "\033[31mOops. It appears Node.js is not installed.\nCheck PATH or set NODE to the absolute path of your Node.js binary.\033[0m"; exit 1;) export PATH=$$(NODE_BIN_DIR):$$$$PATH FRIDA=$$(FRIDA) \ && cd frida-node \ && rm -rf frida-0.0.0.tgz build node_modules \ && $$(NPM) install \ && $$(NPM) pack \ && rm -rf ../$$@/ ../$$@.tmp/ \ && mkdir -p ../$$@.tmp/build/ \ && tar -C ../$$@.tmp/ --strip-components 1 -x -f frida-0.0.0.tgz \ && rm frida-0.0.0.tgz \ && mv build/Release/frida_binding.node ../$$@.tmp/build/ \ && rm -rf build \ && mv node_modules ../$$@.tmp/ \ && . ../build/$1-env-macos-$$(build_arch).rc && $$$$STRIP $$$$STRIP_FLAGS ../$$@.tmp/build/frida_binding.node \ && mv ../$$@.tmp ../$$@ endef $(eval $(call make-node-rule,frida,tmp)) $(eval $(call make-node-rule,frida_thin,tmp_thin)) define run-node-tests export PATH=$3:$$PATH FRIDA=$2 \ && cd frida-node \ && git clean -xfd \ && $5 install \ && $4 \ --expose-gc \ ../build/$1/lib/node_modules/frida/node_modules/.bin/_mocha \ -r ts-node/register \ --timeout 60000 \ test/*.ts endef check-node-macos: node-macos ##@node Test Node.js bindings for macOS $(call run-node-tests,frida-macos-$(build_arch),$(FRIDA),$(NODE_BIN_DIR),$(NODE),$(NPM)) tools-macos: build/frida-macos-$(build_cpu_flavor)/bin/frida build/frida-macos-$(build_cpu_flavor)/lib/$(PYTHON_NAME)/site-packages/frida_tools ##@tools Build CLI tools for macOS define make-tools-rule build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodule-stamp build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp . build/$1-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ $$(call meson-setup-for-env,$1,$$*) \ --prefix $$(FRIDA)/build/$1-$$* \ -Dpython=$$(PYTHON) \ frida-tools $$$$builddir || exit 1; \ fi; \ $$(MESON) install -C $$$$builddir || exit 1 @touch $$@ endef $(eval $(call make-tools-rule,frida,tmp)) $(eval $(call make-tools-rule,frida_thin,tmp_thin)) build/frida-macos-$(build_cpu_flavor)/bin/frida: build/tmp-macos-$(build_arch)/frida-tools-$(PYTHON_NAME)/.frida-stamp mkdir -p build/frida-macos-$(build_cpu_flavor)/bin for tool in $(frida_tools); do \ cp build/frida-macos-$(build_arch)/bin/$$tool build/frida-macos-$(build_cpu_flavor)/bin/; \ done build/frida-macos-$(build_cpu_flavor)/lib/$(PYTHON_NAME)/site-packages/frida_tools: \ build/tmp-macos-$(build_arch)/frida-tools-$(PYTHON_NAME)/.frida-stamp \ build/frida-macos-$(build_cpu_flavor)/lib/$(PYTHON_NAME)/site-packages/frida \ build/frida-macos-$(build_cpu_flavor)/lib/$(PYTHON_NAME)/site-packages/_frida.so rm -rf $@ mkdir -p $(@D) cp -a build/frida-macos-$(build_arch)/lib/$(PYTHON_NAME)/site-packages/frida_tools $@ @touch $@ check-tools-macos: tools-macos ##@tools Test CLI tools for macOS export PYTHONPATH="$(shell pwd)/build/frida-macos-$(build_cpu_flavor)/lib/$(PYTHON_NAME)/site-packages" \ && cd frida-tools \ && $(PYTHON) -m unittest discover .PHONY: \ distclean clean clean-submodules git-submodules git-submodule-stamps \ gum-macos \ gum-macos-apple_silicon gum-macos-intel \ gum-ios \ gum-android-x86 gum-android-x86_64 \ gum-android-arm gum-android-arm64 \ check-gum-macos \ frida-gum-update-submodule-stamp \ core-macos \ core-macos-apple_silicon core-macos-intel \ core-ios \ core-android-x86 core-android-x86_64 \ core-android-arm core-android-arm64 \ check-core-macos \ frida-core-update-submodule-stamp \ gadget-macos \ gadget-ios \ deb-ios \ python-macos \ python-macos-universal python-macos-apple_silicon python-macos-intel \ check-python-macos \ check-python-macos-apple_silicon check-python-macos-intel \ frida-python-update-submodule-stamp \ node-macos \ check-node-macos \ frida-node-update-submodule-stamp \ tools-macos \ check-tools-macos \ frida-tools-update-submodule-stamp .SECONDARY: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,125 @@ #!/bin/sh if [ -z "$FRIDA_VERSION" ]; then echo "FRIDA_VERSION must be set" > /dev/stderr exit 2 fi if [ $# -ne 2 ]; then echo "Usage: $0 path/to/prefix output.deb" > /dev/stderr exit 3 fi prefix=$1 output_deb=$2 executable=$prefix/var/jb/usr/bin/frida-server if [ ! -f "$executable" ]; then echo "$executable: not found" > /dev/stderr exit 4 fi agent=$prefix/var/jb/usr/lib/frida/frida-agent.dylib if [ ! -f "$agent" ]; then echo "$agent: not found" > /dev/stderr exit 5 fi tmpdir="$(mktemp -d /tmp/package-server.XXXXXX)" mkdir -p "$tmpdir/var/jb/usr/sbin/" cp "$executable" "$tmpdir/var/jb/usr/sbin/frida-server" chmod 755 "$tmpdir/var/jb/usr/sbin/frida-server" mkdir -p "$tmpdir/var/jb/usr/lib/frida/" cp "$agent" "$tmpdir/var/jb/usr/lib/frida/frida-agent.dylib" chmod 755 "$tmpdir/var/jb/usr/lib/frida/frida-agent.dylib" mkdir -p "$tmpdir/var/jb/Library/LaunchDaemons/" cat >"$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" <<EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>re.frida.server</string> <key>Program</key> <string>/var/jb/usr/sbin/frida-server</string> <key>ProgramArguments</key> <array> <string>/var/jb/usr/sbin/frida-server</string> </array> <key>EnvironmentVariables</key> <dict> <key>_MSSafeMode</key> <string>1</string> </dict> <key>UserName</key> <string>root</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>ThrottleInterval</key> <integer>5</integer> <key>ExecuteAllowed</key> <true/> </dict> </plist> EOF chmod 644 "$tmpdir/var/jb/Library/LaunchDaemons/re.frida.server.plist" installed_size=$(du -sk "$tmpdir" | cut -f1) mkdir -p "$tmpdir/DEBIAN/" cat >"$tmpdir/DEBIAN/control" <<EOF Package: re.frida.server Name: Frida Version: $FRIDA_VERSION Priority: optional Size: 1337 Installed-Size: $installed_size Architecture: iphoneos-arm64 Description: Observe and reprogram running programs. Homepage: https://frida.re/ Maintainer: Ole André Vadla Ravnås <[email protected]> Author: Frida Developers <[email protected]> Section: Development Conflicts: re.frida.server64 EOF chmod 644 "$tmpdir/DEBIAN/control" cat >"$tmpdir/DEBIAN/extrainst_" <<EOF #!/bin/sh if [ "\$1" = upgrade ]; then /var/jb/bin/launchctl unload /var/jb/Library/LaunchDaemons/re.frida.server.plist fi if [ "\$1" = install ] || [ "\$1" = upgrade ]; then /var/jb/bin/launchctl load /var/jb/Library/LaunchDaemons/re.frida.server.plist fi exit 0 EOF chmod 755 "$tmpdir/DEBIAN/extrainst_" cat >"$tmpdir/DEBIAN/prerm" <<EOF #!/bin/sh if [ "\$1" = remove ] || [ "\$1" = purge ]; then /var/jb/bin/launchctl unload /var/jb/Library/LaunchDaemons/re.frida.server.plist fi exit 0 EOF chmod 755 "$tmpdir/DEBIAN/prerm" dpkg-deb --root-owner-group --build "$tmpdir" "$output_deb" package_size=$(expr $(du -sk "$output_deb" | cut -f1) \* 1024) sed \ -e "s,^Size: 1337$,Size: $package_size,g" \ "$tmpdir/DEBIAN/control" > "$tmpdir/DEBIAN/control_" mv "$tmpdir/DEBIAN/control_" "$tmpdir/DEBIAN/control" dpkg-deb --root-owner-group --build "$tmpdir" "$output_deb" rm -rf "$tmpdir" -
miticollo revised this gist
Dec 13, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Choose this method **ONLY** if you have a full jailbreak (R/W on `/`). export IOS_CERTID=frida-cert make core-ios export FRIDA_VERSION=$(releng/frida_version.py) ./frida-core/tools/package-server-ios.sh build/frida-ios-arm64/ build/"frida_${FRIDA_VERSION}_iphoneos-arm64.deb" ``` </div> -
miticollo revised this gist
Dec 13, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Choose this method **ONLY** if you have a full jailbreak (R/W on `/`). export IOS_CERTID=frida-cert make core-ios export FRIDA_VERSION=$(releng/frida_version.py) ./frida-core/tools/package-server-ios.sh build/frida-ios-arm64/ build/"frida_${FRIDA_VERSION}_iphoneos-arm64.deb" ``` 7. Look in `build/`. Enjoy! -
miticollo revised this gist
Nov 4, 2022 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,9 +21,10 @@ Choose this method **ONLY** if you have a full jailbreak (R/W on `/`). export MACOS_CERTID=frida-cert export IOS_CERTID=frida-cert make core-ios export FRIDA_VERSION=$(releng/frida_version.py) ./frida-core/tools/package-server-ios.sh build/frida-ios-universal build/"frida_${FRIDA_VERSION}_iphoneos-arm64.deb" ``` 7. Look in `build/`. Enjoy! ### Checkout on the Latest Stable Release 1. Run @@ -45,17 +46,18 @@ Choose this method **ONLY** if you have a full jailbreak (R/W on `/`). export MACOS_CERTID=frida-cert export IOS_CERTID=frida-cert make core-ios export FRIDA_VERSION=$(releng/frida_version.py) ./frida-core/tools/package-server-ios.sh build/frida-ios-universal build/"frida_${FRIDA_VERSION}_iphoneos-arm64.deb" ``` </div> </li> <li id="item3">Look in <code>build/</code>. Enjoy!</li> </ol> ### Clean 1. Run ```bash make distclean ``` 2. Go to <a href="#item2">step 2 of "Upgrade"</a>.
NewerOlder