# Frida

## Instalación y configuración

Instalación de Frida.

```shell
# Instalación de Frida sin entorno virtual de Python
pip3 install frida-tools

# Instalación de Frida en entorno virtual de Python
mkdir frida && cd frida
python -m venv venv-frida
source venv-frida/bin/activate
pip3 install frida-tools

# Instalar la versión del cliente Frida correspondiente a la del servidor Frida
pip3 install frida-tools
pip3 install frida==<version-frida-server>
```

Obtener versión de Frida instalado.

```shell
frida --version
```

### Android

1\) Descargar Frida-server según la arquitectura del dispositivo Android y versión de Frida instalada previamente.

* <https://github.com/frida/frida/releases>

```shell
# Obtener arquitectura del dispositivo Android
adb shell getprop ro.product.cpu.abi
```

2\) Descomprimir y renombrar Frida-server.

```shell
unxz <frida-server.xz>
mv <frida-server> frida-server
```

3\) Transferencia de Frida-server al dispositivo Android y asignación de privilegios.

```shell
adb push frida-server /data/local/tmp/
adb shell "su -c chmod 755 /data/local/tmp/frida-server"
```

4\) Ejecución de Frida-server.

```shell
adb devices -l

# Iniciar Frida-server para conexión desde el dispositivo vía USB
adb shell "su -c /data/local/tmp/frida-server &"
# Iniciar Frida-server para conexión remota
adb shell "su -c /data/local/tmp/frida-server -l <device-IP-address> &"
```

### iOS

#### Cydia (App Store de tercero)

1\) Agregar repositorio de Frida a Cydia (App Store de tercero).

* Cydia -> Fuentes -> Editar -> Añadir -> <https://build.frida.re> -> Añadir fuente

<figure><img src="/files/ZQgOnYaXwQfSskn9U9Fa" alt=""><figcaption></figcaption></figure>

2\) Instalar Frida en el dispositivo desde Cydia (App Store de tercero).

* Cydia -> Buscar -> Frida -> Instalar

<figure><img src="/files/io5Ud3oAKcv6H5mvjdtE" alt=""><figcaption></figcaption></figure>

#### Manual

1\) Conexión SSH al dispositivo.

```shell
ssh root@<device-ip-address>
```

2\) Descarga de Frida-server.

* <https://github.com/frida/frida/releases>

```shell
cd /tmp/
wget https://github.com/frida/frida/releases/download/<version>/frida_<version>_iphoneos-arm.deb
```

3\) Instalación de Frida-server.

```shell
dpkg -i frida_<version>_iphoneos-arm.deb
```

4\) Ejecución de Frida-server para conexión remota.

```shell
# Establecer dirección IP a Frida-server en dispositivo (listen)
frida-server -l <device-IP-address>
```

## Comprobación de ejecución correcta de Frida-server

```shell
# Conectarse a Frida-server desde el dispositivo vía USB
# y listar procesos en ejecución
frida-ps -U

# Conectarse remotamente a Frida-server y listar procesos en ejecución
frida-ps -H <device-IP-address>
```

## Comandos generales

```shell
# Listar dispositivos
frida-ls-devices

# Listar procesos en ejecución
frida-ps -U
frida-ps -H <device-IP-address>

# Listar aplicaciones en ejecución
frida-ps -Ua
frida-ps -H <device-IP-address> -a

# Listar aplicaciones instaladas
frida-ps -Uai
frida-ps -H <device-IP-address> -ai

# Iniciar un nuevo proceso / aplicación (spawning)
frida -U -f <app-package-name>
frida -H <device-IP-address> -f <app-package-name>

# Atachar a un proceso / aplicación (attaching)
frida -U <app-name>
frida -U -p <PID>
frida -U -F <app-package-name>
frida -H <device-IP-address> <app-name>
frida -H -p <PID>
frida -H <device-IP-address> -F <app-package-name>
```

* -U = conectarse a Frida-server desde el dispositivo vía USB.
* -H = conectarse remotamente a Frida-server.

## Frida CodeShare

* <https://codeshare.frida.re/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mobile.mrw0l05zyn.cl/herramientas-transversales/frida.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
