發表文章

目前顯示的是有「powershell」標籤的文章

Active Directory 手動列舉之擴展

圖片
 Active Directory 手動列舉之擴展 列舉作業系統 環境說明 : 在 AD 相關的章節中,主要都是依據下列的 LAB 環境,IP 可能不同,但角色相同 攻擊機 192.168.45.248 靶機   - 192.168.203.70 DC  - 192.168.203.72 web04   - 192.168.203.73 files04  - 192.168.203.74 client74  - 192.168.203.75 client75  - 192.168.203.76 client76 已知一般使用者帳號密碼 stephanie / LegmanTeamBenzoin!! 網域名稱 corp.com 採用工具 PowerView,存放路徑 C:\Tools,匯入指令 Import-Module .\PowerView.ps1 kali 有內建位置在 /usr/share/windows-resources/powersploit/Recon/PowerView.ps1 第一步 RDP 進入到某一台 client,注意密碼因為有驚嘆號,所以要加上單引號 xfreerdp /u:stephanie /p:'LegmanTeamBenzoin!!' /d:corp.com /v:192.168.203.75 匯入 PowerView,記得要先  powershell -ep bypass 獲取網域電腦資訊 Get-NetComputer LAB 很新,DC 都已經是 Windows Server 2022 Standard 版本 之前有提過 Powershell 的輸出可以使用跟資料庫一樣的 select 語法 若要列舉作業系統跟主機名可以使用 Get-NetComputer | select operatingsystem,dnshostname 如下圖列出現有網域的所有電腦作業系統與主機名稱,符合一開始的 LAB 環境定義 練習 1 DistinguishedName for the WEB04 語法 Get-NetComputer | select operatingsystem,dn...

AD 枚舉 - PowerView PowerShell

圖片
 AD 枚舉 - PowerView PowerShell 靶機預設放了一堆工具 切記  powershell -ep bypass  執行後就可以匯入 PowerView 了 Import-Module .\PowerView.ps1 kali 有內建位置在 /usr/share/windows-resources/powersploit/Recon/PowerView.ps1 PowerView 工具完整介紹網站  https://powersploit.readthedocs.io/en/latest/Recon/ 接下來使用幾個好用的指令,第一個 Get-NetDomain 抓取現有網域簡單資訊 接著使用 Get-NetUser,條列出網域中所有使用者屬性 PowerView 中可以直接使用 select 來過濾條件,例如 Get-NetUser | select cn 顯示出網域中 common name 的值而已,過濾方式採用類似 SQL 的條件 因為過濾就像資料庫的條件,所以可以在 select 後面加上我們想要看到的欄位 例如使用者最後修改密碼的時間與最後登入的時間 語法 : Get-NetUser | select cn,pwdlastset,lastlogon 接著改列舉群組 Get-NetGroup | select cn 列舉特定群組中的成員 Get-NetGroup "Sales Department" | select member 練習 列舉使用者fred正在工作的 Office 以取得標誌 指令 Get-DomainUser -Identity fred