> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/pentesuto/configure-a-pentest/setting-up-authenticated-testing/handling-files-for-authentication.md).

# スクリプト経由で認証する

これは **スクリプトによるログイン** フローです。認証に、エージェントが実行・署名・読み取りできるファイルが必要な場合に使用します。たとえば、ログインスクリプト、クライアント証明書、またはログインを進めるための参照ドキュメントなどです。

**次の場合にこの機能を使用してください：**

* あなたには **スクリプト** ログインを実行し、セッショントークン、Cookie、またはヘッダーを出力します。
* 次を介して認証します **クライアント証明書または署名付きリクエスト** (`.pem`, `.crt`, `.key`, `.p12`, `.pfx`, `.csr`, `.pub`).
* エージェントには **参照資料** 認証するための（`.pdf`, `.md`, `.txt`, `.csv`, `.json`, `.yaml`, `.yml`）- 例：KYC書類、GraphQLの信頼済みドキュメント、またはアカウント一覧。

{% hint style="info" %}
実行されるのは `.py` ファイルのみです **実行** （Python 3、サンドボックス環境内で）。その他のサポート対象ファイル形式はすべて参照入力としてエージェントに提供されます。エージェントはそれらを読み取り、あなたの指示に従うために使用します。
{% endhint %}

### セットアップガイド

{% stepper %}
{% step %}
**テストユーザーを追加**

評価ウィザードで、次をクリックします： **テストユーザーを追加** → **カスタム** → **スクリプトによるログイン**.

<figure><img src="/files/5af465c3968d0042d8430552f5173b7dcf5a61d2" alt="Add Test User menu - the Login via Script option lives under Custom"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**認証手順を記述**

Aikidoは **認証手順** フィールドに初期テンプレートをあらかじめ入力します：

編集して、エージェントにあなたのファイルで何をしてほしいかを正確に記述してください。 **成功条件** の行は曖昧にしないでください。ログイン後ページに表示される文字列や特定のステータスコードが適しており、エージェントが自己検証できます。
{% endstep %}

{% step %}
**ファイル、鍵、またはスクリプトをアップロード**

ファイルをアップロードボックスにドロップしてください。テストユーザーごとにファイルは1つのみ、最大 **2 MB**；拡張子は上記のリストに限定されます。

Pythonスクリプトをアップロードする場合、エージェントは必要に応じてそれを調整し、 `python3`.

<figure><img src="/files/f89abd4fc30ded62d38bcd64853ba719f6d0ab09" alt="Login via Script modal"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**保存してテスト**

クリック **保存してテスト**で実行します。プレフライトがエージェントを起動し、エージェントはあなたの指示に従って（スクリプトを実行するか、アップロードされたファイルを参照し）、ログイン後の状態に到達したことを確認します。プレフライトに合格すると、メインのペンテスト用にセッションがキャプチャされます。

<figure><img src="/files/726ecb94de086b9f6e89ac02a9b6f7c822bf8512" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### ヒントとベストプラクティス

* **スクリプトは自己完結させてください。** 可能な限り Python3 の標準ライブラリのみを使用してください。 `pip install` 実行時にインストールする手順はありません。
* **証明書の場合は、** 指示の中でファイル名とパスの規則に言及してください。例： *「アップロードした `client.p12` をパスフレーズ `<password>` で /api へのリクエストに署名する `/api`."*
* **パスキー** はまだサポートされていません。この機能が必要な場合は、把握できるようご連絡ください！


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/pentesuto/configure-a-pentest/setting-up-authenticated-testing/handling-files-for-authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
