描述
Windows Management Instrumentation 命令行 (WMIC) 使用 Windows Management Instrumentation (WMI) 从命令行启用系统管理。
这篇文章解释了如何在 Linux 机器上安装wmic客户端。上述安装过程已在 Ubuntu 12.04 LTS 32 位主机上进行了测试。
Linux 的客户端不如 Windows 的客户端强大,因为它仅限于“选择”请求(即无法请求“进程列表摘要”之类的内容),但如果您不想启动 Windows,它将很有帮助虚拟机。
安装
先决条件
$ sudo aptitude install autoconf
汇编
$ cd /data/tools/
$ wget OpenVAS - Open Vulnerability Assessment Scanner
$ bzip2 -cd wmi-1.3.14.tar.bz2 | tar xf -
$ cd wmi-1.3.14/
$ sudo make
$ sudo cp Samba/source/bin/wmic /usr/local/bin/
用法
用法
用法:wmic -U user%password //主机“查询”
选项
-?, - 帮助
显示此帮助消息
-A, --authentication-file=文件
从文件中获取凭据
--delimiter=字符串
查询多个值时使用的分隔符,默认为 '|'
-d, --debuglevel=DEBUGLEVEL
设置调试级别
--debug-stderr
将调试输出发送到 STDERR
-i,--范围=范围
使用此 Netbios 范围
-k,--kerberos=字符串
使用 Kerberos
-l, --log-basename=LOGFILEBASE
日志/调试文件的基本名称
--泄漏报告
在退出时启用完整的talloc泄漏报告
--leak-report-full
在退出时启用talloc泄漏报告
-m, --maxprotocol=MAXPROTOCOL
设置最大协议级别
--命名空间=字符串
WMI 命名空间,默认为 root\cimv2
-N,--不通过
不要要求输入密码
-n, --netbiosname=NETBIOSNAME
主 netbios 名称
--选项=名称=值
从命令行设置 smb.conf 选项
-O, --socket-options=SOCKETOPTIONS
要使用的套接字选项
--密码=字符串
密码
-P,--机器通行证
使用存储的机器帐户密码(隐含 -k)
--realm=领域
设置领域名称
-R, --name-resolve=NAME-RESOLVE-ORDER
仅使用这些名称解析服务
--simple-bind-dn=字符串
用于简单绑定的 DN
-S, --signing=on|off|必需
设置客户端签名状态
-s, --configfile=配置文件
使用替代配置文件
- 用法
显示简要使用信息
--use-security-mechanisms=STRING
可用于此身份验证的身份验证机制的受限列表
-U, --user=[域\]用户名[%PASSWORD]
设置网络用户名
-V,--版本
印刷版
-W,--工作组=工作组
设置工作组名称
例子
注意:有关您可以请求的课程的完整列表,请参阅http://msdn.microsoft.com/en-us/library/aa394554(v=vs.85).aspx
获取系统信息
$ wmic -U unknown //192.168.1.12 "select * from Win32_ComputerSystem"
[WORKGROUP\unknown] 的密码:
类:Win32_ComputerSystem
AdminPasswordStatus|AutomaticResetBootOption|AutomaticResetCapability|BootOptionOnLimit|BootOptionOnWatchDog|BootROMSupported|
BootupState|Caption|ChassisBootupState|CreationClassName|CurrentTimeZone|DaylightInEffect|Description|Domain|DomainRole|
EnableDaylightSavingsTime|FrontPanelResetStatus|InfraredSupported|InitialLoadInfo|InstallDate|KeyboardPasswordStatus|LastLoadInfo|
制造商|型号|名称|名称格式|NetworkServerModeEnabled|NumberOfLogicalProcessors|NumberOfProcessors|OEMLogoBitmap|OEMStringArray|
PartOfDomain|PauseAfterReset|PowerManagementCapabilities|PowerManagementSupported|PowerOnPasswordStatus|PowerState|PowerSupplyState|
PrimaryOwnerContact|PrimaryOwnerName|ResetCapability|ResetCount|ResetLimit|Roles|Status|SupportContactDescription|SystemStartupDelay|
SystemStartupOptions|SystemStartupSetting|SystemType|ThermalState|TotalPhysicalMemory|UserName|WakeUpType|Workgroup
3|True|True|0|0|True|正常启动|UNKNOWN-7C76953|3|Win32_ComputerSystem|120|True|AT/AT COMPATIBLE|WORKGROUP|0|True|3|False|NULL|(null)|
3|(null)|innotek GmbH|VirtualBox|UNKNOWN-7C76953|(null)|True|1|1|NULL|(vboxVer_4.2.12,vboxRev_84980)|False|-1|NULL|False|3|0|3| (空)|
未知|1|-1|-1|(LM_Workstation,LM_Server,NT,Potential_Browser)|OK|NULL|30|("Microsoft Windows XP Professional" /noexecute=optin /fastdetect)|
0|基于 X86 的 PC|3|1073201152|UNKNOWN-7C76953\unknown|6|(null)
获取正在运行的进程列表
$ wmic -U unknown%oopsoops //192.168.1.12 "select caption, name, parentprocessid, processid from win32_process"
类:Win32_Process
标题|句柄|名称|父进程 ID|进程 ID
系统空闲进程|0|系统空闲进程|0|0
系统|4|系统|0|4
smss.exe|460|smss.exe|4|460
csrss.exe|924|csrss.exe|460|924
winlogon.exe|948|winlogon.exe|460|948
services.exe|992|services.exe|948|992
lsass.exe|1004|lsass.exe|948|1004
VBoxService.exe|1168|VBoxService.exe|992|1168
svchost.exe|1220|svchost.exe|992|1220
svchost.exe|1332|svchost.exe|992|1332
MsMpEng.exe|1576|MsMpEng.exe|992|1576
svchost.exe|1616|svchost.exe|992|1616
svchost.exe|1712|svchost.exe|992|1712
svchost.exe|1940|svchost.exe|992|1940
spoolsv.exe|244|spoolsv.exe|992|244
explorer.exe|916|explorer.exe|788|916
VBoxTray.exe|1288|VBoxTray.exe|916|1288
concentr.exe|1388|concentr.exe|916|1388
msseces.exe|1400|msseces.exe|916|1400
ctfmon.exe|1424|ctfmon.exe|916|1424
wfcrun32.exe|1472|wfcrun32.exe|1220|1472
svchost.exe|1812|svchost.exe|992|1812
dsNcService.exe|1908|dsNcService.exe|992|1908
jqs.exe|280|jqs.exe|992|280
TeamViewer_Service.exe|780|TeamViewer_Service.exe|992|780
alg.exe|3556|alg.exe|992|3556
wmiapsrv.exe|532|wmiapsrv.exe|992|532
wscntfy.exe|1640|wscntfy.exe|1616|1640
wmiprvse.exe|4000|wmiprvse.exe|1220|4000