Compare commits

..

94 Commits

Author SHA1 Message Date
Ole André Vadla Ravnås e929477ecd subprojects: Prepare for release 2024-05-21 12:50:37 +02:00
Ole André Vadla Ravnås ebeb7a86b1 subprojects: Bump outdated 2024-05-21 12:49:09 +02:00
Ole André Vadla Ravnås 458a1f055a subprojects: Prepare for release 2024-05-20 22:54:32 +02:00
Ole André Vadla Ravnås de0b1643de subprojects: Bump outdated 2024-05-20 22:53:43 +02:00
Ole André Vadla Ravnås 7c39166f77 subprojects: Prepare for release 2024-05-18 23:05:05 +02:00
Ole André Vadla Ravnås 56e92493f5 subprojects: Bump outdated 2024-05-18 22:58:12 +02:00
Ole André Vadla Ravnås efdbd80fc6 submodules: Bump releng 2024-05-18 22:58:12 +02:00
Ole André Vadla Ravnås acfa48ac4a subprojects: Prepare for release 2024-05-17 07:26:34 +02:00
Ole André Vadla Ravnås 799745783d subprojects: Bump outdated 2024-05-17 07:25:27 +02:00
Ole André Vadla Ravnås 9d21327ee6 subprojects: Bump outdated 2024-05-14 21:30:59 +02:00
Ole André Vadla Ravnås 5b4dca5ad3 submodules: Bump releng 2024-05-14 21:30:59 +02:00
Ole André Vadla Ravnås cdba01185d subprojects: Bump outdated 2024-05-14 06:47:41 +02:00
Ole André Vadla Ravnås 57de3f8f39 submodules: Bump releng 2024-05-14 06:47:41 +02:00
Ole André Vadla Ravnås a8d4972d1a subprojects: Bump outdated 2024-05-13 22:44:14 +02:00
Ole André Vadla Ravnås 0c8080dfb1 subprojects: Bump outdated 2024-05-13 15:16:24 +02:00
Ole André Vadla Ravnås 6d9765c16d subprojects: Bump outdated 2024-05-10 07:40:49 +02:00
Ole André Vadla Ravnås e3e77ee884 submodules: Bump releng 2024-05-10 07:40:49 +02:00
Ole André Vadla Ravnås ccafc2f828 Revert "setup: Do not declare _frida as a package"
It seems to be needed for package data to be included.

This reverts commit 25270d43dd.
2024-05-09 23:39:14 +02:00
Ole André Vadla Ravnås 6eeda89bba manifest: Include meson-scripts in sdist
As they're now also needed when running configure.
2024-05-09 23:37:35 +02:00
Ole André Vadla Ravnås c06b6774e3 setup: Fix the build output detection logic
Which was still using the old path from before _frida moved.
2024-05-09 23:34:42 +02:00
Ole André Vadla Ravnås 1086ae645d setup: Support passing version through the environment
By setting FRIDA_VERSION. But only when not in a source package.

This is needed so that our CI can use the same version across our repos,
for non-release builds. For release builds we tag each repo, which means
we don't have to worry about this.
2024-05-09 22:25:34 +02:00
Ole André Vadla Ravnås 25270d43dd setup: Do not declare _frida as a package
As it is implemented in native code.
2024-05-09 18:44:46 +02:00
Ole André Vadla Ravnås 6ebf0fa13f manifest: Remove redundant global-exclude 2024-05-09 18:41:01 +02:00
Ole André Vadla Ravnås 4f7b72c769 manifest: Update to match new layout 2024-05-09 18:14:57 +02:00
Ole André Vadla Ravnås f30febad99 subprojects: Bump outdated 2024-05-09 09:19:16 +02:00
Ole André Vadla Ravnås 088ff058ca subprojects: Bump outdated 2024-05-09 07:58:00 +02:00
Ole André Vadla Ravnås 4d8f87ccaa subprojects: Bump outdated 2024-05-09 00:27:26 +02:00
Ole André Vadla Ravnås 801088b107 submodules: Bump releng 2024-05-09 00:27:26 +02:00
Ole André Vadla Ravnås f17944358d subprojects: Bump outdated 2024-05-02 13:30:55 +02:00
Ole André Vadla Ravnås 290e5f7c42 submodules: Bump releng 2024-05-02 13:30:55 +02:00
Ole André Vadla Ravnås 5643f45b2d subprojects: Bump outdated 2024-05-01 14:29:55 +02:00
Ole André Vadla Ravnås 091dfa2dbb subprojects: Bump outdated 2024-05-01 08:03:00 +02:00
Ole André Vadla Ravnås 78d0c062c7 submodules: Bump releng 2024-05-01 08:03:00 +02:00
Ole André Vadla Ravnås 433b067a50 subprojects: Bump outdated 2024-04-30 21:58:05 +00:00
Ole André Vadla Ravnås 980249dfc3 submodules: Bump releng 2024-04-30 21:58:05 +00:00
Ole André Vadla Ravnås daaa2cf7b3 subprojects: Bump outdated 2024-04-30 12:42:14 +02:00
Ole André Vadla Ravnås 0853244c43 subprojects: Bump outdated 2024-04-30 12:35:52 +02:00
Ole André Vadla Ravnås 555eeee4d8 subprojects: Bump outdated 2024-04-30 11:47:50 +02:00
Ole André Vadla Ravnås 8d85017a49 subprojects: Bump outdated 2024-04-30 11:28:44 +02:00
Ole André Vadla Ravnås 2095592071 subprojects: Bump outdated 2024-04-29 13:01:01 +00:00
Ole André Vadla Ravnås 238286a6c3 subprojects: Bump outdated 2024-04-29 12:01:12 +00:00
Ole André Vadla Ravnås 16061c58b2 submodules: Bump releng 2024-04-29 12:01:12 +00:00
Ole André Vadla Ravnås 961dbd8ea3 subprojects: Bump outdated 2024-04-28 14:42:17 +02:00
Ole André Vadla Ravnås a80896b788 submodules: Bump releng 2024-04-28 14:42:17 +02:00
Ole André Vadla Ravnås 91e2e4ff54 subprojects: Bump outdated 2024-04-27 09:43:05 +02:00
Ole André Vadla Ravnås 341d0e0dd0 submodules: Bump releng 2024-04-27 09:43:05 +02:00
Ole André Vadla Ravnås 49e716f803 subprojects: Bump outdated 2024-04-27 09:35:51 +02:00
Ole André Vadla Ravnås cd19587f34 submodules: Bump releng 2024-04-27 09:35:51 +02:00
Ole André Vadla Ravnås 2ce32efaff subprojects: Bump outdated 2024-04-26 00:03:01 +02:00
Ole André Vadla Ravnås 8935f80619 submodules: Bump releng 2024-04-26 00:03:01 +02:00
Ole André Vadla Ravnås 938e784957 subprojects: Bump outdated 2024-04-25 16:32:14 +02:00
Ole André Vadla Ravnås 73228d61f4 subprojects: Bump outdated 2024-04-24 23:52:14 +02:00
Ole André Vadla Ravnås e2fd7aaf9f submodules: Bump releng 2024-04-24 23:52:14 +02:00
Ole André Vadla Ravnås 338ff6f55f subprojects: Bump outdated 2024-04-24 13:35:05 +02:00
Ole André Vadla Ravnås a78280ea6f submodules: Bump releng 2024-04-24 13:35:05 +02:00
Ole André Vadla Ravnås 56ec6a46e7 Fix stylistic inconsistencies 2024-04-24 13:18:01 +02:00
Ole André Vadla Ravnås 9706e4be99 Move _frida package inside the frida package
So we only have one top-level package, to avoid confusing IDEs.

Also add missing files to the Meson build system.
2024-04-24 12:41:52 +02:00
Ole André Vadla Ravnås 03206cfae4 setup: Refactor a little bit 2024-04-24 11:27:20 +02:00
Ole André Vadla Ravnås dfe260d7ac setup: Improve naming 2024-04-24 11:03:39 +02:00
Ole André Vadla Ravnås 1b34793f14 setup: Drop the executable bit
It lacks a shebang and shouldn't have been executable to begin with.
2024-04-24 00:06:20 +02:00
Ole André Vadla Ravnås 17043a998f setup: Look for releng in MESON_SOURCE_ROOT first
For consistency with the ordering elsewhere.
2024-04-23 23:46:32 +02:00
Ole André Vadla Ravnås 1f3ae462a6 setup: Improve detect_version()
- Look for releng locally first, and in MESON_SOURCE_ROOT if set.
- If releng cannot be found, return "0.0.0".
2024-04-23 23:15:02 +02:00
Ole André Vadla Ravnås 37588948eb setup: Fix version detection when subproject 2024-04-23 22:15:28 +02:00
Ole André Vadla Ravnås 61fbf134c5 setup: Add support for building from source
This means we can finally drop support for building from a devkit, which
was quite fragile and error-prone.
2024-04-23 16:02:23 +02:00
Ole André Vadla Ravnås 1d6f42e85f scripts: Fix the PKG-INFO code-path in version.py 2024-04-23 14:27:10 +02:00
Ole André Vadla Ravnås d42d945be5 meson: Specify Meson version required 2024-04-23 14:09:08 +02:00
Ole André Vadla Ravnås cda2280dfc meson: Compute version and pass it to frida-core 2024-04-23 14:08:09 +02:00
Ole André Vadla Ravnås 279313366b subprojects: Bump outdated 2024-04-23 11:57:36 +02:00
Ole André Vadla Ravnås 8cf13283ec submodules: Bump releng 2024-04-23 11:57:36 +02:00
Ole André Vadla Ravnås b33951be23 subprojects: Bump outdated 2024-04-23 11:29:21 +02:00
Ole André Vadla Ravnås 779dc7456c submodules: Bump releng 2024-04-23 11:29:21 +02:00
Ole André Vadla Ravnås bdece31ffa subprojects: Bump outdated 2024-04-22 16:09:33 +02:00
Ole André Vadla Ravnås 946d111ddd submodules: Bump releng 2024-04-22 16:09:33 +02:00
Ole André Vadla Ravnås a49088b8a0 submodules: Bump releng 2024-04-17 23:36:56 +02:00
Ole André Vadla Ravnås 241a2854c6 meson: Set project version to 0.0.0
To make it clear this project doesn't have its own release cycle.
2024-04-17 23:35:51 +02:00
Ole André Vadla Ravnås d976283ca1 submodules: Bump releng 2024-04-15 16:05:11 +02:00
Ole André Vadla Ravnås 197cc4262c submodules: Bump releng 2024-04-07 14:41:32 +02:00
Ole André Vadla Ravnås 4bf45994a1 submodules: Bump releng 2024-04-07 08:58:51 +02:00
Ole André Vadla Ravnås c193dd49cd git: Update gitignore 2024-03-22 11:46:12 +01:00
Ole André Vadla Ravnås 04e9308368 submodules: Bump releng 2024-03-21 23:26:12 +01:00
Ole André Vadla Ravnås d8da49058d tests: Move RPC tests to exports_sync
So they don't break once we make `exports` async.
2024-03-21 23:21:33 +01:00
Ole André Vadla Ravnås ae7c708934 submodules: Bump releng 2024-03-21 22:27:38 +01:00
Ole André Vadla Ravnås 8bf6a11aee msvs: Drop the MSVS build system
Maintaining it alongside our Meson build system is too much of a burden.
2024-03-21 21:56:45 +01:00
Ole André Vadla Ravnås 88330bfbb9 meson: Simplify the build system
- Make full use of Meson's Python module.
- Drop python_incdir option. It's now possible to use a .pc file to
  specify the include path.
- Drop config.h, as we only needed it for HAVE_MACOS, which we can
  easily check for in the single location that we need it.
2024-03-21 21:53:50 +01:00
Ole André Vadla Ravnås a053489965 submodules: Bump releng 2024-03-20 23:47:08 +01:00
Ole André Vadla Ravnås bd3e280cbf meson: Remove the python option
We can instead rely solely on Meson's Python module, as Meson supports
specifying the `python` binary to use.
2024-03-20 23:23:16 +01:00
Ole André Vadla Ravnås 7df15667cc submodules: Bump releng 2024-03-20 12:52:24 +01:00
Ole André Vadla Ravnås a3c889855a submodules: Bump releng 2024-03-20 10:40:45 +01:00
Ole André Vadla Ravnås 8e2126da9a submodules: Bump releng 2024-03-19 22:08:09 +01:00
Ole André Vadla Ravnås 8685505b3e meson: Improve Python installation detection 2024-03-14 15:53:36 +01:00
Ole André Vadla Ravnås ef1da26d94 meson: Rename options file to the new preferred name 2024-03-14 15:50:12 +01:00
Ole André Vadla Ravnås 59467c03c7 meson: Wire up test-suite 2024-03-14 15:42:49 +01:00
Ole André Vadla Ravnås ada39ecc55 meson: Add frida-core wrap file 2024-03-14 15:35:20 +01:00
Ole André Vadla Ravnås db97443e51 build: Add wrapper scripts to simplify building 2024-03-14 15:34:40 +01:00
26 changed files with 412 additions and 579 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
*.pyc
*.user
/*.egg-info/
/build/
/deps/
/dist/
/subprojects/*
+3
View File
@@ -0,0 +1,3 @@
[submodule "releng"]
path = releng
url = https://github.com/frida/releng.git
+6
View File
@@ -0,0 +1,6 @@
all: .DEFAULT
.DEFAULT:
@gmake ${.MAKEFLAGS} ${.TARGETS}
.PHONY: all
+19
View File
@@ -0,0 +1,19 @@
include meson.build
include frida/meson.build
include frida/_frida/extension.c
include frida/_frida/extension.version
include frida/_frida/meson.build
include subprojects/frida-core.wrap
include BSDmakefile
include Makefile
include configure
include configure.bat
include make.bat
include releng/*.py
include releng/*.toml
graft releng/devkit-assets/
graft releng/meson-scripts/
include releng/meson/meson.py
graft releng/meson/mesonbuild/
graft releng/tomlkit/tomlkit/
+16
View File
@@ -0,0 +1,16 @@
PYTHON ?= $(shell which python3 >/dev/null && echo python3 || echo python)
all $(MAKECMDGOALS):
@$(PYTHON) \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" \
"$(shell pwd)" \
./build \
$(MAKECMDGOALS)
git-submodules:
@if [ ! -f releng/meson/meson.py ]; then \
git submodule update --init --recursive --depth 1; \
fi
-include git-submodules
.PHONY: all $(MAKECMDGOALS)
-19
View File
@@ -1,19 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if OS is Android based. */
#mesondefine HAVE_ANDROID
/* Define to 1 if OS is Darwin based. */
#mesondefine HAVE_DARWIN
/* Define to 1 if OS is iOS. */
#mesondefine HAVE_IOS
/* Define to 1 if OS is Linux based. */
#mesondefine HAVE_LINUX
/* Define to 1 if OS is macOS. */
#mesondefine HAVE_MACOS
/* Define to 1 if OS is QNX based. */
#mesondefine HAVE_QNX
Vendored Executable
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
[ -z "$PYTHON" ] && PYTHON=$(which python3 >/dev/null && echo python3 || echo python)
cd $(dirname $0)
srcroot=$(pwd)
if [ ! -f releng/meson/meson.py ]; then
git submodule update --init --recursive --depth 1 || exit $?
fi
cd - >/dev/null
exec "$PYTHON" \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" \
"$srcroot" \
"$@"
+22
View File
@@ -0,0 +1,22 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_
:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof
:_start_
call :set_real_dp0
if not exist "%dp0%\releng\meson\meson.py" (
pushd "%dp0%" & git submodule update --init --recursive --depth 1 & popd
if %errorlevel% neq 0 exit /b %errorlevel%
)
endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" ^
"%dp0%" ^
%*
-176
View File
@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7505F884-DD69-4F23-ADE6-1E0E049AB018}</ProjectGuid>
<RootNamespace>frida</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>frida-python</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(SolutionDir)releng\frida-toolchain.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)releng\frida-$(Configuration).props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)releng\frida-$(Configuration).props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)releng\frida-$(Configuration).props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)releng\frida-$(Configuration).props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)build\frida-windows\$(PlatformName)-$(Configuration)\lib\python3.10\site-packages\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)build\frida-windows\$(PlatformName)-$(Configuration)\lib\python3.10\site-packages\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)build\frida-windows\$(PlatformName)-$(Configuration)\lib\python3.10\site-packages\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)build\frida-windows\$(PlatformName)-$(Configuration)\lib\python3.10\site-packages\</OutDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_frida</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_frida</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_frida</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">_frida</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.pyd</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.pyd</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.pyd</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.pyd</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(PythonLocation)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(IntDir)..\frida-core\api;$(PythonLocation)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(FridaComponentDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(PythonLocation)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(IntDir)..\frida-core\api;$(PythonLocation)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(FridaComponentDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(PythonLocation)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(IntDir)..\frida-core\api;$(PythonLocation)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(FridaComponentDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>$(PythonLocation)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(IntDir)..\frida-core\api;$(PythonLocation)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(FridaComponentDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\frida-core\frida-core.vcxproj">
<Project>{b7dc9b02-a5ff-4aa1-b2a2-dc1653168d44}</Project>
<Private>false</Private>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\_frida.c" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="frida\__init__.py">
<FileType>Document</FileType>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing frida package</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing frida package</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing frida package</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing frida package</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">rmdir /S /Q $(OutDir)frida 2&gt;NUL
mkdir $(OutDir)frida || exit 1
copy /B /Y "$(ProjectDir)frida\*.py" $(OutDir)frida || exit 1
echo. &gt; $(IntDir)frida-package.stamp</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)frida-package.stamp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)frida\core.py</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">rmdir /S /Q $(OutDir)frida 2&gt;NUL
mkdir $(OutDir)frida || exit 1
copy /B /Y "$(ProjectDir)frida\*.py" $(OutDir)frida || exit 1
echo. &gt; $(IntDir)frida-package.stamp</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)frida-package.stamp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)frida\core.py</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">rmdir /S /Q $(OutDir)frida 2&gt;NUL
mkdir $(OutDir)frida || exit 1
copy /B /Y "$(ProjectDir)frida\*.py" $(OutDir)frida || exit 1
echo. &gt; $(IntDir)frida-package.stamp</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)frida-package.stamp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)frida\core.py</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">rmdir /S /Q $(OutDir)frida 2&gt;NUL
mkdir $(OutDir)frida || exit 1
copy /B /Y "$(ProjectDir)frida\*.py" $(OutDir)frida || exit 1
echo. &gt; $(IntDir)frida-package.stamp</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)frida-package.stamp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)frida\core.py</AdditionalInputs>
</CustomBuild>
<None Include="frida\core.py" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\frida">
<UniqueIdentifier>{e8366f87-de40-4415-8724-a51c48fc532d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\_frida.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="frida\core.py">
<Filter>Source Files\frida</Filter>
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="frida\__init__.py">
<Filter>Source Files\frida</Filter>
</CustomBuild>
</ItemGroup>
</Project>
+1 -1
View File
@@ -1,7 +1,7 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
try:
import _frida
from . import _frida
except Exception as ex:
print("")
print("***")
@@ -23,6 +23,7 @@ class Object:
Add a signal handler.
"""
...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler.
@@ -36,18 +37,21 @@ class Application(Object):
Application identifier.
"""
...
@property
def name(self) -> str:
"""
Human-readable application name.
"""
...
@property
def parameters(self) -> Dict[str, Any]:
"""
Parameters.
"""
...
@property
def pid(self) -> int:
"""
@@ -61,6 +65,7 @@ class Bus(Object):
Attach to the bus.
"""
...
def post(self, message: str, data: Optional[Union[bytes, str]]) -> None:
"""
Post a JSON-encoded message to the bus.
@@ -73,47 +78,56 @@ class Cancellable(Object):
Set cancellable to cancelled.
"""
...
def connect(self, callback: Callable[..., Any]) -> int:
"""
Register notification callback.
"""
...
def disconnect(self, handler_id: int) -> None:
"""
Unregister notification callback.
"""
...
@classmethod
def get_current(cls) -> "Cancellable":
"""
Get the top cancellable from the stack.
"""
...
def get_fd(self) -> int:
"""
Get file descriptor for integrating with an event loop.
"""
...
def is_cancelled(self) -> bool:
"""
Query whether cancellable has been cancelled.
"""
...
def pop_current(self) -> None:
"""
Pop cancellable off the cancellable stack.
"""
...
def push_current(self) -> None:
"""
Push cancellable onto the cancellable stack.
"""
...
def raise_if_cancelled(self) -> None:
"""
Raise an exception if cancelled.
"""
...
def release_fd(self) -> None:
"""
Release a resource previously allocated by get_fd().
@@ -127,36 +141,42 @@ class Child(Object):
Argument vector.
"""
...
@property
def envp(self) -> Dict[str, str]:
"""
Environment vector.
"""
...
@property
def identifier(self) -> str:
"""
Application identifier.
"""
...
@property
def origin(self) -> str:
"""
Origin.
"""
...
@property
def parent_pid(self) -> int:
"""
Parent Process ID.
"""
...
@property
def path(self) -> str:
"""
Path of executable.
"""
...
@property
def pid(self) -> int:
"""
@@ -171,24 +191,28 @@ class Crash(Object):
Parameters.
"""
...
@property
def pid(self) -> int:
"""
Process ID.
"""
...
@property
def process_name(self) -> str:
"""
Process name.
"""
...
@property
def report(self) -> str:
"""
Human-readable crash report.
"""
...
@property
def summary(self) -> str:
"""
@@ -203,45 +227,53 @@ class Device(Object):
Device ID.
"""
...
@property
def name(self) -> Optional[str]:
"""
Human-readable device name.
"""
...
@property
def icon(self) -> Optional[Any]:
"""
Icon.
"""
...
@property
def type(self) -> Optional[str]:
"""
Device type. One of: local, remote, usb.
"""
...
@property
def bus(self) -> Optional[Bus]:
"""
Message bus.
"""
...
def attach(self, pid: int, realm: Optional[str] = None, persist_timeout: Optional[int] = None) -> "Session":
"""
Attach to a PID.
"""
...
def disable_spawn_gating(self) -> None:
"""
Disable spawn gating.
"""
...
def enable_spawn_gating(self) -> None:
"""
Enable spawn gating.
"""
...
def enumerate_applications(
self, identifiers: Optional[Sequence[str]] = None, scope: Optional[str] = None
) -> List[Application]:
@@ -249,71 +281,85 @@ class Device(Object):
Enumerate applications.
"""
...
def enumerate_pending_children(self) -> List[Child]:
"""
Enumerate pending children.
"""
...
def enumerate_pending_spawn(self) -> List["Spawn"]:
"""
Enumerate pending spawn.
"""
...
def enumerate_processes(self, pids: Optional[Sequence[int]] = None, scope: Optional[str] = None) -> List[Process]:
"""
Enumerate processes.
"""
...
def get_frontmost_application(self, scope: Optional[str] = None) -> Optional[Application]:
"""
Get details about the frontmost application.
"""
...
def inject_library_blob(self, pid: int, blob_buffer: bytes, entrypoint: str, data: str) -> int:
"""
Inject a library blob to a PID.
"""
...
def inject_library_file(self, pid: int, path: str, entrypoint: str, data: str) -> int:
"""
Inject a library file to a PID.
"""
...
def input(self, pid: int, data: bytes) -> None:
"""
Input data on stdin of a spawned process.
"""
...
def is_lost(self) -> bool:
"""
Query whether the device has been lost.
"""
...
def kill(self, pid: int) -> None:
"""
Kill a PID.
"""
...
def open_channel(self, address: str) -> "IOStream":
"""
Open a device-specific communication channel.
"""
...
def unpair(self) -> None:
"""
Unpair device.
"""
...
def query_system_parameters(self) -> Dict[str, Any]:
"""
Returns a dictionary of information about the host system.
"""
...
def resume(self, pid: int) -> None:
"""
Resume a process from the attachable state.
"""
...
def spawn(
self,
program: str,
@@ -342,21 +388,25 @@ class DeviceManager(Object):
Add a remote device.
"""
...
def close(self) -> None:
"""
Close the device manager.
"""
...
def enumerate_devices(self) -> List[Device]:
"""
Enumerate devices.
"""
...
def get_device_matching(self, predicate: Callable[[Device], bool], timeout: int) -> Device:
"""
Get device matching predicate.
"""
...
def remove_remote_device(self, address: str) -> None:
"""
Remove a remote device.
@@ -371,6 +421,7 @@ class FileMonitor(Object):
Disable the file monitor.
"""
...
def enable(self) -> None:
"""
Enable the file monitor.
@@ -383,26 +434,31 @@ class IOStream(Object):
Close the stream.
"""
...
def is_closed(self) -> bool:
"""
Query whether the stream is closed.
"""
...
def read(self, size: int) -> bytes:
"""
Read up to the specified number of bytes from the stream.
"""
...
def read_all(self, size: int) -> bytes:
"""
Read exactly the specified number of bytes from the stream.
"""
...
def write(self, data: bytes) -> int:
"""
Write as much as possible of the provided data to the stream.
"""
...
def write_all(self, data: bytes) -> None:
"""
Write all of the provided data to the stream.
@@ -423,46 +479,55 @@ class PortalService(Object):
Device for in-process control.
"""
...
def broadcast(self, message: str, data: Optional[Union[str, bytes]] = None) -> None:
"""
Broadcast a message to all control channels.
"""
...
def enumerate_tags(self, connection_id: int) -> List[str]:
"""
Enumerate tags of a specific connection.
"""
...
def kick(self, connection_id: int) -> None:
"""
Kick out a specific connection.
"""
...
def narrowcast(self, tag: str, message: str, data: Optional[Union[str, bytes]] = None) -> None:
"""
Post a message to control channels with a specific tag.
"""
...
def post(self, connection_id: int, message: str, data: Optional[Union[str, bytes]] = None) -> None:
"""
Post a message to a specific control channel.
"""
...
def start(self) -> None:
"""
Start listening for incoming connections.
"""
...
def stop(self) -> None:
"""
Stop listening for incoming connections, and kick any connected clients.
"""
...
def tag(self, connection_id: int, tag: str) -> None:
"""
Tag a specific control channel.
"""
...
def untag(self, connection_id: int, tag: str) -> None:
"""
Untag a specific control channel.
@@ -476,12 +541,14 @@ class Process(Object):
Process ID.
"""
...
@property
def name(self) -> str:
"""
Human-readable process name.
"""
...
@property
def parameters(self) -> Dict[str, Any]:
"""
@@ -497,18 +564,21 @@ class Relay(Object):
Network address or address:port of the TURN server.
"""
...
@property
def kind(self) -> str:
"""
Relay kind. One of: turn-udp, turn-tcp, turn-tls.
"""
...
@property
def password(self) -> str:
"""
The TURN password to use for the allocate request.
"""
...
@property
def username(self) -> str:
"""
@@ -522,31 +592,37 @@ class Script(Object):
Eternalize the script.
"""
...
def is_destroyed(self) -> bool:
"""
Query whether the script has been destroyed.
"""
...
def load(self) -> None:
"""
Load the script.
"""
...
def post(self, message: str, data: Optional[Union[str, bytes]] = None) -> None:
"""
Post a JSON-encoded message to the script.
"""
...
def unload(self) -> None:
"""
Unload the script.
"""
...
def enable_debugger(self, port: Optional[int]) -> None:
"""
Enable the Node.js compatible script debugger
"""
...
def disable_debugger(self) -> None:
"""
Disable the Node.js compatible script debugger
@@ -560,16 +636,19 @@ class Session(Object):
Process ID.
"""
...
def compile_script(self, source: str, name: Optional[str] = None, runtime: Optional[str] = None) -> bytes:
"""
Compile script source code to bytecode.
"""
...
def create_script(self, source: str, name: Optional[str] = None, runtime: Optional[str] = None) -> Script:
"""
Create a new script.
"""
...
def create_script_from_bytes(
self, data: bytes, name: Optional[str] = None, runtime: Optional[str] = None
) -> Script:
@@ -577,31 +656,37 @@ class Session(Object):
Create a new script from bytecode.
"""
...
def snapshot_script(self, embed_script: str, warmup_script: Optional[str], runtime: Optional[str] = None) -> bytes:
"""
Evaluate script and snapshot the resulting VM state
"""
...
def detach(self) -> None:
"""
Detach session from the process.
"""
...
def disable_child_gating(self) -> None:
"""
Disable child gating.
"""
...
def enable_child_gating(self) -> None:
"""
Enable child gating.
"""
...
def is_detached(self) -> bool:
"""
Query whether the session is detached.
"""
...
def join_portal(
self, address: str, certificate: Optional[str] = None, token: Optional[str] = None, acl: Optional[Any] = None
) -> PortalMembership:
@@ -609,11 +694,13 @@ class Session(Object):
Join a portal.
"""
...
def resume(self) -> None:
"""
Resume session after network error.
"""
...
def setup_peer_connection(
self, stun_server: Optional[str] = None, relays: Optional[Sequence[Relay]] = None
) -> None:
@@ -629,6 +716,7 @@ class Spawn(Object):
Application identifier.
"""
...
@property
def pid(self) -> int:
"""
@@ -648,6 +736,7 @@ class Compiler(Object):
Build an agent.
"""
...
def watch(
self,
entrypoint: str,
+5 -3
View File
@@ -16,7 +16,6 @@
# undef _POSIX_C_SOURCE
#endif
#define Py_LIMITED_API 0x03070000
#define PY_SSIZE_T_CLEAN
/*
@@ -39,8 +38,11 @@
#ifdef _MSC_VER
# pragma warning (pop)
#endif
#ifdef HAVE_MACOS
# include <crt_externs.h>
#ifdef __APPLE__
# include <TargetConditionals.h>
# if TARGET_OS_OSX
# include <crt_externs.h>
# endif
#endif
#define PyUnicode_FromUTF8String(str) PyUnicode_DecodeUTF8 (str, strlen (str), "strict")
+21
View File
@@ -0,0 +1,21 @@
py_sources = [
'__init__.pyi',
'py.typed',
]
python.install_sources(py_sources, subdir: 'frida' / '_frida', pure: false)
extra_link_args = []
if host_os_family == 'darwin'
extra_link_args += '-Wl,-exported_symbol,_PyInit__frida'
elif host_os_family != 'windows'
extra_link_args += '-Wl,--version-script,' + meson.current_source_dir() / 'extension.version'
endif
extension = python.extension_module('_frida', 'extension.c',
limited_api: '3.7',
c_args: frida_component_cflags,
link_args: extra_link_args,
dependencies: [python_dep, frida_core_dep, os_deps],
install: true,
subdir: 'frida',
)
+65 -125
View File
@@ -38,7 +38,7 @@ if sys.version_info >= (3, 11):
else:
from typing_extensions import NotRequired
import _frida
from . import _frida
_device_manager = None
@@ -334,16 +334,13 @@ class Script:
self._impl.disable_debugger()
@overload
def on(self, signal: Literal["destroyed"], callback: ScriptDestroyedCallback) -> None:
...
def on(self, signal: Literal["destroyed"], callback: ScriptDestroyedCallback) -> None: ...
@overload
def on(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None:
...
def on(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -356,16 +353,13 @@ class Script:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["destroyed"], callback: ScriptDestroyedCallback) -> None:
...
def off(self, signal: Literal["destroyed"], callback: ScriptDestroyedCallback) -> None: ...
@overload
def off(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None:
...
def off(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -691,12 +685,10 @@ class Session:
self,
signal: Literal["detached"],
callback: SessionDetachedCallback,
) -> None:
...
) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -710,12 +702,10 @@ class Session:
self,
signal: Literal["detached"],
callback: SessionDetachedCallback,
) -> None:
...
) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -755,16 +745,13 @@ class Bus:
self._impl.post(raw_message, **kwargs)
@overload
def on(self, signal: Literal["detached"], callback: BusDetachedCallback) -> None:
...
def on(self, signal: Literal["detached"], callback: BusDetachedCallback) -> None: ...
@overload
def on(self, signal: Literal["message"], callback: BusMessageCallback) -> None:
...
def on(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -777,16 +764,13 @@ class Bus:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["detached"], callback: BusDetachedCallback) -> None:
...
def off(self, signal: Literal["detached"], callback: BusDetachedCallback) -> None: ...
@overload
def off(self, signal: Literal["message"], callback: BusMessageCallback) -> None:
...
def off(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1052,40 +1036,31 @@ class Device:
return self.bus
@overload
def on(self, signal: Literal["spawn-added"], callback: DeviceSpawnAddedCallback) -> None:
...
def on(self, signal: Literal["spawn-added"], callback: DeviceSpawnAddedCallback) -> None: ...
@overload
def on(self, signal: Literal["spawn-removed"], callback: DeviceSpawnRemovedCallback) -> None:
...
def on(self, signal: Literal["spawn-removed"], callback: DeviceSpawnRemovedCallback) -> None: ...
@overload
def on(self, signal: Literal["child-added"], callback: DeviceChildAddedCallback) -> None:
...
def on(self, signal: Literal["child-added"], callback: DeviceChildAddedCallback) -> None: ...
@overload
def on(self, signal: Literal["child-removed"], callback: DeviceChildRemovedCallback) -> None:
...
def on(self, signal: Literal["child-removed"], callback: DeviceChildRemovedCallback) -> None: ...
@overload
def on(self, signal: Literal["process-crashed"], callback: DeviceProcessCrashedCallback) -> None:
...
def on(self, signal: Literal["process-crashed"], callback: DeviceProcessCrashedCallback) -> None: ...
@overload
def on(self, signal: Literal["output"], callback: DeviceOutputCallback) -> None:
...
def on(self, signal: Literal["output"], callback: DeviceOutputCallback) -> None: ...
@overload
def on(self, signal: Literal["uninjected"], callback: DeviceUninjectedCallback) -> None:
...
def on(self, signal: Literal["uninjected"], callback: DeviceUninjectedCallback) -> None: ...
@overload
def on(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None:
...
def on(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1095,40 +1070,31 @@ class Device:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["spawn-added"], callback: DeviceSpawnAddedCallback) -> None:
...
def off(self, signal: Literal["spawn-added"], callback: DeviceSpawnAddedCallback) -> None: ...
@overload
def off(self, signal: Literal["spawn-removed"], callback: DeviceSpawnRemovedCallback) -> None:
...
def off(self, signal: Literal["spawn-removed"], callback: DeviceSpawnRemovedCallback) -> None: ...
@overload
def off(self, signal: Literal["child-added"], callback: DeviceChildAddedCallback) -> None:
...
def off(self, signal: Literal["child-added"], callback: DeviceChildAddedCallback) -> None: ...
@overload
def off(self, signal: Literal["child-removed"], callback: DeviceChildRemovedCallback) -> None:
...
def off(self, signal: Literal["child-removed"], callback: DeviceChildRemovedCallback) -> None: ...
@overload
def off(self, signal: Literal["process-crashed"], callback: DeviceProcessCrashedCallback) -> None:
...
def off(self, signal: Literal["process-crashed"], callback: DeviceProcessCrashedCallback) -> None: ...
@overload
def off(self, signal: Literal["output"], callback: DeviceOutputCallback) -> None:
...
def off(self, signal: Literal["output"], callback: DeviceOutputCallback) -> None: ...
@overload
def off(self, signal: Literal["uninjected"], callback: DeviceUninjectedCallback) -> None:
...
def off(self, signal: Literal["uninjected"], callback: DeviceUninjectedCallback) -> None: ...
@overload
def off(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None:
...
def off(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1239,20 +1205,16 @@ class DeviceManager:
self._impl.remove_remote_device(address=address)
@overload
def on(self, signal: Literal["added"], callback: DeviceManagerAddedCallback) -> None:
...
def on(self, signal: Literal["added"], callback: DeviceManagerAddedCallback) -> None: ...
@overload
def on(self, signal: Literal["removed"], callback: DeviceManagerRemovedCallback) -> None:
...
def on(self, signal: Literal["removed"], callback: DeviceManagerRemovedCallback) -> None: ...
@overload
def on(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None:
...
def on(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1262,20 +1224,16 @@ class DeviceManager:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["added"], callback: DeviceManagerAddedCallback) -> None:
...
def off(self, signal: Literal["added"], callback: DeviceManagerAddedCallback) -> None: ...
@overload
def off(self, signal: Literal["removed"], callback: DeviceManagerRemovedCallback) -> None:
...
def off(self, signal: Literal["removed"], callback: DeviceManagerRemovedCallback) -> None: ...
@overload
def off(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None:
...
def off(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1417,46 +1375,38 @@ class PortalService:
self._impl.untag(connection_id, tag)
@overload
def on(self, signal: Literal["node-joined"], callback: PortalServiceNodeJoinedCallback) -> None:
...
def on(self, signal: Literal["node-joined"], callback: PortalServiceNodeJoinedCallback) -> None: ...
@overload
def on(self, signal: Literal["node-left"], callback: PortalServiceNodeLeftCallback) -> None:
...
def on(self, signal: Literal["node-left"], callback: PortalServiceNodeLeftCallback) -> None: ...
@overload
def on(self, signal: Literal["controller-connected"], callback: PortalServiceControllerConnectedCallback) -> None:
...
def on(
self, signal: Literal["controller-connected"], callback: PortalServiceControllerConnectedCallback
) -> None: ...
@overload
def on(
self, signal: Literal["controller-disconnected"], callback: PortalServiceControllerDisconnectedCallback
) -> None:
...
) -> None: ...
@overload
def on(self, signal: Literal["node-connected"], callback: PortalServiceNodeConnectedCallback) -> None:
...
def on(self, signal: Literal["node-connected"], callback: PortalServiceNodeConnectedCallback) -> None: ...
@overload
def on(self, signal: Literal["node-disconnected"], callback: PortalServiceNodeDisconnectedCallback) -> None:
...
def on(self, signal: Literal["node-disconnected"], callback: PortalServiceNodeDisconnectedCallback) -> None: ...
@overload
def on(self, signal: Literal["authenticated"], callback: PortalServiceAuthenticatedCallback) -> None:
...
def on(self, signal: Literal["authenticated"], callback: PortalServiceAuthenticatedCallback) -> None: ...
@overload
def on(self, signal: Literal["subscribe"], callback: PortalServiceSubscribeCallback) -> None:
...
def on(self, signal: Literal["subscribe"], callback: PortalServiceSubscribeCallback) -> None: ...
@overload
def on(self, signal: Literal["message"], callback: PortalServiceMessageCallback) -> None:
...
def on(self, signal: Literal["message"], callback: PortalServiceMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
@@ -1552,47 +1502,37 @@ class Compiler:
return self._impl.watch(entrypoint, **kwargs)
@overload
def on(self, signal: Literal["starting"], callback: CompilerStartingCallback) -> None:
...
def on(self, signal: Literal["starting"], callback: CompilerStartingCallback) -> None: ...
@overload
def on(self, signal: Literal["finished"], callback: CompilerFinishedCallback) -> None:
...
def on(self, signal: Literal["finished"], callback: CompilerFinishedCallback) -> None: ...
@overload
def on(self, signal: Literal["output"], callback: CompilerOutputCallback) -> None:
...
def on(self, signal: Literal["output"], callback: CompilerOutputCallback) -> None: ...
@overload
def on(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None:
...
def on(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None:
...
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["starting"], callback: CompilerStartingCallback) -> None:
...
def off(self, signal: Literal["starting"], callback: CompilerStartingCallback) -> None: ...
@overload
def off(self, signal: Literal["finished"], callback: CompilerFinishedCallback) -> None:
...
def off(self, signal: Literal["finished"], callback: CompilerFinishedCallback) -> None: ...
@overload
def off(self, signal: Literal["output"], callback: CompilerOutputCallback) -> None:
...
def off(self, signal: Literal["output"], callback: CompilerOutputCallback) -> None: ...
@overload
def off(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None:
...
def off(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None:
...
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
self._impl.off(signal, callback)
+5 -3
View File
@@ -1,6 +1,8 @@
frida_sources = [
subdir('_frida')
py_sources = [
'__init__.py',
'core.py',
'py.typed',
]
install_data(frida_sources, install_dir: join_paths(python_site_packages, 'frida'))
python.install_sources(py_sources, subdir: 'frida', pure: false)
+23
View File
@@ -0,0 +1,23 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_
:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof
:_start_
call :set_real_dp0
if not exist "%dp0%\releng\meson\meson.py" (
pushd "%dp0%" & git submodule update --init --recursive --depth 1 & popd
if %errorlevel% neq 0 exit /b %errorlevel%
)
endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" ^
"%dp0%" ^
.\build ^
%*
+19 -78
View File
@@ -1,11 +1,11 @@
project('frida-python', 'c', version: '1.0.0')
project('frida-python', 'c',
version: run_command(find_program('python3'), files('setup.py'), '-V',
capture: true,
check: true).stdout().strip(),
meson_version: '>=1.3.0',
)
host_os = host_machine.system()
if host_os == 'android'
host_os_family = 'linux'
else
host_os_family = host_os
endif
python = import('python').find_installation()
cc = meson.get_compiler('c')
@@ -19,81 +19,22 @@ if ndebug == 'true' or (ndebug == 'if-release' and not get_option('debug'))
]
endif
target_conditionals_prefix = '#include <TargetConditionals.h>'
python_dep = python.dependency()
frida_core_dep = dependency('frida-core-1.0', default_options: [
'frida_version=' + meson.project_version().replace('.dev', '-dev.'),
])
is_macos_src = target_conditionals_prefix + '''
#if !TARGET_OS_OSX
# error Not macOS
#endif
'''
if cc.compiles(is_macos_src, name: 'compiling for macOS')
host_os = 'macos'
endif
is_ios_src = target_conditionals_prefix + '''
#if !TARGET_OS_IOS
# error Not iOS
#endif
'''
if cc.compiles(is_ios_src, name: 'compiling for iOS')
host_os = 'ios'
endif
if cc.has_header('android/api-level.h')
host_os = 'android'
endif
python_incdir = get_option('python_incdir')
if python_incdir == ''
python = get_option('python')
if python == ''
python = find_program('python3', required: false)
if not python.found()
python = find_program('python')
endif
endif
result = run_command(python, '-c',
'import sys; sys.stdout.write(f"{sys.version_info[0]}.{sys.version_info[1]}")',
check: true)
python_version = result.stdout()
python_name = 'python' + python_version
result = run_command(python, '-c',
'from distutils import sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())',
check: true)
python_incdir = result.stdout()
else
py_major_v = cc.get_define('PY_MAJOR_VERSION',
prefix: '#include <patchlevel.h>',
args: ['-I' + python_incdir])
py_minor_v = cc.get_define('PY_MINOR_VERSION',
prefix: '#include <patchlevel.h>',
args: ['-I' + python_incdir])
python_version = py_major_v + '.' + py_minor_v
python_name = 'python' + python_version
endif
python_site_packages = join_paths(get_option('libdir'), python_name, 'site-packages')
cdata = configuration_data()
cdata.set('HAVE_' + host_os_family.to_upper(), 1)
if host_os != host_os_family
cdata.set('HAVE_' + host_os.to_upper(), 1)
endif
frida_core_dep = dependency('frida-core-1.0')
os_deps = []
host_os_family = host_machine.system()
if host_os_family != 'windows'
os_deps += dependency('gio-unix-2.0')
endif
configure_file(input: 'config.h.in',
output: 'config.h',
configuration: cdata)
subdir('src')
subdir('frida')
test('frida-python', python,
args: ['-m', 'unittest', 'discover'],
workdir: meson.current_source_dir(),
env: {'PYTHONPATH': meson.current_build_dir() / 'src'},
timeout: 30,
)
-11
View File
@@ -1,11 +0,0 @@
option('python',
type: 'string',
value: '',
description: 'Python interpreter to build for'
)
option('python_incdir',
type: 'string',
value: '',
description: 'Python headers directory to build against'
)
Submodule
+1
Submodule releng added at 6bad5eec71
Executable → Regular
+80 -102
View File
@@ -1,109 +1,25 @@
import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Iterator
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
package_dir = os.path.dirname(os.path.realpath(__file__))
pkg_info = os.path.join(package_dir, "PKG-INFO")
in_source_package = os.path.isfile(pkg_info)
if in_source_package:
with open(pkg_info, "r", encoding="utf-8") as f:
version_line = [line for line in f if line.startswith("Version: ")][0].strip()
frida_version = version_line[9:]
else:
frida_version = os.environ.get("FRIDA_VERSION", "0.0.0")
with open(os.path.join(package_dir, "README.md"), "r", encoding="utf-8") as f:
long_description = f.read()
frida_extension = os.environ.get("FRIDA_EXTENSION", None)
SOURCE_ROOT = Path(__file__).resolve().parent
FRIDA_EXTENSION = os.environ.get("FRIDA_EXTENSION", None)
class FridaPrebuiltExt(build_ext):
def build_extension(self, ext):
target = self.get_ext_fullpath(ext.name)
target_dir = os.path.dirname(target)
os.makedirs(target_dir, exist_ok=True)
shutil.copyfile(frida_extension, target)
class FridaMissingDevkitBuildExt(build_ext):
def build_extension(self, ext):
raise RuntimeError(
"Need frida-core devkit to build from source.\n"
"Download one from https://github.com/frida/frida/releases, "
"extract it to a directory,\n"
"and then add an environment variable named FRIDA_CORE_DEVKIT "
"pointing at the directory."
)
include_dirs = []
library_dirs = []
libraries = []
extra_link_args = []
cmdclass = {}
if frida_extension is not None:
cmdclass["build_ext"] = FridaPrebuiltExt
else:
devkit_dir = os.environ.get("FRIDA_CORE_DEVKIT", None)
if devkit_dir is not None:
include_dirs += [devkit_dir]
library_dirs += [devkit_dir]
libraries += ["frida-core"]
system = platform.system()
if system == "Windows":
pass
elif system == "Darwin":
extra_link_args += [
"-Wl,-exported_symbol,_PyInit__frida",
"-Wl,-dead_strip",
]
if "_PYTHON_HOST_PLATFORM" not in os.environ:
if platform.machine() == "arm64":
host_arch = "arm64"
macos_req = "11.0"
else:
host_arch = "x86_64"
macos_req = "10.9"
os.environ["_PYTHON_HOST_PLATFORM"] = f"macosx-{macos_req}-{host_arch}"
os.environ["ARCHFLAGS"] = f"-arch {host_arch}"
os.environ["MACOSX_DEPLOYMENT_TARGET"] = macos_req
else:
version_script = os.path.join(package_dir, "src", "_frida.version")
if not os.path.exists(version_script):
with open(version_script, "w", encoding="utf-8") as f:
f.write(
"\n".join(
[
"{",
" global:",
" PyInit__frida;",
"",
" local:",
" *;",
"};",
]
)
)
extra_link_args += [
f"-Wl,--version-script,{version_script}",
"-Wl,--gc-sections",
]
else:
cmdclass["build_ext"] = FridaMissingDevkitBuildExt
if __name__ == "__main__":
def main():
setup(
name="frida",
version=frida_version,
version=detect_version(),
description="Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers",
long_description=long_description,
long_description=compute_long_description(),
long_description_content_type="text/markdown",
author="Frida Developers",
author_email="oleavr@frida.re",
@@ -134,19 +50,81 @@ if __name__ == "__main__":
"Topic :: Software Development :: Debuggers",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=["frida", "_frida"],
package_data={"frida": ["py.typed"], "_frida": ["py.typed", "__init__.pyi"]},
packages=["frida", "frida._frida"],
package_data={"frida": ["py.typed"], "frida._frida": ["py.typed", "__init__.pyi"]},
ext_modules=[
Extension(
name="_frida",
sources=["src/_frida.c"],
include_dirs=include_dirs,
library_dirs=library_dirs,
libraries=libraries,
extra_link_args=extra_link_args,
name="frida._frida",
sources=["frida/_frida/extension.c"],
py_limited_api=True,
)
],
cmdclass=cmdclass,
cmdclass={"build_ext": FridaPrebuiltExt if FRIDA_EXTENSION is not None else FridaDemandBuiltExt},
zip_safe=False,
)
def detect_version() -> str:
pkg_info = SOURCE_ROOT / "PKG-INFO"
in_source_package = pkg_info.exists()
if in_source_package:
version_line = [
line for line in pkg_info.read_text(encoding="utf-8").split("\n") if line.startswith("Version: ")
][0].strip()
return version_line[9:]
version = os.environ.get("FRIDA_VERSION")
if version is not None:
return version
releng_location = next(enumerate_releng_locations(), None)
if releng_location is not None:
sys.path.insert(0, str(releng_location.parent))
from releng.frida_version import detect
return detect(SOURCE_ROOT).name.replace("-dev.", ".dev")
return "0.0.0"
def compute_long_description() -> str:
return (SOURCE_ROOT / "README.md").read_text(encoding="utf-8")
def enumerate_releng_locations() -> Iterator[Path]:
val = os.environ.get("MESON_SOURCE_ROOT")
if val is not None:
parent_releng = Path(val) / "releng"
if releng_location_exists(parent_releng):
yield parent_releng
local_releng = SOURCE_ROOT / "releng"
if releng_location_exists(local_releng):
yield local_releng
def releng_location_exists(location: Path) -> bool:
return (location / "frida_version.py").exists()
class FridaPrebuiltExt(build_ext):
def build_extension(self, ext):
target = self.get_ext_fullpath(ext.name)
Path(target).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(FRIDA_EXTENSION, target)
class FridaDemandBuiltExt(build_ext):
def build_extension(self, ext):
make = SOURCE_ROOT / "make.bat" if platform.system() == "Windows" else "make"
subprocess.run([make], check=True)
outputs = [entry for entry in (SOURCE_ROOT / "build" / "frida" / "_frida").glob("_frida.*") if entry.is_file()]
assert len(outputs) == 1
target = self.get_ext_fullpath(ext.name)
Path(target).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(outputs[0], target)
if __name__ == "__main__":
main()
-17
View File
@@ -1,17 +0,0 @@
extra_link_args = []
if host_os_family == 'darwin'
extra_link_args += ['-Wl,-exported_symbol,_PyInit__frida']
elif host_os_family != 'windows'
extra_link_args += ['-Wl,--version-script,' + join_paths(meson.current_source_dir(), '_frida.version')]
endif
extension = shared_module('_frida', '_frida.c',
name_prefix: '',
name_suffix: 'so',
c_args: frida_component_cflags,
include_directories: include_directories(python_incdir),
link_args: extra_link_args,
dependencies: [frida_core_dep] + os_deps,
install: true,
install_dir: python_site_packages,
)
+8
View File
@@ -0,0 +1,8 @@
[wrap-git]
url = https://github.com/frida/frida-core.git
revision = 16.2.5
depth = 1
[provide]
dependency_names = frida-core-1.0
+9 -8
View File
@@ -48,10 +48,11 @@ rpc.exports = {
""",
)
script.load()
self.assertEqual(script.exports.add(2, 3), 5)
self.assertEqual(script.exports.sub(5, 3), 2)
self.assertRaises(Exception, lambda: script.exports.add(1, -2))
self.assertListEqual([x for x in iter(script.exports.speak())], [0x59, 0x6F])
agent = script.exports_sync
self.assertEqual(agent.add(2, 3), 5)
self.assertEqual(agent.sub(5, 3), 2)
self.assertRaises(Exception, lambda: agent.add(1, -2))
self.assertListEqual([x for x in iter(agent.speak())], [0x59, 0x6F])
def test_post_failure(self):
script = self.session.create_script(
@@ -64,7 +65,7 @@ rpc.exports = {
""",
)
script.load()
agent = script.exports
agent = script.exports_sync
self.session.detach()
self.assertRaisesScriptDestroyed(lambda: agent.init())
@@ -82,7 +83,7 @@ rpc.exports = {
""",
)
script.load()
agent = script.exports
agent = script.exports_sync
def unload_script_after_100ms():
time.sleep(0.1)
@@ -104,7 +105,7 @@ rpc.exports = {
""",
)
script.load()
agent = script.exports
agent = script.exports_sync
def terminate_target_after_100ms():
time.sleep(0.1)
@@ -126,7 +127,7 @@ rpc.exports = {
""",
)
script.load()
agent = script.exports
agent = script.exports_sync
def cancel_after_100ms():
time.sleep(0.1)