Git Product home page Git Product logo

invoke-thehash's Introduction

Invoke-TheHash

Invoke-TheHash contains PowerShell functions for performing pass the hash WMI and SMB command execution. WMI and SMB services are accessed through .NET TCPClient connections. Authentication is performed by passing an NTLM hash into the NTLMv2 authentication protocol. Local administrator privilege is not required client-side.

Requirements

Minimum PowerShell 2.0

Import

Import-Module ./Invoke-TheHash.psd1

or

. ./Invoke-WMIExec.ps1
. ./Invoke-SMBExec.ps1
. ./Invoke-TheHash.ps1

Functions

  • Invoke-WMIExec
  • Invoke-SMBExec
  • Invoke-TheHash
  • ConvertTo-TargetList

Invoke-WMIExec

  • WMI command execution function.
Parameters:
  • Target - Hostname or IP address of target.
  • Username - Username to use for authentication.
  • Domain - Domain to use for authentication. This parameter is not needed with local accounts or when using @domain after the username.
  • Hash - NTLM password hash for authentication. This module will accept either LM:NTLM or NTLM format.
  • Command - Command to execute on the target. If a command is not specified, the function will just check to see if the username and hash has access to WMI on the target.
  • Sleep - Default = 10 Milliseconds: Sets the function's Start-Sleep values in milliseconds.
Example:

Invoke-WMIExec -Target 192.168.100.20 -Domain TESTDOMAIN -Username TEST -Hash F6F38B793DB6A94BA04A52F1D3EE92F0 -Command "command or launcher to execute" -verbose

Screenshot:

wmi

Invoke-SMBExec

  • SMB (PsExec) command execution function supporting SMB1, SMB2, and SMB signing.
Parameters:
  • Target - Hostname or IP address of target.
  • Username - Username to use for authentication.
  • Domain - Domain to use for authentication. This parameter is not needed with local accounts or when using @domain after the username.
  • Hash - NTLM password hash for authentication. This module will accept either LM:NTLM or NTLM format.
  • Command - Command to execute on the target. If a command is not specified, the function will just check to see if the username and hash has access to SCM on the target.
  • CommandCOMSPEC - Default = Enabled: Prepend %COMSPEC% /C to Command.
  • Service - Default = 20 Character Random: Name of the service to create and delete on the target.
  • SMB1 - (Switch) Force SMB1. The default behavior is to perform SMB version negotiation and use SMB2 if supported by the target.
  • Sleep - Default = 150 Milliseconds: Sets the function's Start-Sleep values in milliseconds.
Example:

Invoke-SMBExec -Target 192.168.100.20 -Domain TESTDOMAIN -Username TEST -Hash F6F38B793DB6A94BA04A52F1D3EE92F0 -Command "command or launcher to execute" -verbose

Screenshot:

smb

Invoke-TheHash

  • Function for running Invoke-WMIExec and Invoke-SMBExec against multiple targets.
Parameters:
  • Type - Sets the desired Invoke-TheHash function. Set to either WMIExec or SMBExec.
  • Targets - List of hostnames, IP addresses, or CIDR notation for targets.
  • TargetsExclude - List of hostnames and/or IP addresses to exclude form the list or targets.
  • PortCheckDisable - (Switch) Disable WMI or SMB port check. Since this function is not yet threaded, the port check serves to speed up he function by checking for an open WMI or SMB port before attempting a full synchronous TCPClient connection.
  • PortCheckTimeout - Default = 100: Set the no response timeout in milliseconds for the WMI or SMB port check.
  • Username - Username to use for authentication.
  • Domain - Domain to use for authentication. This parameter is not needed with local accounts or when using @domain after the username.
  • Hash - NTLM password hash for authentication. This module will accept either LM:NTLM or NTLM format.
  • Command - Command to execute on the target. If a command is not specified, the function will just check to see if the username and hash has access to WMI or SCM on the target.
  • CommandCOMSPEC - Default = Enabled: SMBExec type only. Prepend %COMSPEC% /C to Command.
  • Service - Default = 20 Character Random: SMBExec type only. Name of the service to create and delete on the target.
  • SMB1 - (Switch) Force SMB1. SMBExec type only. The default behavior is to perform SMB version negotiation and use SMB2 if supported by the target.
  • Sleep - Default = WMI 10 Milliseconds, SMB 150 Milliseconds: Sets the function's Start-Sleep values in milliseconds.
Example:

Invoke-TheHash -Type WMIExec -Targets 192.168.100.0/24 -TargetsExclude 192.168.100.50 -Username Administrator -Hash F6F38B793DB6A94BA04A52F1D3EE92F0

Screenshot:

ithsmb

ConvertTo-TargetList

  • Converts Invoke-TheHash output to an array that contains only targets discovered to have Invoke-WMIExec or Invoke-SMBExec access. The output from this function can be fed back into the Targets parameter of Invoke-TheHash.

invoke-thehash's People

Contributors

kevin-robertson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.