内网信息收集清单

"渗透测试的本质是信息收集"
"此篇文章用作介绍拿到Webshell之后的一些针对内网的操作,不包含对域控的信息收集,目的是将主机信息收集最大化,从而加大横向的力度"
内网信息描述当从Web端拿到webshell之后,对服务器主机的了解几乎是0,应从内往外一步步的收集服务器的相关信息,首先要对主机当前所处的网络环境进行判断,通常来说分为3种:

  • 我是谁 对机器角色的判断,是指判断已经控制的机器是 普通Web服务器、开发测试服务器、公共服务器、文件服务器、代理服务器、DNS服务器还是存储服务器等 。具体的判断是通过对机器内的 主机名、文件、网络连接等多种情况综合进行的
  • 这是哪 对目前机器所处网络环境的拓扑结构进行分析和判断,是指需要对所处内网进行全面的数据收集及分析整理,绘制出大概的内网整体拓扑结构图,以便后期进行进一步的内网渗透和准确定位内网具体目标,从而完成渗透测试
  • 我在哪 对目前机器所处位置区域的判断,是指判断机器处于网络拓扑中的哪个区域,是在 **DMZ区、办公网,还是核心区核心DB **等位置 。当然,这里的区域并不是绝对的,只是一个大概的环境,不同位置的网络环境不一样,区域的界限也不一定明显
存活主机检测方法一:
for /l %i in (1,1,255) do @ ping 172.16.80.%i -w 1 -n 1|find /i "ttl="
内网信息收集清单

文章插图
 
方法二:
【内网信息收集清单】@echo md C:windowsTemp1echo ok > C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 192.168.%%I.1 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 10.%%I.1.1 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 172.16.%%I.1 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 172.%%I.1.1 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping %%I.%%I.%%I.1 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 192.168.%%I.254 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 10.%%I.1.254 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 172.16.%%I.254 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping 172.%%I.254.254 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txtFOR /L %%I in (1,1,254) do ping %%I.%%I.%%I.254 -n 1 -w 10 | findstr "TTL">>C:WindowsTemp1gatway.txt方法三:
@echo offrem 内网存活段自动发现脚本 [Windows]setlocal enabledelayedexpansionfor /l %%i in (0,1,255) do (for /l %%k in (0,1,255) do (ping -w 1 -n 1 10.%%i.%%k.1 | findstr "TTL=" >nul || ping -w 1 -n 1 10.%%i.%%k.254 | findstr "TTL=" >nulif !errorlevel! equ 0 (echo 10.%%i.%%k.0/24 is alive ! >> alive.txt ) else (echo 10.%%i.%%k.0/24 May be sleeping ! )))for /l %%s in (16,1,31) do (for /l %%d in (0,1,255) do (ping -n 1 -w 1 172.%%s.%%d.1| findstr "TTL=" >nul || ping -w 1 -n 1 172.%%s.%%d.254 | findstr "TTL=" >nulif !errorlevel! equ 0 (echo 172.%%s.%%d.0/24 is alive ! >> alive.txt ) else (echo 172.%%s.%%d.0/24 May be sleeping ! )))for /l %%t in (0,1,255) do (ping -n 1 -w 1 192.168.%%t.1| findstr "TTL=" >nul || ping -n 1 -w 1 192.168.%%t.254 | findstr "TTL=" >nulif !errorlevel! equ 0 (echo 192.168.%%t.0/24 is alive ! >> alive.txt ) else (echo 192.168.%%t.0/24 May be sleeping ! ))方法四:powershell
$ip = "172.20.10."for ($i = 1; $i -lt 255; $i ++){# get each ip$cur = $ip + $i# ping once ping -n 1 $cur | Out-Nullif ($LASTEXITCODE -eq 0) { Write-Host "$cur online"} else { Write-Host "$cur dead" }}
内网信息收集清单

文章插图
 
开放端口检测1.PowerShell端口扫描器:针对单个IP的多个端口的扫描
1..1024 | % {echo ((new-object Net.Sockets.TcpClient).Connect("172.20.10.1",$_)) "Port $_ is open!"} 2>$null2.Test-Netconnection 针对某IP段中单个端口的扫描
foreach ($ip in 1..20) {Test-NetConnection -Port 80 -InformationLevel "Detailed" 172.20.10.$ip}Test-NetConnection命令是在 **4.0 **版本的PowerShell中才引入的 。
3.针对某IP段 & 多个端口的扫描器
1..20 | % { $a = $_; 1..1024 | % {echo ((new-object Net.Sockets.TcpClient).Connect("172.20.10.$a",$_)) "Port $_ is open!"} 2>$null}


推荐阅读