Takes too long to generate the array when scanning 1-65535 so work as we go along
parent
36644c2a85
commit
a39f7f1753
|
@ -56,31 +56,36 @@ function Invoke-EgressCheck {
|
||||||
param([string] $ip, [string] $portrange = "22-25,53,80,443,445,3306,3389", [string] $protocol = "TCP", [int] $verbosity=0, [int] $delay=100)
|
param([string] $ip, [string] $portrange = "22-25,53,80,443,445,3306,3389", [string] $protocol = "TCP", [int] $verbosity=0, [int] $delay=100)
|
||||||
|
|
||||||
$pr_split = $portrange -split ','
|
$pr_split = $portrange -split ','
|
||||||
$ports = @()
|
|
||||||
foreach ($p in $pr_split) {
|
foreach ($p in $pr_split) {
|
||||||
if ($p -match '^[0-9]+-[0-9]+$') {
|
if ($p -match '^[0-9]+-[0-9]+$') {
|
||||||
$prange = $p -split '-'
|
$prange = $p -split '-'
|
||||||
for ($c = [convert]::ToInt32($prange[0]);$c -le [convert]::ToInt32($prange[1]);$c++) {
|
for ($c = [convert]::ToInt32($prange[0]);$c -le [convert]::ToInt32($prange[1]);$c++) {
|
||||||
$ports += $c
|
egress -ip $ip -port $c -verbosity $verbosity -delay $delay -protocol $protocol
|
||||||
}
|
}
|
||||||
} elseif ($p -match '^[0-9]+$') {
|
} elseif ($p -match '^[0-9]+$') {
|
||||||
$ports += $p
|
egress -ip $ip -port $c -verbosity $verbosity -delay $delay -protocol $protocol
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($eachport in $ports) {
|
}
|
||||||
if ($protocol -eq "TCP" -Or $protocol -eq "ALL") {
|
|
||||||
generate_tcp -ip $ip -port $eachport -verbosity $verbosity
|
function egress {
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([string]$ip, [int]$port, [int]$verbosity, [int]$delay, [string]$protocol) {
|
||||||
|
|
||||||
|
if ($protocol -eq "TCP" -Or $protocol -eq "ALL") {
|
||||||
|
generate_tcp -ip $ip -port $port -verbosity $verbosity
|
||||||
if ($delay -gt 0) {
|
if ($delay -gt 0) {
|
||||||
Start-Sleep -m ($delay)
|
Start-Sleep -m ($delay)
|
||||||
if ($verbosity -gt 0) { Write-Host -NoNewLine "W" }
|
if ($verbosity -gt 0) { Write-Host -NoNewLine "W" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($protocol -eq "UDP" -Or $protocol -eq "ALL") {
|
if ($protocol -eq "UDP" -Or $protocol -eq "ALL") {
|
||||||
generate_udp -ip $ip -port $eachport -verbosity $verbosity
|
generate_udp -ip $ip -port $port -verbosity $verbosity
|
||||||
if ($delay -gt 0) {
|
if ($delay -gt 0) {
|
||||||
Start-Sleep -m ($delay)
|
Start-Sleep -m ($delay)
|
||||||
if ($verbosity -gt 0) { Write-Host -NoNewLine "W" }
|
if ($verbosity -gt 0) { Write-Host -NoNewLine "W" }
|
||||||
|
|
Loading…
Reference in New Issue