Skip to content

Commit

Permalink
Merge pull request #27 from rufflabs/master
Browse files Browse the repository at this point in the history
Exclude krbtgt by default
  • Loading branch information
clr2of8 authored Jun 24, 2022
2 parents d023daa + bae405c commit c8e5885
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dpat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
parser.add_argument('-g', '--grouplists', help='The name of one or multiple files that contain lists of usernames in particular groups. The group names will be taken from the file name itself. The username list must be in the same format as found in the NTDS file such as some.ad.domain.com\\username or it can be in the format output by using the PowerView Get-NetGroupMember function. Example: -g "Domain Admins.txt" "Enterprise Admins.txt"', nargs='*', required=False)
parser.add_argument('-m', '--machineaccts', help='Include machine accounts when calculating statistics',
default=False, required=False, action='store_true')
parser.add_argument('-k', '--krbtgt', help='Include the krbtgt account', default=False, required=False, action='store_true')
args = parser.parse_args()

ntds_file = args.ntdsfile
Expand Down Expand Up @@ -224,7 +225,8 @@ def crack_it(nt_hash, lm_pass):
history_base_username = results.group(1)
history_index = results.group(2)
# Exclude machine accounts (where account name ends in $) by default
if args.machineaccts or not username.endswith("$"):
# Exclude krbtgt account by default to protect this infrequently changing password from unnecesary disclosure, issue #10
if args.machineaccts or not username.endswith("$") and args.krbtgt or not username == "krbtgt":
c.execute("INSERT INTO hash_infos (username_full, username, lm_hash , lm_hash_left , lm_hash_right , nt_hash, history_index, history_base_username) VALUES (?,?,?,?,?,?,?,?)",
(usernameFull, username, lm_hash, lm_hash_left, lm_hash_right, nt_hash, history_index, history_base_username))
fin.close()
Expand Down

0 comments on commit c8e5885

Please sign in to comment.