BUGFIX: Take the latest info_collection got from machine instead of oldest

This commit is contained in:
Oran Nadler 2018-04-17 13:30:55 +03:00
parent 2c68cca5db
commit 13bf7107c9
1 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ class Machine(object):
def __init__(self, monkey_guid): def __init__(self, monkey_guid):
self.monkey_guid = str(monkey_guid) self.monkey_guid = str(monkey_guid)
self.latest_system_info = mongo.db.telemetry.find({"telem_type":"system_info_collection", "monkey_guid": self.monkey_guid}).sort([("timestamp", 1)]).limit(1) self.latest_system_info = mongo.db.telemetry.find({"telem_type":"system_info_collection", "monkey_guid": self.monkey_guid}).sort([("timestamp", -1)]).limit(1)
if self.latest_system_info.count() > 0: if self.latest_system_info.count() > 0:
self.latest_system_info = self.latest_system_info[0] self.latest_system_info = self.latest_system_info[0]
@ -282,7 +282,7 @@ class Machine(object):
doc = self.latest_system_info doc = self.latest_system_info
users = dict() users = dict()
for group_user in doc["data"]["Win32_GroupUser"]: for group_user in doc["data"]["Win32_GroupUser"]:
if eval(group_user["GroupComponent"]["SID"]) != sid: if eval(group_user["GroupComponent"]["SID"]) != sid:
continue continue