본문 바로가기

Software

WMIC 명령어를 활용한 시스템 분석 - 여러가지 명령어들

1 WMIC 명령어

1.1 os

관련 정보 출력 (간략하게)

wmic os list brief /format:list  

정보를 html 형식으로 출력해서 확인한다

wmic /output:osinfo.html os get /format:hform  

시스템을 종료하거나 리부팅한다

wmic os where "status='ok'" call shutdown
wmic os where "status='ok'" call reboot

OS의 속성을 확인할 수 있다 (컬럼)

wmic os get /?

1.2 cpu

관련 정보 출력 (간략하게)

wmic cpu list brief /format:list

1.3 logicaldist

관련 정보를 확인한다

wmic logicaldisk where drivetype=3 get name,size,freespace,systemname /format:list  

1.4 volume

볼륨 정보를 확인한다

wmic volume list brief /format:list 

1.5 logon

모든 로그온 세션의 목록을 확인한다

wmic logon list full /format:list | more

1.6 environment

환경설정 목록을 확인한다

wmic environment list full /format:list | more

1.7 desktop

데스크탑 화면 설정을 확인한다

wmic desktop list full /format:list | more 

1.8 service

관련 정보를 확인한다

wmic service list brief /format:list

관련 정보를 html table 형식으로 출력해서 확인한다

wmic /output:service.html service list brief /format:htable 

%ora% 구문이 들어가있는 이름의 서비스를 확인한다

wmic service where "name like '%ora%'" list brief

특정 서비스를 시작하거나 중지한다

wmic service where name="service_name" call startservice
wmic service where name="service_name" call stopservice

1.9 computersystem

정보를 html 형식으로 출력해서 확인한다

wmic /output:compsystem.html computersystem get /format:hform 

1.10 bios

컴퓨터 s/n 넘버 확인하기

wmic bios get serialnumber 

1.11 memorychip

메모리 확인하기

wmic memorychip get banklabel, capacity

1.12 path

프로세서 CPU 정보 확인하기

wmic path win32_processor get numberofcores, numberoflogicalprocessors, processorid

그래픽카드 GPU 확인하기

wmic path win32_VideoController get name 

1.13 process

processid가 7332인 프로세스의 정보를 간략하게 확인한다

wmic process where processid=7332 list brief /format:list

해당 프로세스를 종료한다

wmic process where processid=7836 delete

해당 프로세스를 디버깅한다

wmic process where processid=5256 call attachdebugger

해당 cmd 명령을 실행한다

wmic process call create "cmd.exe /c ipconfig" >> result.txt

iexplore.exe 를 종료한다

wmic process where name="iexplore.exe" call terminate

notepad.exe 의 우선순위를 64로 설정한다

wmic process where name="notepad.exe" call setpriority 64

1.14 csproduct

장비의 사양을 확인한다

wmic csproduct list brief /format:list

1.15 diskdrive

디스크 모델명을 확인한다

wmic diskdrive list brief /format:list

1.16 startup

시작프로그램 목록을 확인한다

wmic startup list brief

1.17 product

설치된 프로그램 리스트를 확인한다

wmic product get name 

설치된 프로그램을 삭제한다

wmic product where name="Adobe Reader 9" call uninstall

1.18 useraccount

이름에 ad가 포함된 계정을 확인한다

wmic useraccount where "name like '%ad%'" list full

관리자(administrator)의 이름을 edward로 바꾼다

wmic useraccount where name="administrator" call rename name="edward"

1.19 sysdriver

시스템 드라이버를 간략하게 확인한다

wmic sysdriver list brief /format:list

2 Batch 스크립트

다음은 OS, COMPUTERSYSTEM, SERVICE 관련 정보를 수집하는 스크립트이다. .bat 파일로 저장한 후 실행하시면 된다.

@echo off
if %1$==$ (
 rem use the localcomputername if nothing is specified
set computer=%computername%
) else (
rem use the computername passed as a parameter
set computer=%1
)
rem  Creating report for %computer%
set htmlfile=%computer%.html

rem redirect wmic output to NULL since we don't really need to see it
wmic OS get /format:hform   > "%htmlfile%"
wmic computersystem get /format:hform  >> "%htmlfile%"
wmic service where state="running" get caption,name,pathname,state,status,acceptpause,acceptstop,processid,systemname,startname  /format:htable >> "%htmlfile%"
wmic service where state="stopped" get caption,name,pathname,state,status,acceptpause,acceptstop,processid,systemname,startname  /format:htable >> "%htmlfile%"
wmic csproduct list brief /format:htable >> "%htmlfile%"
wmic cpu list brief /format:htable >>"%htmlfile%"
wmic diskdrive list brief /format:htable >>"%htmlfile%"
wmic logicaldisk list brief /format:htable >>"%htmlfile%"
wmic volume list brief /format:htable >>"%htmlfile%"
wmic NICCONFIG list brief /format:htable >>"%htmlfile%"