
Company News
Jerod Santo Joins Socket as Head of Media
Allow myself to introduce... myself.
interception-crack
Advanced tools
拦截 WebSocket、Fetch、XHR 请求的 TypeScript 库。
A TypeScript library for intercepting WebSocket, Fetch, and XHR requests.
npm install interception-crack
# or
yarn add interception-crack
# or
pnpm add interception-crack
导入库后,拦截器会自动初始化。你可以通过回调函数来接收拦截到的响应数据:
import {
onFetchResponse,
onXHRResponse,
onWebSocketMessage,
onWebSocketSend,
} from 'interception-crack';
// 注册 Fetch 响应拦截回调
onFetchResponse((url, method, status, statusText, data) => {
console.log('Fetch 响应:', { url, method, status, statusText, data });
});
// 注册 XHR 响应拦截回调
onXHRResponse((url, method, status, statusText, responseType, data) => {
console.log('XHR 响应:', { url, method, status, statusText, responseType, data });
});
// 注册 WebSocket 消息接收拦截回调
onWebSocketMessage(data => {
console.log('WebSocket 接收消息:', data);
});
// 注册 WebSocket 消息发送拦截回调
onWebSocketSend(data => {
console.log('WebSocket 发送消息:', data);
});
你也可以创建自己的拦截器管理器实例:
import { InterceptorManager } from 'interception-crack';
const manager = new InterceptorManager();
manager.onFetchResponse((url, method, status, statusText, data) => {
// 处理 Fetch 响应
});
manager.onXHRResponse((url, method, status, statusText, responseType, data) => {
// 处理 XHR 响应
});
manager.onWebSocketMessage(data => {
// 处理 WebSocket 接收消息
});
manager.onWebSocketSend(data => {
// 处理 WebSocket 发送消息
});
所有回调函数类型都已导出,方便 TypeScript 类型检查:
import type {
FetchResponseCallback,
XHRResponseCallback,
WebSocketMessageCallback,
WebSocketSendCallback,
} from 'interception-crack';
# Install dependencies
yarn install
# Development mode (watch)
yarn dev
# Build
yarn build
# Lint
yarn lint
# Format code
yarn format
# Generate documentation
yarn build:docs
MIT
FAQs
拦截 WebSocket、Fetch、XHR 请求的 TypeScript 库
The npm package interception-crack receives a total of 3 weekly downloads. As such, interception-crack popularity was classified as not popular.
We found that interception-crack demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Allow myself to introduce... myself.

Research
/Security News
A Twitch browser extension on Chrome and Firefox forwards users’ live OAuth session tokens through proxies controlled by a Russian bot service.

Security News
Anthropic found biased reasoning and recklessness drove Claude Mythos 5 to publish malware on PyPI and compromise a security vendor.