Skip to content

Add PowerShell network device scanner with multi-subnet discovery and API endpoint detection#7

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/create-powershell-script-network-scan
Draft

Add PowerShell network device scanner with multi-subnet discovery and API endpoint detection#7
Copilot wants to merge 3 commits intomainfrom
copilot/create-powershell-script-network-scan

Conversation

Copy link

Copilot AI commented Dec 13, 2025

Implements a PowerShell script for Windows 11 that discovers devices across multiple LAN subnets, identifies device types (IoT hubs, smart devices, security equipment), and detects exposed API endpoints.

Implementation

scripts/NetworkDeviceScanner.ps1 (837 lines)

  • Multi-subnet scanning with CIDR auto-detection or manual specification
  • Parallel ICMP-based host discovery (configurable concurrency, default 50)
  • Port scanning across 42+ common API ports (80, 443, 8123, 8080, etc.)
  • HTTP/HTTPS probing with header and content analysis for device fingerprinting
  • Device type identification: Home Assistant, Shelly, Ubiquiti, Ajax, Synology, IP cameras
  • Output formats: Table, List, JSON, CSV with export capability
  • Self-signed certificate handling with proper callback restoration

scripts/README.md (402 lines)

  • Usage examples, parameter reference, device identification matrix
  • Performance tuning guidance for large networks

scripts/HANDOVER.md (213 lines)

  • Testing scenarios and implementation notes

Key Technical Details

Performance optimization for large subnets:

# Use ArrayList instead of array concatenation to avoid O(n²) behavior
$ips = New-Object System.Collections.ArrayList
for ($i = $networkInt + 1; $i -lt $broadcastInt; $i++) {
    [void]$ips.Add([System.Net.IPAddress]::new($bytes).ToString())
}

Secure certificate validation:

try {
    if ($protocol -eq 'https') {
        $originalCallback = [System.Net.ServicePointManager]::ServerCertificateValidationCallback
        [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
        # ... make requests ...
    }
}
finally {
    # Restore to prevent session-wide security impact
    if ($null -ne $originalCallback) {
        [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $originalCallback
    }
}

Safe content truncation:

$fullContent = $reader.ReadToEnd()
$result.Content = $fullContent.Substring(0, [Math]::Min(4096, $fullContent.Length))
Original prompt

@develop-agent Task: I want to create a powershell script that will run on my windows 11 laptop. It needs to seach my local lan (mulitiole subnets) for all devices it can see. Then fins out what kind of device it is and look for API endpoints exposed by the device.
Devices can range from IOT hubs (eg home assistant) to IOT devices (shelly) or even security decices (Ubiquity, Ajax security hub with NVR and such).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 13, 2025 13:39
Co-authored-by: UncleBats <33801297+UncleBats@users.noreply.github.com>
Co-authored-by: UncleBats <33801297+UncleBats@users.noreply.github.com>
Copilot AI changed the title [WIP] Add PowerShell script for scanning local LAN devices Add PowerShell network device scanner with multi-subnet discovery and API endpoint detection Dec 13, 2025
Copilot AI requested a review from UncleBats December 13, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants