-
Notifications
You must be signed in to change notification settings - Fork 0
/
vuln_scanner.ps1
52 lines (49 loc) · 1.14 KB
/
vuln_scanner.ps1
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
param (
[string]$target = $(Read-Host -Prompt "Enter the target IP or hostname")
)
# List of common services and their default ports
$services = @{
"FTP" = 21
"SSH" = 22
"Telnet" = 23
"SMTP" = 25
"DNS" = 53
"HTTP" = 80
"POP3" = 110
"NetBIOS" = 139
"IMAP" = 143
"HTTPS" = 443
"SMB" = 445
"IMAPS" = 993
"RDP" = 3389
"MySQL" = 3306
"PostgreSQL" = 5432
"VNC" = 5900
"Redis" = 6379
"Elasticsearch" = 9200
"MongoDB" = 27017
}
# Function to check if a port is open
function Test-Port {
param (
[string]$ip,
[int]$port
)
try {
$tcpClient = New-Object System.Net.Sockets.TcpClient
$tcpClient.Connect($ip, $port)
$tcpClient.Close()
return $true
} catch {
return $false
}
}
# Scan each service
foreach ($service in $services.GetEnumerator()) {
$portStatus = Test-Port -ip $target -port $service.Value
if ($portStatus) {
Write-Output "$($service.Key) service is running on port $($service.Value)"
} else {
Write-Output "$($service.Key) service is not available on port $($service.Value)"
}
}