Skip to content

Commit

Permalink
Time decoding for BadPasswordTime
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Dec 10, 2023
1 parent 0a503ff commit 92c2f16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions modules/integrations/activedirectory/attributes.go
Expand Up @@ -17,6 +17,7 @@ var (
GroupType = engine.NewAttribute("groupType").Tag("AD").Single()
MemberOf = engine.NewAttribute("memberOf").Tag("AD")
Member = engine.NewAttribute("member").Tag("AD")
BadPasswordTime = engine.NewAttribute("badPasswordTime").Tag("AD").Type(engine.AttributeTypeTime100NS)
CreationTime = engine.NewAttribute("creationTime").Tag("AD").Type(engine.AttributeTypeTime100NS)
AccountExpires = engine.NewAttribute("accountExpires").Tag("AD").Type(engine.AttributeTypeTime100NS)
RepsTo = engine.NewAttribute("repsTo").Tag("AD")
Expand Down
8 changes: 3 additions & 5 deletions modules/integrations/activedirectory/rawobject.go
Expand Up @@ -94,11 +94,9 @@ func EncodeAttributeData(attribute engine.Attribute, values []string) engine.Att
var attributevalue engine.AttributeValue
switch attribute {
// Add more things here, like time decoding etc
case CreationTime, AccountExpires, PwdLastSet, LastLogon, LastLogonTimestamp, MSmcsAdmPwdExpirationTime:
// Just use string encoding
case CreationTime, PwdLastSet, LastLogon, LastLogonTimestamp, MSmcsAdmPwdExpirationTime, BadPasswordTime:
if intval, err := strconv.ParseInt(value, 10, 64); err == nil {
if attribute == PwdLastSet && intval == 0 {
// ui.Warn().Msg("PwdLastSet is 0")
if intval == 0 {
attributevalue = engine.AttributeValueInt(intval)
} else {
t := util.FiletimeToTime(uint64(intval))
Expand All @@ -107,7 +105,7 @@ func EncodeAttributeData(attribute engine.Attribute, values []string) engine.Att
} else {
ui.Warn().Msgf("Failed to convert attribute %v value %2x to timestamp: %v", attribute.String(), value, err)
}
case WhenChanged, WhenCreated, DsCorePropagationData,
case AccountExpires, WhenChanged, WhenCreated, DsCorePropagationData,
MsExchLastUpdateTime, MsExchPolicyLastAppliedTime, MsExchWhenMailboxCreated,
GWARTLastModified, SpaceLastComputed:

Expand Down

0 comments on commit 92c2f16

Please sign in to comment.