# 使用Objection测试

You can use the following toolkit to interact with the patched app:

{% embed url="<https://github.com/sensepost/objection>" %}

## Running

After the patched app has been launched, you need to connect to it using objection.

### Connect via USB

* Find out app's PID.

  ```bash
  $ frida-ps -Ua
  ```

  ```
  PID   Name                     Identifier
  ----  -----------------------  ---------------------------------
  1234  MyApp                    com.mycompany.myapp
  ...
  ```
* Start the objection exploration REPL.

  ```bash
  $ objection -g 1234 explore
  ```

### Connect via network

* Find in the console the moment of loading Frida, waiting for a connection.

![xcode-deploy-console-output](https://2241975275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7lonY2zgW7DNoIQMqYtw%2Fuploads%2Fgit-blob-8c84c593911062b529d33c5bfbeb69c043239e06%2Fxcode-deploy-console-output.png?alt=media)

* Start the objection exploration REPL.

  ```bash
  $ objection -N -h 127.0.0.1 -p 27042 explore
  ```

## Commands

A quick guide to the most used objection's commands.

### Environment

```bash
$ env
```

### Run OS command

```bash
$ !cat Info.plist 
```

### Download file

```bash
$ file download Info.plist
```

### Import Frida scripts

In order to import and **run** the Frida script use the following command:

```bash
$ import "/tmp/frida-script.js"
```


---

# 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://gitbook.cdxiaodong.life/ios-ying-yong-an-quan/ru-men-zhi-nan/objection.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.
