aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Lundeen <richard.lundeen@gmail.com>2013-06-18 15:10:54 -0700
committerRich Lundeen <richard.lundeen@gmail.com>2013-06-18 15:10:54 -0700
commit60a6044d36b0014ec896ed0052dbbb36342a54ee (patch)
treececdf0b16dcec36549a14bf247bb6c3c51c862da
parent223527d4cdf1fd227dda53ea3768fc57aa1552ce (diff)
downloadPowerSploit-60a6044d36b0014ec896ed0052dbbb36342a54ee.tar.gz
PowerSploit-60a6044d36b0014ec896ed0052dbbb36342a54ee.zip
fixing EOL spaces
-rw-r--r--Recon/Invoke-Portscan.ps137
1 files changed, 13 insertions, 24 deletions
diff --git a/Recon/Invoke-Portscan.ps1 b/Recon/Invoke-Portscan.ps1
index bba5821..a6b1338 100644
--- a/Recon/Invoke-Portscan.ps1
+++ b/Recon/Invoke-Portscan.ps1
@@ -19,7 +19,6 @@ Does a simple port scan using regular sockets, based (pretty) loosely on nmap
version .13
-
.PARAMETER Hosts
Include these comma seperated hosts (supports IPv4 CIDR notation) or pipe them in
@@ -89,7 +88,6 @@ How often (in terms of hosts) to sync threads and flush output
2 {$nHosts=15; $Threads = 32; $Timeout = 3000 }
1 {$nHosts=10; $Threads = 32; $Timeout = 5000 }
-
.PARAMETER GrepOut
Greppable output file
@@ -104,7 +102,7 @@ output file in 'readable' format
.PARAMETER AllformatsOut
-output in readable (.nmap), xml (.xml), and greppable (.gnmap) formats
+output in readable (.nmap), xml (.xml), and greppable (.gnmap) formats
.PARAMETER noProgressMeter
@@ -118,7 +116,6 @@ supresses returned output and don't store hosts in memory - useful for very larg
Force Overwrite if output Files exist. Otherwise it throws exception
-
.EXAMPLE
C:\PS> Invoke-Portscan -Hosts "webstersprodigy.net,google.com,microsoft.com" -TopPorts 50
@@ -127,7 +124,6 @@ Description
-----------
Scans the top 50 ports for hosts found for webstersprodigy.net,google.com, and microsoft.com
-
.EXAMPLE
C:\PS> echo webstersprodigy.net | Invoke-Portscan -oG test.gnmap -f -ports "80,443,8080"
@@ -136,7 +132,6 @@ Description
-----------
Does a portscan of "webstersprodigy.net", and writes a greppable output file
-
.EXAMPLE
C:\PS> Invoke-Portscan -Hosts 192.168.1.1/24 -T 4 -TopPorts 25 -oA localnet
@@ -145,7 +140,6 @@ Description
-----------
Scans the top 20 ports for hosts found in the 192.168.1.1/24 range, outputs all file formats
-
.LINK
http://webstersprodigy.net
@@ -153,10 +147,12 @@ http://webstersprodigy.net
[CmdletBinding()]Param (
#Host, Ports
- [Parameter(ParameterSetName="cmdHosts",
+ [Parameter(ParameterSetName="cmdHosts",
+
ValueFromPipeline=$True,
- Mandatory = $True)]
- [String[]] $Hosts,
+ Mandatory = $True)]
+
+ [String[]] $Hosts,
[Parameter(ParameterSetName="fHosts",
Mandatory = $True)]
@@ -363,11 +359,11 @@ http://webstersprodigy.net
{
Param (
[Parameter(Mandatory = $True)]
- [ValidateRange(1,1000)]
+ [ValidateRange(1,1000)]
+
[int] $numPorts
)
-
#list of top 1000 ports from nmap from Jun 2013
[int[]] $topPortList = @(80,23,443,21,3389,110,445,139,143,53,135,3306,8080,22
1723,111,995,993,5900,1025,1720,548,113,81,6001,179,1026,2000,8443,
@@ -646,7 +642,6 @@ http://webstersprodigy.net
return $False
}
-
try
{
@@ -661,7 +656,6 @@ http://webstersprodigy.net
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
-
if ($Hosts)
{
foreach($h in $Hosts)
@@ -771,7 +765,6 @@ http://webstersprodigy.net
$sPortList = [string]::join(",", $portList)
$sHostPortList = [string]::join(",", $hostPortList)
-
########
#Port Scan Code - run on a per host basis
########
@@ -887,7 +880,6 @@ http://webstersprodigy.net
`$sockets.Remove($p)
"@
-
$timeoutCallback = [scriptblock]::Create($timeoutCallback)
$timeouts[$p] = New-Object System.Timers.Timer
@@ -895,7 +887,6 @@ http://webstersprodigy.net
$timeouts[$p].Interval = $timeout
$timeouts[$p].Enabled = $true
-
$myscriptblock = [scriptblock]::Create($scriptBlockAsString)
$x = $sockets[$p].beginConnect($h, $p,(New-ScriptBlockCallback($myscriptblock)) , $null)
@@ -954,7 +945,6 @@ http://webstersprodigy.net
[string[]]$Ports = @()
-
foreach($Port in $Portlist)
{
Try
@@ -989,7 +979,6 @@ http://webstersprodigy.net
}
}
-
# the outer loop is to flush the loop.
# Otherwise Get-Job | Wait-Job could clog, etc
@@ -1037,17 +1026,19 @@ http://webstersprodigy.net
$upHosts ++
}
- if (!$quiet)
+ if (!$quiet)
+
{
$hostDate = Get-Date
$hostObj = New-Object System.Object
- $hostObj | Add-Member -MemberType Noteproperty -Name Hostname -Value $jobName
+ $hostObj | Add-Member -MemberType Noteproperty -Name Hostname -Value $jobName
+
$hostObj | Add-Member -MemberType Noteproperty -Name alive -Value $hostUp
$hostObj | Add-Member -MemberType Noteproperty -Name openPorts -Value $openPorts
$hostObj | Add-Member -MemberType Noteproperty -Name closedPorts -Value $closedPorts
$hostObj | Add-Member -MemberType Noteproperty -Name filteredPorts -Value $filteredPorts
$hostObj | Add-Member -MemberType NoteProperty -Name finishTime -Value $hostDate
-
+
$scannedHostList += $hostobj
}
@@ -1095,5 +1086,3 @@ http://webstersprodigy.net
}
}
}
-
-