# python_demo1 **Repository Path**: goldfish9901/python_demo1 ## Basic Information - **Project Name**: python_demo1 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-16 - **Last Updated**: 2025-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 小明想要在外面访问自己家里电脑的网站,用到了一个叫[内网穿透](https://www.bing.com/search?q=内网穿透)的技术 - 现在他忘记了自己哪个[端口](https://www.bing.com/search?q=网络端口)([知乎这篇可能更简单](https://zhuanlan.zhihu.com/p/225777212))对应的是哪个服务,但是日志太乱,需要筛选 - 现在我们知道了[文件和数据](./json_load/demo.json)怎么像[例子](./json_load/main.py)那样展开 - 日志在[cloudflared.log](./cloudflared.log) - 我们需要找到像这样的 ```log Dec 16 12:38:15 goldfish-ThinkPad-E450c cloudflared[2522660]: 2025-12-16T04:38:15Z INF Updated to new configuration config="{\"ingress\":[{\"hostname\":\"file.21729901.xyz\",\"originRequest\":{},\"service\":\"http://localhost:8600\"},{\"hostname\":\"chat.21729901.xyz\",\"originRequest\":{},\"service\":\"http://127.0.0.1:8090\"},{\"hostname\":\"static.21729901.xyz\",\"originRequest\":{},\"service\":\"http://localhost:8000\"},{\"hostname\":\"ssh.21729901.xyz\",\"originRequest\":{},\"service\":\"ssh://localhost:22\"},{\"hostname\":\"restdemo.21729901.xyz\",\"originRequest\":{},\"service\":\"http://localhost:8200\"},{\"hostname\":\"footviz.21729901.xyz\",\"originRequest\":{},\"service\":\"http://localhost:8300\"},{\"hostname\":\"registry.21729901.xyz\",\"originRequest\":{},\"service\":\"http://localhost:9000\"},{\"service\":\"http_status:404\"}],\"warp-routing\":{\"enabled\":false}}" version=32 ``` - 提取成 ```json { "ingress": [ { "hostname": "file.21729901.xyz", "originRequest": {}, "service": "http://localhost:8600" }, { "hostname": "chat.21729901.xyz", "originRequest": {}, "service": "http://127.0.0.1:8090" }, { "hostname": "static.21729901.xyz", "originRequest": {}, "service": "http://localhost:8000" }, { "hostname": "ssh.21729901.xyz", "originRequest": {}, "service": "ssh://localhost:22" }, { "hostname": "restdemo.21729901.xyz", "originRequest": {}, "service": "http://localhost:8200" }, { "hostname": "footviz.21729901.xyz", "originRequest": {}, "service": "http://localhost:8300" }, { "hostname": "registry.21729901.xyz", "originRequest": {}, "service": "http://localhost:9000" }, { "hostname": null, "originRequest": {}, "service": "http_status:404" } ], "warp-routing": { "enabled": false } } ``` - 例如 ``` "service": "http://localhost:9000" ``` 9000就是端口 ## 能帮他梳理一下吗 - 找出最晚的关系更新记录 - 如果可以 支持按时间段筛选 ## 还没运行过python文件? [windows快速安装python](https://apps.microsoft.com/search?query=python) 可以先试着跑一跑[示例代码](./json_load/main.py) * 文件资源管理器(Win+E)运行 - 运行前在[示例代码](./json_load/main.py)文件最后添加 ```python if __name__ == '__main__': main() ``` * 然后[选择python环境](./run/windows.png) - 图中还出现了[Visual Studio Code](https://apps.microsoft.com/detail/xp9khm4bk9fz7q?hl=en-US&gl=CN)和[PyCharm](https://www.jetbrains.com/pycharm/download/) - 需要进一步探索python的可以考虑安装 * 或者Windows+R 输入cmd ```shell python json_load/main.py ``` * 不想改动文件的可以试试这个 ```shell python -c "from json_load.main import main; main()" ```