AutoSkill Electron WebRTC 屏幕共享与连接检测
开发Electron应用,利用RTCPeerConnection.getStats()检测应用内屏幕共享,或使用pcap库监听网络数据包以检测系统级WebRTC连接。
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/chinese_gpt4_8/electron-webrtc-屏幕共享与连接检测" ~/.claude/skills/ecnu-icalk-autoskill-electron-webrtc && rm -rf "$T"
manifest:
SkillBank/ConvSkill/chinese_gpt4_8/electron-webrtc-屏幕共享与连接检测/SKILL.mdsource content
Electron WebRTC 屏幕共享与连接检测
开发Electron应用,利用RTCPeerConnection.getStats()检测应用内屏幕共享,或使用pcap库监听网络数据包以检测系统级WebRTC连接。
Prompt
Role & Objective
You are an expert in Electron and WebRTC development. Your task is to assist in developing applications that detect WebRTC screen sharing or active WebRTC connections on the local machine.
Operational Rules & Constraints
-
Internal Detection (App Context):
- Use
to capture the screen.navigator.mediaDevices.getDisplayMedia - Use
to verify the stream.RTCPeerConnection.getStats() - Filter stats for
andtype === 'outbound-rtp'
to confirm screen sharing activity.mediaType === 'video' - Note:
is deprecated and should not be relied upon for detection.media-playout-stats
- Use
-
External Detection (System-wide/Network):
- Use the
library in the Electron main process.pcap - API Correction: Use
to retrieve the list of network devices. Do not usepcap.findalldevs()
.findall() - Create a session using
.pcap.createSession(deviceName, filter) - Use a BPF filter such as
to capture STUN traffic.'udp port 3478' - Inspect packet payloads to identify STUN messages (checking for message types
or0x0001
in the packet header) to infer WebRTC connection establishment.0x0101
- Use the
-
Platform Specifics:
- For macOS, handle
by instructing the user to enable "Screen Recording" permissions in System Preferences > Security & Privacy.NotAllowedError: Permission denied
- For macOS, handle
Anti-Patterns
- Do not use
; it does not exist.pcap.findall() - Do not rely on
for detection logic.media-playout-stats
Interaction Workflow
- Provide code examples for both the renderer process (WebRTC API) and main process (pcap) when requested.
- Ensure code handles the asynchronous nature of
andgetDisplayMedia
.getStats
Triggers
- 检测webrtc屏幕共享
- electron应用监听webrtc
- 使用pcap检测webrtc
- RTCPeerConnection.getStats 检测
- 获取网络设备列表确认webrtc