Пример #1
0
    def from_bytes(cls, data: bytes) -> DomainAccountF:
        """
        :param data:
        :return:
        """

        # TODO: Have some of these be of type `timedelta`.
        return cls(revision=struct_unpack('<L', data[0:4])[0],
                   creation_time=filetime_to_datetime(
                       struct_unpack('<Q', data[8:16])[0]),
                   domain_modified_count=struct_unpack('<Q', data[16:24])[0],
                   max_password_age=struct_unpack('<Q', data[24:32])[0],
                   min_password_age=struct_unpack('<Q', data[32:40])[0],
                   forced_logoff=struct_unpack('<Q', data[40:48])[0],
                   lockout_duration=struct_unpack('<Q', data[48:56])[0],
                   lockout_observation_window=struct_unpack('<Q',
                                                            data[56:64])[0],
                   modified_count_at_last_promotion=struct_unpack(
                       '<Q', data[64:72])[0],
                   next_rid=struct_unpack('<L', data[72:76])[0],
                   password_properties=struct_unpack('<L', data[76:80])[0],
                   min_password_length=struct_unpack('<H', data[80:82])[0],
                   password_history_length=struct_unpack('<H', data[82:84])[0],
                   lockout_threshold=struct_unpack('<H', data[84:86])[0],
                   server_state=struct_unpack('<L', data[88:92])[0],
                   server_role=struct_unpack('<H', data[92:94])[0],
                   uas_compatibility_required=struct_unpack('<H',
                                                            data[94:96])[0],
                   key_0=data[104:])
Пример #2
0
 def server_start_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._server_start_time)
Пример #3
0
 def system_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._system_time)
Пример #4
0
 def from_value_bytes(cls, value_bytes: bytes) -> TimestampAVPair:
     return cls(
         filetime=value_bytes,
         timestamp=filetime_to_datetime(
             filetime=struct_unpack_from('<Q', buffer=value_bytes)[0]))
Пример #5
0
 def change_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._change_time)
Пример #6
0
 def last_write_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._last_write_time)
Пример #7
0
 def last_access_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._last_access_time)
Пример #8
0
 def creation_time(self) -> datetime:
     return filetime_to_datetime(filetime=self._creation_time)