360 Secure SkillHub
360 安全技能中心

Netmap

调用 nmap 扫描本地网络,发现设备 IP、主机名、厂商与类型,并写入持久化设备数据库;支持为设备标记友好名称、按 IP/主机名/MAC/厂商/类型查找、查看近期新出现设备、导出 JSON 以及定时监视网络变化。厂商信息查询依赖外部服务,深度扫描耗时较长。

wrentheai
wrentheai
热度 53.39
最近更新 2026-05-11 17:33:34
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 工作流 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add netmap
Metadata
name
netmap
description
Scan and map all devices on the local network. Discovers IPs, hostnames, vendors, and device types. Tracks when devices first appeared and were last seen. Supports labeling devices with friendly names and searching by IP, hostname, MAC, or type. USE WHEN: User asks what's on their network, wants to find a device's IP (printer, NAS, TV, etc.), wants to see new/unknown devices, or needs to diagnose connectivity issues. Also use when an IP is needed for a specific device (e.g. "what IP is my printer?"). DON'T USE WHEN: User asks about internet speed, WiFi signal strength, or remote networks they're not connected to.

netmap

Scans the local network and maintains a persistent device database at ~/.config/netmap/devices.json.

Requirements

  • nmap must be installed: brew install nmap
  • Script: scripts/netmap.py

Commands

# Discover all devices on the network (fast, ~30-60s)
python3 scripts/netmap.py scan

# Deep scan — also port-scans each device to identify type (slower, ~2-3min)
python3 scripts/netmap.py scan --deep

# Override subnet (auto-detected by default)
python3 scripts/netmap.py scan --subnet 10.0.0.0/24

# List all known devices
python3 scripts/netmap.py list
python3 scripts/netmap.py list --times   # include first/last seen

# Find a device by IP, hostname, MAC, vendor, or device type
python3 scripts/netmap.py find printer
python3 scripts/netmap.py find 192.168.1.12
python3 scripts/netmap.py find Canon

# Label a device with a friendly name
python3 scripts/netmap.py label 192.168.1.12 "Canon Printer"
python3 scripts/netmap.py label AA:BB:CC:DD:EE:FF "Kevin's iPhone"

# Show devices first seen in the last N minutes
python3 scripts/netmap.py new --minutes 30

# Export device database as JSON
python3 scripts/netmap.py export

# Continuous watch mode (scans every 2min by default)
python3 scripts/netmap.py watch
python3 scripts/netmap.py watch --interval 60

Notes

  • MAC addresses and vendor info require running with sudo (or they appear blank without it)
  • Deep scan adds port-based device fingerprinting: identifies printers, NAS, SSH servers, Apple devices, etc.
  • Device database persists across scans — labels survive rescans
  • Subnet is auto-detected from the machine's default interface
  • Run scan --deep first time to populate device types, then scan for fast refreshes