windows: Fix w and logs

This commit is contained in:
Oleksii Shevchuk 2019-04-25 22:46:01 +03:00
parent a3f0f77a02
commit 1b372902e7
2 changed files with 5 additions and 3 deletions

View File

@ -99,6 +99,8 @@ class WModule(PupyModule):
if idle is not None and idle < 10 * 60:
color = 'cyan'
elif disconnect_time is None:
color = 'green'
elif disconnect_time > current_time:
color = 'lightgrey'
@ -149,7 +151,7 @@ class WModule(PupyModule):
self.log(Table(records, cols))
return
except Exception:
except Exception as e:
pass
try:

View File

@ -10,7 +10,7 @@ from winerror import HRESULT_CODE
from time import time
from pupwinutils.security import LookupAccountSidW as LookupAccountSid
from pupwinutils.security import namebysid
try:
from pupwinutils.security import StationNameByPid
except ImportError:
@ -286,7 +286,7 @@ class EventLog(object):
if ev_obj.Sid is not None:
try:
domain, domain_user, _ = LookupAccountSid(server, ev_obj.Sid)
domain, domain_user = namebysid(str(ev_obj.Sid))
user = u'{}\\{}'.format(domain, domain_user)
except error:
user = str(ev_obj.Sid)