From d206fa157c707ac5358876408a6520758be73130 Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Tue, 12 Jul 2016 11:22:20 -0500 Subject: [PATCH] Update slapd importer with local timezone Signed-off-by: Brandon Myers --- lib/slapd2mozdef.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/slapd2mozdef.py b/lib/slapd2mozdef.py index b85f8cf3..4d05401e 100755 --- a/lib/slapd2mozdef.py +++ b/lib/slapd2mozdef.py @@ -11,6 +11,7 @@ from time import sleep import requests import dateutil.parser import datetime +from dateutil.tz import tzlocal import json from requests_futures.sessions import FuturesSession @@ -190,7 +191,7 @@ def searchforBind(line,bindDetails): for bindConn in bindConnre.findall(line): if '{0}:{1}:{2}'.format(bindConn[0],bindConn[1],bindConn[2]) not in bindDetails.keys(): #a new bind transaction we've not seen with default values - bindDetails['{0}:{1}:{2}'.format(bindConn[0],bindConn[1],bindConn[2])]=dict(conn=bindConn[0],op=bindConn[1],dn=bindConn[2],errCode=None,result='unknown',ipAddress='0.0.0.0',eventtime=dateutil.parser.parse(line[:20],fuzzy=True).isoformat()) + bindDetails['{0}:{1}:{2}'.format(bindConn[0],bindConn[1],bindConn[2])]=dict(conn=bindConn[0],op=bindConn[1],dn=bindConn[2],errCode=None,result='unknown',ipAddress='0.0.0.0',eventtime=dateutil.parser.parse(line[:20],fuzzy=True,tzinfos=tzlocal).isoformat()) def searchforBindResult(line,bindDetails,linecache): '''match outstanding binds without results to any new RESULT lines'''