内网信息收集

The Redefine Team Lv2

渗透测试人员进人内网后,面对的是一片“黑暗森林”。所以,渗透测试人员首先需要对当前所处的网络环境进行判断。判断涉及如下三个方面。

我是谁 这是哪 我在哪

首先对机器角色进行判断,看当前服务器是普通web服务器、开发测试服务器、公共服务器、文件服务器、代理服务器、DNS服务器还是存储服务器等。具体的判断过程,是根据机器的主机名、文件、网络连接等情况综合完成的。

对当前机器所处网络环境的拓扑结构进行分析和判断,是指对所处内网进行全面的数据收集和分析整理,绘制出大致的内网整体拓扑结构图。

对当前机器所处区域的判断,是指判断机器处于网络拓扑中的哪个区域,是在DMZ、办公区还是核心区。当然,这里的区域不是绝对的,只是一个大概的环境。处于不同位置的网络,环境不一样,区域界限也不一定明显。

收集本机信息

本机信息包括操作系统、权限、内网IP地址段、杀毒软件、端口、服务、补丁更新频率、网络连接、共享、会话等。如果是域内主机,操作系统、应用软件、补丁、服务、杀毒软件一般都是批量安装的。

1.1、查询网络配置信息

ipconfig /all

1.2、查询操作系统和版本信息

查询操作系统和版本信息

systeminfo | findstr /B /C:”OS Name” /C:”OS Version”

查看系统体系结构

echo %PROCESSOR_ARCHITECTURE%

查看安装的软件及版本、路径等****

wmic product get name,version

1.3、查询本机服务信息

wmic service list brief

1.4、查询进程列表

执行如下命令,可以查看当前进程列表和进程用户,分析软件、邮件客户端、VPN和杀毒软件等进程。

tasklist

执行如下命令,查看进程信息

wmic process list brief

常见的杀毒软件的进程

进程 软件名称
360sd.exe 360杀毒
360tray.exe 360实时保护
ZhuDongFangYu.exe 360主动防御
KSafeTray.exe 金山卫士
SafeDogUpdateCenter.exe 服务器安全狗
McAfee McShield.exe McAfee
egui.exe NOD32
AVP.EXE 卡巴斯基
avguard.exe 小红伞
bdagent.exe BitDefender

1.5、查看启动程序信息

wmic startup get command,caption

1.6、查看计划任务

schtasks /query /fo LIST /v

1.7、查看主机开机时间

net statistics workstation

1.8、查询用户列表

net user

执行如下命令,获取本地管理员(通常包含域用户)信息。

net localgroup administrators

执行如下命令,查看当前在线用户

query user || qwinsta

1.9、列出或断开本地计算机与所连接的客户端之间的会话

net session

1.10、查询端口列表

netstat -ano

1.11、查看补丁列表

systeminfo

1.12、查询本机共享列表

net share

1.13、查询路由表及所有可用接口的APP缓存表

route print
arp -a

1.14、查询防火墙相关配置

( 1 ) 关闭防火墙
Windows Server 2003及之前的版本,命令如下

netsh firewall set opmode disable
Windows Server 2003之后的版本,命令如下

netsh advfirewall set allprofiles state off
( 2 ) 查看防火墙配置

netsh firewall show config
( 3 ) 修改防火墙配置
Windows Server 2003及之前的版本,允许指定程序全部连接,命令如下

netsh firewall add allowedprogram C:\nc.exe “allow nc” enable
Windows Server 2003之后的版本,情况如下
允许指定程序进入,命令如下

netsh advfirewall firewall add rule name=”pass nc” dir=in action=allow program=”C: \nc.exe”
允许指定程序退出,命令如下

netsh advfirewall firewall add rule name=”Allow nc” dir=out action=allow program=”C: \nc.exe”
允许3389端口放行,命令如下。

netsh advfirewall firewall add rule name=”Remote Desktop” protocol=TCP dir=in localport=3389 action=allow
( 4 ) 自定义防火墙日志的储存位置

netsh advfirewall set currentprofile logging filename “C:\windows\temp\fw.log

1.15、查看代理配置情况

reg query “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings”

1.16、查询并开启远程连接服务

( 1 ) 查看远程连接端口
在命令行环境中执行注册表查询语句,命令如下。连接的端口为0xd3d,转换后为3389。

REG QUERY “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp” /V PortNumber

( 2 ) 在Windows Server 2003中开启3389端口

wmic path win32_ terminalservicesetting where (__CLASS !=””) call setallowtsconnections

( 3 ) 在Windows Server 2008和Windows Server 2012中开启3389端口

wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where (__CLASS !=””) call setallowtsconnections

wmic /namespace:\root\cimv2\terminalservices path win32_tsgeneralsetting where (TerminalName=’RDP-Tcp’) call setuserauthenticationrequired 1

reg add “HKLM\SYSTEM\CURRENT\CONTROLSET\CONTROL\TERMINAL SERVER” /v fSingleSessionPerUser /t REG_ DWORD /d 0 /f

还可以用vmic命令[b]1格式化文件,特别是xsl格式,这个我没试过,大家有兴趣可以试试,[/b]

1
wmic /output:c:\process.html process list /format:htable.xsl

[b]2进程管理[/b]

1
#列出进程的核心信息,有点像任务管理器wmic process list brief#新建calc进程wmic process call create calc#列出进程的信息,这个命令可以借助管道就可以找到你想要的进程启动参数,如 | find "tomcat"wmic process get caption,handle,commandline,executablepath#结束进程 handle是文件句柄,接触过c++变成的比较了解wmic process [handle/PID] deletewmic process [handle/PID] call terminate

[b]3 bios管理[/b]

1
wmic bios get name,SMBIOSBIOSVersion,manufacturer

[b]4 系统管理[/b]

1
#查看硬件、操作系统基本信息wmic computersystem get Name,workgroup,NumberOfProcessors,manufacturer,Model#查看系统启动选项boot.ini的内容wmic computersystem get SystemStartupOptions#查看工作组/域wmic computersystem get domain#更改计算机名abc为123wmic computersystem where "name='nonobaba'" call rename skyhits#更改工作组google为MyGroupwmic computersystem where "name='wodsy'" call joindomainorworkgroup "","","MyGroup",1

[b]5 文件管理[/b]

1
#查找e盘下test目录(不包括子目录)下的cc.cmd文件wmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" list#查找e盘下所有目录和子目录下的cc.cmd文件,且文件大小大于1Kwmic datafile where "drive='e:' and FileName='cc' and Extension='cmd' and FileSize>'1000'" list#删除e盘下文件大小大于10M的.cmd文件wmic datafile where "drive='e:' and Extension='cmd' and FileSize>'10000000'" call delete#删除e盘下test目录(不包括子目录)下的非.cmd文件wmic datafile where "drive='e:' and Extension<>'cmd' and path='test'" call delete#复制e盘下test目录(不包括子目录)下的cc.cmd文件到e:\,并改名为aa.batwmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" call copy "e:\aa.bat"::改名c:\hello.txt为c:\test.txtwmic datafile "c:\\hello.txt" call rename c:\test.txt#查找h盘下目录含有test,文件名含有perl,后缀为txt的文件wmic datafile where "drive='h:' and extension='txt' and path like '%\\test\\%' and filename like '%perl%'" get name

[b]6系统管理[/b]

1
#获取temp环境变量wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue#更改path环境变量值,新增e:\toolswmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;e:\tools"#新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH%wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%"#删除home环境变量wmic ENVIRONMENT where "name='home'" delete
  • 标题: 内网信息收集
  • 作者: The Redefine Team
  • 创建于 : 2025-04-13 15:36:56
  • 更新于 : 2025-04-13 16:03:40
  • 链接: https://redefine.ohevan.com/2025/04/13/内网信息收集/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
内网信息收集