Repository navigation
Expand file tree
/
Copy pathConnection
More file actions
113 lines (35 loc) · 16 KB
/
Copy pathConnection
File metadata and controls
113 lines (35 loc) · 16 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services
https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints
https://learn.microsoft.com/en-us/windows/deployment/update/how-windows-update-works
https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatesearcher-search
------------------------------------------------------------------------------------------------------------------------------------------------------------------
(Invoke-WebRequest 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints').Content -replace '(?is)<script.*?</script>|<style.*?</style>','' | ForEach-Object { [regex]::Matches($_,'(?i)(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)+') | ForEach-Object Value | Where-Object { $_ -match '\.' -and $_ -notmatch '^(www\.)?microsoft\.com$' } | Sort-Object -Unique } | ForEach-Object { $domain = $_ -replace '^\*\.',''; try { Resolve-DnsName $domain -Type A -ErrorAction Stop | Where-Object IPAddress | Select-Object -ExpandProperty IPAddress -Unique | ForEach-Object { $ip = $_; [PSCustomObject]@{ Domain=$domain; IPAddress=$ip; Port=443; Connected=(Test-NetConnection $ip -Port 443 -InformationLevel Quiet -WarningAction SilentlyContinue) } } } catch { [PSCustomObject]@{ Domain=$domain; IPAddress='DNS_FAILED'; Port=443; Connected=$false } } } | Format-Table -AutoSize
([regex]::Matches((Invoke-WebRequest 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints').Content,'(?i)(?:[a-z0-9-]+\.)+[a-z]{2,}')) | ForEach-Object Value | Sort-Object -Unique | ForEach-Object { Resolve-DnsName $_ -Type A -ErrorAction SilentlyContinue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
(Invoke-WebRequest 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints').Content -replace '(?is)<script.*?</script>|<style.*?</style>','' | ForEach-Object { [regex]::Matches($_,'(?i)(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)+') | ForEach-Object Value | Where-Object { $_ -match '\.' -and $_ -notmatch '^(www\.)?microsoft\.com$' } | Sort-Object -Unique } | ForEach-Object { $domain = $_ -replace '^\*\.',''; Resolve-DnsName $domain -Type A -ErrorAction SilentlyContinue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
(Invoke-WebRequest -UseBasicParsing 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints').Content -replace '(?is)<script.*?</script>|<style.*?</style>','' | ForEach-Object { [regex]::Matches($_,'(?i)(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)+') | ForEach-Object Value | Where-Object { $_ -match '\.' -and $_ -notmatch '^(www\.)?microsoft\.com$' } | Sort-Object -Unique } | ForEach-Object { $domain = $_ -replace '^\*\.',''; Resolve-DnsName $domain -Type A -ErrorAction SilentlyContinue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------
[regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { Write-Host "`nTesting: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Wildcard endpoint" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type AAAA -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { Test-NetConnection $_.IPAddress -Port 443 } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Resolve-DnsName storeedgefd.dsx.mp.microsoft.com -Type A | Where-Object IPAddress | ForEach-Object { & "C:\PortQryV2\PortQry.exe" -n $_.IPAddress -p UDP -e 443 -nr }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting UDP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\PortQryV2\PortQry.exe" -n $_.IPAddress -p UDP -e 443 -nr } }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting TCP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\PortQryV2\PortQry.exe" -n $_.IPAddress -p TCP -e 443 -nr } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------
winget install --id Insecure.Nmap --exact
winget show --id Insecure.Nmap --exact --versions
& "C:\Program Files (x86)\Nmap\nmap.exe" --version
Get-ChildItem "C:\Program Files\Nmap","C:\Program Files (x86)\Nmap" -Filter nmap.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
Resolve-DnsName storeedgefd.dsx.mp.microsoft.com -Type A | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -sT -Pn -n -p 443 $_.IPAddress }
Resolve-DnsName storeedgefd.dsx.mp.microsoft.com -Type A | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -sU -Pn -n -p 443 $_.IPAddress }
Resolve-DnsName storeedgefd.dsx.mp.microsoft.com -Type AAAA | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -6 -sT -Pn -n -p 443 $_.IPAddress }
Resolve-DnsName storeedgefd.dsx.mp.microsoft.com -Type AAAA | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -6 -sU -Pn -n -p 443 $_.IPAddress }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting IPv4 TCP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -sT -Pn -n -p 443 $_.IPAddress } }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting IPv4 UDP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type A -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -sU -Pn -n -p 443 $_.IPAddress } }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting IPv6 TCP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type AAAA -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -6 -sT -Pn -n -p 443 $_.IPAddress } }
$domains = @([regex]::Matches((Invoke-WebRequest -Uri 'https://learn.microsoft.com/en-us/windows/privacy/manage-windows-11-endpoints' -UseBasicParsing).Content,'(?is)<table\b[^>]*>.*?</table>') | ForEach-Object { [regex]::Matches($_.Value,'(?is)<tr\b[^>]*>.*?</tr>') } | ForEach-Object { $c = [regex]::Matches($_.Value,'(?is)<td\b[^>]*>(.*?)</td>'); if ($c.Count -ge 4) { [regex]::Matches([System.Net.WebUtility]::HtmlDecode(($c[3].Groups[1].Value -replace '<[^>]+>',' ')),'(?i)(?<![a-z0-9.*-])(?:[a-z0-9*-]+\.)+[a-z]{2,63}\*?(?![a-z0-9*-])') | ForEach-Object { $_.Value.ToLowerInvariant() } } } | Sort-Object -Unique); $domains; Write-Host "`nTotal endpoints: $($domains.Count)" -ForegroundColor Cyan; foreach ($domain in $domains) { $domain = $domain -replace '^\*\.', ''; Write-Host "`nTesting IPv6 UDP: $domain" -ForegroundColor Cyan; if ($domain.Contains('*')) { Write-Host "Skipped: Remaining wildcard" -ForegroundColor Red; continue }; Resolve-DnsName $domain -Type AAAA -ErrorAction Continue | Where-Object IPAddress | ForEach-Object { & "C:\Program Files (x86)\Nmap\nmap.exe" -6 -sU -Pn -n -p 443 $_.IPAddress } }
------------------------------------------------------------------------------------------------------------------------------------------------------------------