<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to convert Active DIrectory AccountExpires field into a date code in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/470737#M7201</link>
    <description>&lt;P&gt;@sheamus69, which events are you seeing this field in? Are you using the &lt;A href="https://splunkbase.splunk.com/app/1151/"&gt;Splunk Supporting Add-on for Active Directory&lt;/A&gt; to pull your account information in for analysis with ES?&lt;/P&gt;

&lt;P&gt;As you noted and per KB Article &lt;A href="https://support.microsoft.com/en-us/help/555936"&gt;555936&lt;/A&gt;; &lt;EM&gt;The Active Directory stores date/time values as the number of 100-nanosecond intervals that have elapsed since the 0 hour on January 1, 1601 till the date/time that is being stored. The time is always stored in Greenwich Mean Time (GMT) in the Active Directory.&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;Using that information and the reference here, the formula would be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; =(((ROUNDDOWN(raw_date/10000000,0)/3600)+gmt_offset)/24)-109205
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should be able to put formula into an eval statement for Splunk.&lt;/P&gt;

&lt;P&gt;I asked about the Add-On for Active Directory because there is an easier method to retrieve this data by changing your ldapsearch to return the computed password expiry time in standard format. Here is a sample of what that would look like.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch domain=contoso.com search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))" attr="*;msDS-UserPasswordExpiryTimeComputed"
| collect index=main sourcetype=activedirectory:json source=activedirectory_user host=ad1-contoso
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 Apr 2020 17:25:59 GMT</pubDate>
    <dc:creator>jwiedow</dc:creator>
    <dc:date>2020-04-09T17:25:59Z</dc:date>
    <item>
      <title>How to convert Active DIrectory AccountExpires field into a date code</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/470736#M7200</link>
      <description>&lt;P&gt;The AccountExpires field in an AD log is described as:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;The date when the account expires. This value represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). A value of 0 or 0x7FFFFFFFFFFFFFFF (9223372036854775807) indicates that the account never expires.&lt;BR /&gt;
&lt;A href="https://docs.microsoft.com/en-us/windows/win32/adschema/a-accountexpires"&gt;https://docs.microsoft.com/en-us/windows/win32/adschema/a-accountexpires&lt;/A&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The long string doesn't follow the standard unix epoch time, so the strftime function doesn't seem to apply.&lt;/P&gt;

&lt;P&gt;Does anyone know the formula for resolving this?&lt;/P&gt;

&lt;P&gt;Sample data Set:&lt;/P&gt;

&lt;P&gt;accountExpires,             accountExpires_strftime,            ActualExpiry&lt;BR /&gt;
132066576000000000,     11:59.59 pm, Fri 12/31/9999,        03/07/2019 21:00&lt;BR /&gt;
0,                          01:00.00 am, Thu 01/01/1970,        Never&lt;BR /&gt;
131775408000000000,     11:59.59 pm, Fri 12/31/9999,        31/07/2018 21:00&lt;BR /&gt;
131748624000000000,     11:59.59 pm, Fri 12/31/9999,        30/06/2018 21:00&lt;BR /&gt;
131693328000000000,     11:59.59 pm, Fri 12/31/9999,        27/04/2018 21:00&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;BR /&gt;
Sheamus&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 16:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/470736#M7200</guid>
      <dc:creator>sheamus69</dc:creator>
      <dc:date>2020-04-09T16:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Active DIrectory AccountExpires field into a date code</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/470737#M7201</link>
      <description>&lt;P&gt;@sheamus69, which events are you seeing this field in? Are you using the &lt;A href="https://splunkbase.splunk.com/app/1151/"&gt;Splunk Supporting Add-on for Active Directory&lt;/A&gt; to pull your account information in for analysis with ES?&lt;/P&gt;

&lt;P&gt;As you noted and per KB Article &lt;A href="https://support.microsoft.com/en-us/help/555936"&gt;555936&lt;/A&gt;; &lt;EM&gt;The Active Directory stores date/time values as the number of 100-nanosecond intervals that have elapsed since the 0 hour on January 1, 1601 till the date/time that is being stored. The time is always stored in Greenwich Mean Time (GMT) in the Active Directory.&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;Using that information and the reference here, the formula would be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; =(((ROUNDDOWN(raw_date/10000000,0)/3600)+gmt_offset)/24)-109205
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should be able to put formula into an eval statement for Splunk.&lt;/P&gt;

&lt;P&gt;I asked about the Add-On for Active Directory because there is an easier method to retrieve this data by changing your ldapsearch to return the computed password expiry time in standard format. Here is a sample of what that would look like.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch domain=contoso.com search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))" attr="*;msDS-UserPasswordExpiryTimeComputed"
| collect index=main sourcetype=activedirectory:json source=activedirectory_user host=ad1-contoso
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Apr 2020 17:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/470737#M7201</guid>
      <dc:creator>jwiedow</dc:creator>
      <dc:date>2020-04-09T17:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Active DIrectory AccountExpires field into a date code</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/600875#M10833</link>
      <description>&lt;P&gt;I had to use a different calculation.&amp;nbsp; The TZ is still off, but as I'm only looking for a date,&amp;nbsp; it's close enough for my purposes.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=wineventlog   source="WinEventLog:Security"   EventCode=5136 LDAP_Display_Name=accountExpires   Value&amp;gt;0  
| eval expDate=floor((Value-116444736000000000)/10000000)
| dedup _time Account_Name LDAP_Display_Name  expDate DN
| table _time Account_Name LDAP_Display_Name  expDate DN
| convert timeformat="%Y-%m-%d"  ctime(expDate)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still don't understand why my TZ is wrong.&amp;nbsp; I assume the Value field is UTC and I'm subtracting the Splunk epoch (result of one-liner below) from that.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;([datetime] "1970-01-01 00:00:00Z").ToFileTimeUtc()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-convert-Active-DIrectory-AccountExpires-field-into-a-date/m-p/600875#M10833</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2022-06-07T13:44:30Z</dc:date>
    </item>
  </channel>
</rss>

