• Stars
    star
    1,423
  • Rank 33,073 (Top 0.7 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

基于 Whistle 实现的多账号多环境远程配置及抓包调试平台

Nohost

NPM version node version PRs Welcome License

Nohost 是基于 Whistle 实现的多用户多环境配置及抓包调试系统,不仅具备 Whistle 的所有功能,并在 Whistle 基础上扩展了一些功能,且支持多人多环境同时使用,主要用于部署在公共服务器上供整个部门(公司)的同事共同使用,具有以下功能:

  1. 环境共享:前端无需配后台环境,后台无需配前端环境,其他人无需配任何环境
  2. 抓包调试:远程实时抓包调试,支持各种 Whistle 规则,以及通过链接分享抓包数据
  3. 历史记录:可以把环境配置及抓包数据沉淀下来,供后续随时切换查看
  4. 插件扩展:可以通过插件扩展实现诸如 inspectvaseautosave 等功能
  5. 对外接口:提供对外接口,可供发布系统、CI等工具操作,实现自动化增删查改环境配置

效果图

目录

一. 准备

二. 安装

三. 设置

四. 访问

五. 账号

六. 配置

七. 规则

八. 开发

九. 加群

一. 准备

安装 Nohost 之前,建议先做好以下工作:

  1. 准备一台服务器,假设IP为:10.1.2.3(以你自己的服务器为准,建议4核8G以上的配置)
  2. 准备一个域名(以下假设为:nohost.imweb.io),并把 DNS 指向上述服务器(10.1.2.3)
  3. 收集涉及域名的证书对,只支持 xxx.keyxxx.crt(非必须,但建议用正式的证书,否则要么 Nohost 里面无法查看 HTTPS 的内容,要么每个访问 Nohost 的客户端都要安装一遍根证书)

申请域名的好处是可以直接用域名访问管理及账号页面,手机也可以通过域名设置代理访问 Nohost,方便记忆及输入

二. 安装

首先,需要安装Node(建议使用最新的LTS版本):Node

Node安装成功后,通过npm安装 nohost

npm i -g @nohost/server --registry=https://r.npm.taobao.org

安装完成后执行启动命令:

n2 start

也可以启动时直接设置当前 Nohost 服务到域名 n2 restart -o nohost.imweb.io Nohost 的默认端口为 8080,如果需要自定义端口,可以通过 n2 restart -p 80 设置。 如果命令行提示没有对应命令,检查下系统环境变量 PATH 配置,看看 Nohost 安装后生成的命令所在目录是否已添加到 PATH

重启 Nohost

n2 restart

停止 Nohost

n2 stop

重置管理员账号:

n2 restart --reset

三. 设置

安装启动成功后,打开管理员页面 http://10.1.2.3:8080/admin.html#system/administrator,输入默认用户名(admin)和密码(123456),打开系统配置后:

其中 10.1.2.3 表示Nohost运行的服务器IP,具体根据实际 ServerIP 替换

  1. 修改管理员的默认账号名和密码(不建议使用默认账号及密码,如果忘记管理员账号名或密码,可以通过 n2 restart --reset 重置
  2. 设置Nohost的域名(将申请的域名填上,如果需要设置多个域名,可以通过逗号 , 分隔,也可以通过启动参数 -o www.xxx.com,www.yyy.com 设置)
  3. 上传涉及的 key 和证书(证书只支持 .crt 格式)

admin

Note: 设置的域名 DNS 一定要指向该IP,否则可能出现不可用状态,上述配置会自动重启服务,建议避免频繁操作

四. 访问

Nohost 本身就是一个代理,可以直接配置浏览器或系统代理访问,也可以通过 Nginx反向代理访问,为方便大家使用,针对不同的人群可以使用不同的方案(以下用 nohost.imweb.io 表示 Nohost 的域名,具体域名需要自己申请及设置)。

前端开发

前端开发建议使用最新版的 Whistle,可以通过以下两种方式访问 Nohost:

  1. 直接在 Whistle 上配置远程规则

    @http://nohost.imweb.io:8080/whistle.nohost/cgi-bin/plugin-rules

    上述配置表示 Whistle 从 http://nohost.imweb.io:8080/whistle.nohost/cgi-bin/plugin-rules 获取 Nohost 的生成的入口规则,并且如果 Nohost 规则有变会自动更新规则,这些规则是由 Nohost 上传证书的域名及界面 配置/入口配置 配置的规则自动生成(具体参见后面的配置),这些规则可以自动过滤掉无关请求,只会把相关的请求转到Nohost。

    当然这种直接手动配置在 Whistle 上还不是最好的方式,更建议的方式是把这些规则集成到插件里面,这样开发者只需安装插件即可。

  2. 【强烈推荐】 集成 Whistle 插件,具体参考:https://github.com/nohosts/whistle.nohost-imweb/blob/master/dev.md

后台开发

后台开发推荐使用 Chrome 的 SwitchyOmega 配置代理规则 (如上述代理配置 nohost.imweb.io + 8080),如果不想所有请求都转到 Nohost,可以配置 SwitchyOmega 的自动切换或者用PAC脚本代替,也可以参考 nohost-client 打包一个客户端:https://github.com/nohosts/client。手机端可以直接配代理,或者通过 VPN App 设置代理,如 iPhone 可以用 detour

其他人员

非开发人员尽量使用客户端、APP、或通过外网转发的方式,减少他们的接入成本,如何打包客户端参考:https://github.com/nohosts/client;手机等同后台开发的配置方式。

外网访问

一般 Nohost 是部署在公司内网,外网是不可以直接访问,需要通过接入层(如:Nginx)转发。

五. 账号

安装好插件或配置好代理后,打开相关页面(这些页面的域名必须在上面上传证书里面,如果没有需要额外配置,具体参考下方 配置 说明),即可看到页面左下脚出现一个小圆点,点击小圆点可以进行切换环境:

证书列表

Whistle插件列表

打开页面

点击按钮

如果页面左下脚没出现小圆点,可以看下面 配置 说明 第一次打开小圆点只有一个 正式环境,需要管理员添加账号: 添加账号

添加完账号后,打开独立的环境选择页面 http://nohost.imweb.io:8080

选择环境页面 个人账号页面 image

创建完环境后,可以在环境里面配置任何 Whistle 规则,跟普通到本地 Whistle 功能一模一样,甚至更多。每个实例可以建立上百个账号,每个账号可以建立上百个环境,具体取决于你到机器性能。

六. 配置

默认情况下,只有证书里面域名的请求才会被转发到各个账号,且 html 类型的内容会自动注入小圆点,但在实际应用中你可能会遇到以下问题:

域名证书问题

有些域名只涉及 http 请求,不涉及 https 的请求不需要证书,或者某些敏感及第三方域名无法获得证书,这类域名可以通过在 配置 -> 入口配置 里面设置: 入口配置

入口配置的规则有三种(#xxx表示注释):

pattern #转发到Nohost,如果是html页面则注入小圆点
-pattern #转发到Nohost,不注入小圆点
--pattern #不转发到Nohost,且不注入小圆点
x)-pattern #x为整数(正负数零都可以),表示手动设置优先级,默认为0

pattern 参见:https://wproxy.org/whistle/pattern.html,匹配顺序是从上到下,每个请求只会匹配其中一个,证书里面到域名优先级默认最低,可以通过 1) 设置优先级。

如:

ke.qq.com
-*.url.cn
--localhost.**
-1)**.qq.com

表示:

  1. 所有 ke.qq.com 的请求都转发到Nohost,且所有 html 都注入小圆点
  2. 所有 xxx.url.cn 的请求都转发到Nohost,但不注入小圆点
  3. 所有 localhost.xxx.yyy... 的请求都不转发到Nohost,且不注入小圆点
  4. 所有 qq.com 的子代域名请求都转发到Nohost,但不注入小圆点,并优先级设为 -1 ,确保证书里面的 qq.com 子域名可以正常注入小圆点

七. 规则

这个是 Nohost 主进程 Whistle,所有请求都会通过该 Whistle,并通过该进程的 whistle.nohost 插件进行账号管理及请求转发,主进程 Whistle 在生产环境下无法查看抓包数据,可用于设置规则及全局插件管理,如:屏蔽一些请求等等,更多内容参见后面的文档。

详细内容参见文档:https://nohost.pro/

八. 开发

开发环境搭建:

git clone [email protected]:Tencent/nohost.git
# 切换到dev开发分支
git checkout dev
# 安装依赖
npm install
# 启动页面构建
npm run dev
# 启动 Nohost
npm start

修改页面后需要手动刷新

九. 加群

欢迎大家加入Nohost交流群。考虑到群二维码有时效限制,请大家扫码加好友,验证回复 Nohost ,会统一将大家拉进群。 二维码

参与贡献

如果你有好的意见或建议,欢迎给我们提 Issues 或 Pull Requests,为提升抓包调试体验贡献力量。 腾讯开源激励计划 鼓励开发者的参与和贡献,期待你的加入。

License

MIT

More Repositories

1

weui

A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.
Less
27,140
star
2

wepy

小程序组件化开发框架
JavaScript
22,491
star
3

ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
C++
19,861
star
4

mars

Mars is a cross-platform network component developed by WeChat.
C++
17,294
star
5

tinker

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.
Java
17,164
star
6

MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
C++
17,138
star
7

APIJSON

🏆 实时 零代码、全功能、强安全 ORM 库 🚀 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构 🏆 Real-Time coding-free, powerful and secure ORM 🚀 providing APIs and Docs without coding by Backend, and the returned JSON of API can be customized by Frontend(Client) users
Java
17,052
star
8

vConsole

A lightweight, extendable front-end developer tool for mobile web page.
TypeScript
16,716
star
9

weui-wxss

A UI library by WeChat official design team, includes the most useful widgets/modules.
Less
15,070
star
10

QMUI_Android

提高 Android UI 开发效率的 UI 库
Java
14,423
star
11

rapidjson

A fast JSON parser/generator for C++ with both SAX/DOM style API
C++
14,163
star
12

secguide

面向开发人员梳理的代码安全指南
13,203
star
13

omi

Web Components Framework - Web组件框架
TypeScript
13,048
star
14

VasSonic

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Java
11,801
star
15

matrix

Matrix is a plugin style, non-invasive APM system developed by WeChat.
Java
11,623
star
16

wcdb

WCDB is a cross-platform database framework developed by WeChat.
C
10,793
star
17

xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
C
9,296
star
18

libco

libco is a coroutine library which is widely used in wechat back-end service. It has been running on tens of thousands of machines since 2013.
C++
8,223
star
19

Hippy

Hippy is designed to easily build cross-platform dynamic apps. 👏
C++
7,983
star
20

Shadow

零反射全动态Android插件框架
Java
7,382
star
21

QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
Objective-C
7,084
star
22

lemon-cleaner

腾讯柠檬清理是针对macOS系统专属制定的清理工具。主要功能包括重复文件和相似照片的识别、软件的定制化垃圾扫描、可视化的全盘空间分析、内存释放、浏览器隐私清理以及设备实时状态的监控等。重点聚焦清理功能,对上百款软件提供定制化的清理方案,提供专业的清理建议,帮助用户轻松完成一键式清理。
Objective-C
5,421
star
23

MLeaksFinder

Find memory leaks in your iOS app at develop time.
Objective-C
5,419
star
24

libpag

The official rendering library for PAG (Portable Animated Graphics) files that renders After Effects animations natively across multiple platforms.
C++
4,943
star
25

puerts

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.
C++
4,902
star
26

kbone

一个致力于微信小程序和 Web 端同构的解决方案
JavaScript
4,772
star
27

TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
C++
4,388
star
28

GT

GT (Great Tit) is a portable debugging tool for bug hunting and performance tuning on smartphones anytime and anywhere just as listening music with Walkman. GT can act as the Integrated Debug Environment by directly running on smartphones.
Java
4,387
star
29

westore

小程序项目分层架构
JavaScript
4,244
star
30

tmagic-editor

TypeScript
4,190
star
31

wujie

极致的微前端框架
TypeScript
4,023
star
32

vap

VAP是企鹅电竞开发,用于播放特效动画的实现方案。具有高压缩率、硬件解码等优点。同时支持 iOS,Android,Web 平台。
Objective-C
3,898
star
33

cherry-markdown

✨ A Markdown Editor
JavaScript
3,505
star
34

HunyuanDiT

Hunyuan-DiT : A Powerful Multi-Resolution Diffusion Transformer with Fine-Grained Chinese Understanding
Python
3,358
star
35

phxpaxos

The Paxos library implemented in C++ that has been used in the WeChat production environment.
C++
3,351
star
36

WeFlow

A web developer workflow tool by WeChat team based on tmt-workflow, with cross-platform supported and environment ready.
JavaScript
3,224
star
37

spring-cloud-tencent

Spring Cloud Tencent is a Spring Cloud based Service Governance Framework provided by Tencent.
Java
3,171
star
38

weui.js

A lightweight javascript library for WeUI.
JavaScript
3,167
star
39

tdesign

Enterprise Design System
Vue
3,156
star
40

VasDolly

Android V1 and V2 Signature Channel Package Plugin
Java
3,061
star
41

tencent-ml-images

Largest multi-label image database; ResNet-101 model; 80.73% top-1 acc on ImageNet
Python
3,050
star
42

Tendis

Tendis is a high-performance distributed storage system fully compatible with the Redis protocol.
C++
2,934
star
43

FaceDetection-DSFD

腾讯优图高精度双分支人脸检测器
Python
2,885
star
44

PhoenixGo

Go AI program which implements the AlphaGo Zero paper
C++
2,871
star
45

behaviac

behaviac is a framework of the game AI development, and it also can be used as a rapid game prototype design tool. behaviac supports the behavior tree, finite state machine and hierarchical task network(BT, FSM, HTN)
C#
2,829
star
46

PocketFlow

An Automatic Model Compression (AutoMC) framework for developing smaller and faster AI applications.
Python
2,783
star
47

MSEC

Mass Service Engine in Cluster(MSEC) is opened source by QQ team from Tencent. It is a backend DEV &OPS engine, including RPC,name finding,load balance,monitoring,release and capacity management.
Java
2,746
star
48

phxsql

A high availability MySQL cluster that guarantees data consistency between a master and slaves.
C++
2,470
star
49

OOMDetector

OOMDetector is a memory monitoring component for iOS which provides you with OOM monitoring, memory allocation monitoring, memory leak detection and other functions.
Objective-C++
2,315
star
50

tsf

coroutine and Swoole based php server framework in tencent
PHP
2,179
star
51

tmt-workflow

A web developer workflow used by WeChat team based on Gulp, with cross-platform supported and solutions prepared.
CSS
2,173
star
52

UnLua

A feature-rich, easy-learning and highly optimized Lua scripting plugin for UE.
C++
2,169
star
53

Hardcoder

Hardcoder is a solution which allows Android APP and Android System to communicate with each other directly, solving the problem that Android APP could only use system standard API rather than the hardware resource of system.
C++
2,155
star
54

LKImageKit

A high-performance image framework, including a series of capabilities such as image views, image downloader, memory caches, disk caches, image decoders and image processors.
Objective-C
2,082
star
55

GameAISDK

基于图像的游戏AI自动化框架
C++
2,030
star
56

TubeMQ

TubeMQ has been donated to the Apache Software Foundation and renamed to InLong, please visit the new Apache repository: https://github.com/apache/incubator-inlong
2,022
star
57

phxrpc

A simple C++ based RPC framework.
C++
1,974
star
58

TscanCode

A static code analyzer for C++, C#, Lua
C++
1,972
star
59

ObjectDetection-OneStageDet

单阶段通用目标检测器
Python
1,966
star
60

InjectFix

InjectFix is a hot-fix solution library for Unity
C#
1,961
star
61

cloudbase-framework

腾讯云开发云原生一体化部署工具 🚀 CloudBase Framework:一键部署,不限框架语言,云端一体化开发,基于Serverless 架构。A front-end and back-end integrated deployment tool. One-click deploy to serverless architecture. https://docs.cloudbase.net/framework/index
JavaScript
1,937
star
62

soter

A secure and quick biometric authentication standard and platform in Android held by Tencent.
Java
1,928
star
63

phxqueue

A high-availability, high-throughput and highly reliable distributed queue based on the Paxos algorithm.
C++
1,899
star
64

plato

腾讯高性能分布式图计算框架Plato
C++
1,895
star
65

MedicalNet

Many studies have shown that the performance on deep learning is significantly affected by volume of training data. The MedicalNet project provides a series of 3D-ResNet pre-trained models and relative code.
Python
1,888
star
66

NeuralNLP-NeuralClassifier

An Open-source Neural Hierarchical Multi-label Text Classification Toolkit
Python
1,834
star
67

TSW

Tencent Server Web
TypeScript
1,804
star
68

sluaunreal

lua dev plugin for unreal engine 4 or 5
C++
1,780
star
69

QMUI_Web

An efficient front-end framework for developers building UI on the web.
JavaScript
1,719
star
70

Metis

Metis is a learnware platform in the field of AIOps.
Python
1,690
star
71

Biny

Biny is a tiny, high-performance PHP framework for web applications
PHP
1,687
star
72

paxosstore

PaxosStore has been deployed in WeChat production for more than two years, providing storage services for the core businesses of WeChat backend. Now PaxosStore is running on thousands of machines, and is able to afford billions of peak TPS.
C++
1,675
star
73

CodeAnalysis

Static Code Analysis - 静态代码分析
Python
1,639
star
74

MimicMotion

High-Quality Human Motion Video Generation with Confidence-aware Pose Guidance
Python
1,475
star
75

TurboTransformers

a fast and user-friendly runtime for transformer inference (Bert, Albert, GPT2, Decoders, etc) on CPU and GPU.
C++
1,464
star
76

tdesign-vue-next

A Vue3.x UI components lib for TDesign.
TypeScript
1,434
star
77

TencentOS-kernel

腾讯针对云的场景研发的服务器操作系统
1,408
star
78

TBase

TBase is an enterprise-level distributed HTAP database. Through a single database cluster to provide users with highly consistent distributed database services and high-performance data warehouse services, a set of integrated enterprise-level solutions is formed.
C
1,383
star
79

WeDemo

WeDemo为微信团队开源项目,用于帮助微信开发者完成微信登录、微信分享等功能的接入和开发。开发者可参考源代码完成开发,也可以直接将代码应用到自己的App开发中,安全、便捷地在App中实现微信分享、微信登录功能。
Objective-C
1,374
star
80

feflow

🚀 A command line tool aims to improve front-end engineer workflow and standard, powered by TypeScript.
TypeScript
1,360
star
81

GAutomator

Automation for mobile games
Objective-C
1,331
star
82

flare

Flare是广泛投产于腾讯广告后台的现代化C++开发框架,包含了基础库、RPC、各种客户端等。主要特点为易用性强、长尾延迟低。
C++
1,308
star
83

TFace

A trusty face analysis research platform developed by Tencent Youtu Lab
Python
1,306
star
84

LuaPanda

lua debug and code tools for VS Code
Lua
1,235
star
85

FeatherCNN

FeatherCNN is a high performance inference engine for convolutional neural networks.
C++
1,208
star
86

tdesign-miniprogram

A Wechat MiniProgram UI components lib for TDesign.
HTML
1,204
star
87

tquic

A high-performance, lightweight, and cross-platform QUIC library
Rust
1,086
star
88

tgfx

A lightweight 2D graphics library for rendering texts, geometries, and images with high-performance APIs that work across various platforms.
C++
1,057
star
89

TencentPretrain

Tencent Pre-training framework in PyTorch & Pre-trained Model Zoo
Python
1,005
star
90

RapidView

RapidView is an android ui and lightapp development framework
Java
979
star
91

hel

A module federation SDK which is unrelated to tool chain for module consumer. 工具链无关的运行时模块联邦sdk.
JavaScript
959
star
92

TencentKona-8

Tencent Kona is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-term support(LTS) with quarterly updates. Tencent Kona serves as the default JDK internally at Tencent Cloud for cloud computing and other Java applications.
Java
942
star
93

FAutoTest

A UI automated testing framework for H5 and applets
Python
932
star
94

tdesign-vue

A Vue.js UI components lib for TDesign.
TypeScript
914
star
95

Pebble

Pebble分布式开发框架
C++
866
star
96

mxflutter

使用 TypeScript/JavaScript 来开发 Flutter 应用的框架。
Dart
857
star
97

Face2FaceTranslator

面对面翻译小程序是微信团队针对面对面沟通的场景开发的流式语音翻译小程序,通过微信同声传译插件提供了语音识别,文本翻译等功能。
JavaScript
836
star
98

tdesign-react

A React UI components lib for TDesign.
TypeScript
821
star
99

LightDiffusionFlow

This extension is developed for AUTOMATIC1111's Stable Diffusion web UI that provides import/export options for parameters.
JavaScript
798
star
100

Real-SR

Real-World Super-Resolution via Kernel Estimation and Noise Injection
Python
769
star