Skip to content

Commit

Permalink
wip: 异常时打印错误详情;throttleTime 默认值修改为 5s
Browse files Browse the repository at this point in the history
  • Loading branch information
renxia committed Jun 10, 2024
1 parent c137d8a commit 0f84c37
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@

基于以上基础特性,可以实现许多有意思的能力,为我们分析学习三方系统提供有效的帮助,例如:


- `应用调试` 通过拦截请求、修改参数、模拟数据等,可以实现应用的调试、逆向分析、数据模拟等目的。
- `功能增强` 通过程序化的修改返回结果,解锁客户端应用的隐藏功能
- `VIP 破解` 通过拦截请求,修改请求参数,模拟请求,从而实现破解 vip 功能。
- `应用调试` 通过修改数据、模拟数据、拦截数据等,可以实现应用的调试、逆向分析、数据模拟等目的
- `广告过滤` 通过修改或移除请求返回结果,屏蔽客户端应用广告
- `认证信息同步` 通过拦截请求,提取 cookie 等信息并同步保存至文件或其他系统重,从而实现认证信息同步、登录状态同步等功能。
- `数据缓存` 通过解码数据,修改数据,保存数据,可以实现数据缓存、数据修改等功能。
- ...
- `数据缓存` 通过解码、修改、保存数据,可以实现数据缓存、数据修改等功能。
- ......

## 安装与更新

Expand Down
2 changes: 1 addition & 1 deletion src/lib/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function getConfig(useCache = true) {
);
}

config.throttleTime = Math.max(1, +config.throttleTime || 10);
config.throttleTime = Math.max(1, +config.throttleTime || 5);

if (!Array.isArray(config.ruleDirs)) config.ruleDirs = [config.ruleDirs as never as string];

Expand Down
3 changes: 2 additions & 1 deletion src/lib/rulesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ function loadRules(filepaths: string[] = [], isInit = false) {
rules.set(rule.ruleId, rule);
}
} catch (e) {
logger.debug('尝试从文件加载规则失败:', filepath, e.message);
console.error(e);
logger.warn('从文件加载规则失败:', color.yellow(filepath), color.red(e.message));
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default (server: Whistle.PluginServer, options: Whistle.PluginOptions) =>
const r = await ruleHandler({ req, rule, res });
if (r.body != null) return res.end(util.toBuffer(r.body) || '');
} catch (e) {
logger.error(`[ruleHandler][${color.red(rule.ruleId)}]err`, e);
console.error(e);
logger.error(`[ruleHandler][${color.red(rule.ruleId)}]err`, (e as Error).message || e);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions w2.x-scripts.config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const config = {
// envConfFile: 'env-config.sh',
/** 写入环境变量信息到本地文件的路径。若设置为空则不写入 */
// cacheFile: 'w2.x-scripts.cache.json',
/** 数据处理防抖时间间隔。单位为秒,默认为 10 (s) */
throttleTime: 10,
/** 数据处理防抖时间间隔。单位为秒,默认为 5 (s) */
throttleTime: 5,
/** 指定规则集文件路径或所在目录,尝试从该列表加载自定义的规则集 */
ruleDirs: [
// require.resolve('@lzwme/x-scripts-rules', { paths: require.main.paths }),
Expand Down

0 comments on commit 0f84c37

Please sign in to comment.