ipconfig /all查询网络配置信息
可查询代理信息,否处于域中
通过systeminfo可以查询OS名称,版本,系统安装时间,启动时间,补丁,域信息等
利用PowerShell命令,收集软件的版本信息: powershell “Get-WmiObject -class Win32_Product | Select-Object -Property name,version”
wmic service list brief
tasklist
wmic process list brief
wmic startup get command,caption
schtasks /query /fo LIST /v
本机用户列表
net user
net localgroup administrators
query user 查看用户及登录状态
查看本地计算机与所连接客户端之间的对话
systeminfo
除了systeminfo,还有 wmic qfe get Caption,Description,HotFixID,InstalledOn
net share
wmic share get name,path,status
route print
arp -a
Windows Server 2003及之前版本
命令:netsh firewall set opmode disable
Windows Server 2003之后版本
命令:netsh advfirewall set allprofiles state off
命令: netsh advfirewall show allprofiles
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=out program=“C:\nc.exe”
允许3389端口放行
命令:netsh advfirewall firewall add rule name=“Remote Desktop” protocol=TCP dir=in localport=3389 action=allow
命令: netsh advfirewall set currentprofile logging filename “C:\windows\temp\fw.log”
reg query “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings”
(1) 查看远程连接端口
REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber
0xd3d—3389
(2) 开启远程连接端口
在Windows Server 2003中开启3389端口
命令: wmic path win32_terminalservicesetting where (__CLASS !="") call setallowsconnections 1
在其它系统(server2012、win7)开启和关闭3389端口
开启命令: REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
关闭命令: REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 11111111 /f
任何版本的Windows xp低权限无法执行wmic,Windows 7以上版本的低权限用户允许访问wmic并执行相关操作
for /f "delims=" %%A in ('dir /s /b %WINDIR%\system32\*htable.xsl') do set "var=%%A"
wmic process get CSName,Description,ExecutablePath,ProcessId /format:"%var%" >> out.html
wmic service get Caption,Name,PathName,ServiceType,Started,StartMode,StartName /format:"%var%" >> out.html
wmic USERACCOUNT list full /format:"%var%" >> out.html
wmic group list full /format:"%var%" >> out.html
wmic nicconfig where IPEnabled='true' get Caption,DefaultIPGateway,Description,DHCPEnabled,DHCPServer,IPAddress,IPSubnet,MACAddress /format:"%var%" >> out.html
wmic volume get Label,DeviceID,DriveLetter,FileSystem,Capacity,FreeSpace /format:"%var%" >> out.html
wmic netuse list full /format:"%var%" >> out.html
wmic qfe get Caption,Description,HotFixID,InstalledOn /format:"%var%" >> out.html
wmic startup get Caption,Command,Location,User /format:"%var%" >> out.html
wmic PRODUCT get Description,InstallDate,InstallLocation,PackageCache,Vendor,Version /format:"%var%" >> out.html
wmic os get name,version,InstallDate,LastBootUpTime,LocalDateTime,Manufacturer,RegisteredUser,ServicePackMajorVersion,SystemDirectory /format:"%var%" >> out.html
wmic Timezone get DaylightName,Description,StandardName /format:"%var%" >> out.html
当内网中存在域时,本地普通用户只能查询本机相关信息,不能查询域内信息。本地管理员用户和域内用户可以查询域内信息。原理:域内所有查询都是通过域控制器实现的(基于LDAP协议),而这个查询需要权限认证,所以只有域内用户才有这个权限,当域用户执行命令时,会自动使用Kerberos协议进行认证,无须额外输入账号密码。
whoami
whoami /all
net user username /domain