LogParser 설치
아래 링크에서 다운로드가 가능하다.
www.microsoft.com/en-us/download/details.aspx?id=24659
다운로드가 된 위치를 확인한다. .exe파일을 실행시키는 것이 아닌 cmd를 사용하여 실행시킬 것이다.
폴더 위치 : C:\Program Files (x86)\Log Parser 2.2
Logparser 활용
logparser “select 필드명
from 대상로그파일
to 파싱파일(d\logout\1.csv
where 조건(문자열, 날짜 -> ’ ‘, 숫자 ->그냥)” -I : w3c -o:csv
-i: à입력되는 파일의 유형
-o: à결과물은 어떤 파일로 추출할 것인지
+ '(세미콜론)을 찾고 싶을 경우는 '%\'%' 로 입력하면 된다.
>> logparser “select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\*.* to D:\class\ASP\out2.csv where sc-status=200“ -i:w3c -o:csv
-i:w3c -> 포맷파일명 -o:csv -> 엑셀파일명
아래와 같이 파일이 저장된다.
Logparser 활용 1) 응답코드 500 분석 è logparser "select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\ ex050101.log to D:\class\ASP\outt1.csv where sc-status=500" -i:w3c -o:csv
2) 페이지 분석(bwrite.asp?Code=board&Key=product) è logparser "select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\ex050101.log to D:\class\ASP\outt2.csv where cs-uri-stem like '%bwrite.asp%'" -i:w3c -o:csv
3) 파라미터 분석(파라미터 중 key 패턴을 추출 ) bwrite.asp?Code=board&Key=product è logparser "select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\ex050101.log to D:\class\ASP\outt3.csv where cs-uri-query like '%key%'" -i:w3c -o:csv
sql like문 select * from member where name like ‘%김%’
4) 내용에 ‘이 포함된 로그를 찾아서 분석하고 싶은 경우. where cs-uri-query like ‘%\’%’ è logparser "select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\ex050101.log to D:\class\ASP\out4.csv where cs-uri-query like '%\'%'" -i:w3c -o:csv
- - - - - 1) IIS포맷(W3C)에서 공격이 자주 삽입되는 위치는 어디인가? 2) 로그 분석 실습파일(ex051028.log) 내용 중 “turkish.htm” 은 W3C에서는 어떤 필드를 의미하나? 3) turkish.htm이 포함된 로그를 찾아 분석하여, 공격 시작점을 찾아 보시오.
è logparser "select date, time, cs-method, cs-uri-stem, cs-uri-query, sc-status from C:\inetpub\logs\LogFiles\W3SVC1\ex051028.log to D:\class\ASP\outtt.csv where cs-uri like '%turkish.htm%'" -i:w3c -o:csv |