파이썬을 이용한 Webknight(웹 나이트) 이벤트 로그 파싱
- 차단 이벤트 추출 : OnPreprocHeaders ', ' OnUrlMap
- 각각의 필드를 이용하여 모니터링을 보다 강화할 수 있다.
ex) 특정 클라이어인트IP를 모니터링하고 싶다면 'client IP'를 필드에 조건을 걸어서 Email, SMS연동하여
모니터링이 가능하다
event = (' OnPreprocHeaders ',' OnUrlMap ')
def printLog():
print(' date : ' + line[0] + '\n',
'time : ' + line[1] + '\n',
'siteInstance : ' + line[2] + '\n',
'event : ' + line[3] + '\n',
'clientIP : ' + line[4] + '\n',
'username : ' + line[5] + '\n',
'hostheader : ' + line[6] + '\n')
with open(path, 'r') as f:
for x in f.readlines():
line = x.split(';')
if event[0] in line:
detail = ' '.join(line[7:])
if len(detail) > 200:
printLog()
print(' Text : '+'\n',
detail[:101]+'\n',
detail[101:201]+'\n',
'-'*100)
else:
printLog()
print(' Text : ' + '\n',
detail[:] + '\n',
'-' * 100)
----------------------------------------------------------------------------------------------------
date : 2018-05-10
time : 20:39:51
siteInstance : W3SVC10
event : OnPreprocHeaders
clientIP : x.x.x.x
username :
hostheader : www.xxxxx.co.kr
Text :
****** BLOCKED: '=' not allowed in filename HTTP/1.1 Mozilla/5.0 (Linux A
ndroid 6.0.1 SM-J510L Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Mob
'Open Source' 카테고리의 다른 글
freesshd를 이용한 windows 서버 ssh 접속 (0) | 2019.07.12 |
---|---|
[ OSS - webknight ] IIS 웹 방화벽 보안 - 1부(설치) (0) | 2019.06.24 |
[ OSS - WinSCP ] FTP 원격지 파일 동기화 2부 - 로깅 (0) | 2019.06.05 |
[ OSS - WinSCP ] 원격지 파일 동기화 1부 - 기본구성 (0) | 2019.06.02 |
winscp와 python을 이용한 FTP 다운로드 (0) | 2019.05.03 |
CentOS Zabbix Server 4.0 Install (자빅스 설치) (0) | 2019.04.01 |
webknight 웹 방화벽으로 IIS 웹 사이트 보안 - 3부(모니터링) (0) | 2018.07.01 |
webknight 웹 방화벽으로 IIS 웹 사이트 보안 - 2부(중앙로그서버 구축) (0) | 2018.04.25 |