# 【AD】【列舉】SharpHound

[https://github.com/puckiestyle/powershell/blob/master/SharpHound.ps1](https://github.com/puckiestyle/powershell/blob/master/SharpHound.ps1)

SharpHound 有幾種不同的格式可用。我們可以自己編譯它，使用已經編譯好的可執行文件，或者將其用作 PowerShell 腳本。在我們的情況下，我們將使用位於 CLIENT75 的 C:\\Tools 中的 PowerShell 腳本。首先，讓我們打開一個 PowerShell 窗口並將腳本載入內存：

```Powershell
PS C:\Tools> Import-Module .\Sharphound.ps1
```

SharpHound 已經載入，現在我們可以開始收集域數據。然而，為了運行 SharpHound，我們首先必須運行 Invoke-BloodHound。這並不直觀，因為在這個階段我們只運行 SharpHound。讓我們調用 Get-Help 來了解有關此命令的更多信息。

```Powershell
PS C:\Tools> Get-Help Invoke-BloodHound
```

[![image-1702299210888.png](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/scaled-1680-/L0hHWuUFIPzcsP8R-image-1702299210888.png)](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/L0hHWuUFIPzcsP8R-image-1702299210888.png)

我們將從 -CollectionMethod 開始，該參數描述了各種收集方法。在我們的情況下，我們將嘗試收集所有數據，這將執行除了本地組策略之外的所有收集方法。

默認情況下，SharpHound 將以 JSON 文件的形式收集數據並自動將其壓縮為 ZIP 文件。這使我們能夠輕鬆將文件傳輸到稍後的 Kali Linux。我們將保存這個輸出文件到桌面上，帶有如下的 "corp audit" 前綴：

  
Invoke-BloodHound -CollectionMethod All -OutputDirectory C:\\Users\\stephanie\\Desktop\\ -OutputPrefix "corp audit"

```Powershell
PS C:\Tools> Invoke-BloodHound -CollectionMethod All -OutputDirectory 
C:\Users\stephanie\Desktop\ -OutputPrefix "corp audit"

```

請注意，數據收集可能需要一些時間才能完成，這取決於我們正在列舉的環境的大小。讓我們檢查 SharpHound 的輸出：

[![image-1702299310706.png](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/scaled-1680-/rrvHdjTH77tIl94s-image-1702299310706.png)](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/rrvHdjTH77tIl94s-image-1702299310706.png)

根據清單 78 中的輸出，我們總共掃描了 106 個對象。這顯然會根據域中存在多少對象和會話而變化。

在這種情況下，SharpHound 實際上是從 stephanie 使用者那裡對域進行了一個快照，我們應該能夠分析使用者帳戶有權訪問的所有內容。收集的數據存儲在我們桌面上的 ZIP 文件中：

[![image-1702299351716.png](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/scaled-1680-/kfNIg4FNIZu3NLFQ-image-1702299351716.png)](https://bookstack.treemanou.com/uploads/images/gallery/2023-12/kfNIg4FNIZu3NLFQ-image-1702299351716.png)