diff --git a/README.md b/README.md index 50a9628..2498002 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ iOS美版香港AppStore下载地址或直接搜ProxyPin(推荐):https://apps.a iOS国内下载地址(有1万名额限制,满了会清理不使用的用户): https://testflight.apple.com/join/gURGH6B4 +TG: https://t.me/proxypin_tg + - [ ] 接下来会持续完善功能和体验,请求重写功能增强、模拟慢请求、请求debug, UI优化。 - [ ] 支持安卓微信小程序抓包,安卓分为系统证书和用户证书,下载的自签名根证书安装都是用户证书,微信不信任用户证书,不Root导致Https抓不了了, 目前市场上所有抓包软件抓不了微信的包,后面单独做个运行空间插件,动态反编译修改配置,信任用户证书来解决。 - [ ] WebSocket、HTTP2协议支持。 diff --git a/lib/main.dart b/lib/main.dart index 7501f99..2f854ee 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -138,27 +138,33 @@ class _DesktopHomePagePageState extends State implements EventL panel = NetworkTabController(tabStyle: const TextStyle(fontSize: 18), proxyServer: proxyServer); if (widget.configuration.guide) { - //首次引导 - showDialog( - context: context, - barrierDismissible: false, - builder: (_) { - return AlertDialog( - actions: [ - TextButton( - onPressed: () { - widget.configuration.guide = false; - widget.configuration.flushConfig(); - Navigator.pop(context); - }, - child: const Text('关闭')) - ], - title: const Text('提示', style: TextStyle(fontSize: 18)), - content: const Text('默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n' - '点击的HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。')); - }); - - return; + WidgetsBinding.instance.addPostFrameCallback((_) { + //首次引导 + showDialog( + context: context, + barrierDismissible: false, + builder: (_) { + return AlertDialog( + actions: [ + TextButton( + onPressed: () { + widget.configuration.guide = false; + widget.configuration.flushConfig(); + Navigator.pop(context); + }, + child: const Text('关闭')) + ], + title: const Text('提示', style: TextStyle(fontSize: 18)), + content: const Text( + '默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n' + '点击的HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。\n\n' + '新增更新:\n' + '1. 增加高级搜索,点击搜索Icon触发。\n' + '2. 显示SSL握手异常、建立连接异常、未知异常等请求。\n' + '3.响应体大时异步加载json,请求重写增加域名,修复手机扫码连接未开启代理时不转发问题', + style: TextStyle(fontSize: 14))); + }); + }); } } diff --git a/lib/network/http/codec.dart b/lib/network/http/codec.dart index 9a62feb..193e732 100644 --- a/lib/network/http/codec.dart +++ b/lib/network/http/codec.dart @@ -20,7 +20,6 @@ import 'dart:typed_data'; import 'package:network_proxy/network/http/body_reader.dart'; import '../../utils/compress.dart'; -import '../util/logger.dart'; import 'http.dart'; import 'http_headers.dart'; diff --git a/lib/ui/desktop/left/domain.dart b/lib/ui/desktop/left/domain.dart index 98f84a4..70b80fe 100644 --- a/lib/ui/desktop/left/domain.dart +++ b/lib/ui/desktop/left/domain.dart @@ -10,7 +10,7 @@ import 'package:network_proxy/network/http/http.dart'; import 'package:network_proxy/network/util/attribute_keys.dart'; import 'package:network_proxy/network/util/host_filter.dart'; import 'package:network_proxy/ui/component/transition.dart'; -import 'package:network_proxy/ui/desktop/left/model/search.dart'; +import 'package:network_proxy/ui/desktop/left/model/search_model.dart'; import 'package:network_proxy/ui/desktop/left/path.dart'; import 'package:network_proxy/ui/content/panel.dart'; import 'package:network_proxy/ui/desktop/left/search.dart'; @@ -92,7 +92,7 @@ class DomainWidgetState extends State { headerBody.addBody(channel.id, listURI); //搜索视图 - if (searchModel?.isNotEmpty == true && headerBody.filter(listURI, searchModel!)) { + if (searchModel?.isNotEmpty == true && searchModel?.filter(request, null) == true) { searchView[hostAndPort]?.addBody(channel.id, listURI); } return; @@ -122,7 +122,7 @@ class DomainWidgetState extends State { } //搜索视图 - if (searchModel?.isNotEmpty == true && headerBody?.filter(pathRow, searchModel!) == true) { + if (searchModel?.isNotEmpty == true && searchModel?.filter(pathRow.request, response) == true) { var header = searchView[hostAndPort]; if (header?.getBody(channel.id) == null) { header?.addBody(channel.id, pathRow); @@ -175,7 +175,7 @@ class HeaderBody extends StatefulWidget { ///根据文本过滤 Iterable search(SearchModel searchModel) { - return _body.where((element) => filter(element, searchModel)); + return _body.where((element) => searchModel.filter(element.request, element.response.get())); } ///复制 @@ -203,68 +203,6 @@ class HeaderBody extends StatefulWidget { State createState() { return _HeaderBodyState(); } - - bool filter(PathRow element, SearchModel searchModel) { - var request = element.request; - var response = element.response.get(); - - if (searchModel.requestMethod != null && searchModel.requestMethod != request.method) { - return false; - } - if (searchModel.requestContentType != null && request.contentType != searchModel.requestContentType) { - return false; - } - - if (searchModel.responseContentType != null && response?.contentType != searchModel.responseContentType) { - return false; - } - if (searchModel.statusCode != null && response?.status.code != searchModel.statusCode) { - return false; - } - - if (searchModel.keyword == null || searchModel.keyword?.isEmpty == true || searchModel.searchOptions.isEmpty) { - return true; - } - - for (var option in searchModel.searchOptions) { - if (keywordFilter(searchModel.keyword!, option, request, response)) { - return true; - } - } - - return false; - } - - bool keywordFilter(String keyword, Option option, HttpRequest request, HttpResponse? response) { - if (option == Option.url && request.uri.toString().toLowerCase().contains(keyword.toLowerCase())) { - return true; - } - - if (option == Option.requestBody && request.bodyAsString.contains(keyword) == true) { - return true; - } - if (option == Option.responseBody && response?.bodyAsString.contains(keyword) == true) { - return true; - } - if (option == Option.method && request.method.name.toLowerCase() == keyword.toLowerCase()) { - return true; - } - if (option == Option.responseContentType && response?.headers.contentType.contains(keyword) == true) { - return true; - } - - if (option == Option.requestHeader || option == Option.responseHeader) { - print(response?.headers.entries); - var entries = option == Option.requestHeader ? request.headers.entries : response?.headers.entries ?? []; - - for (var entry in entries) { - if (entry.value.any((element) => element.contains(keyword))) { - return true; - } - } - } - return false; - } } class _HeaderBodyState extends State { diff --git a/lib/ui/desktop/left/model/search.dart b/lib/ui/desktop/left/model/search.dart deleted file mode 100644 index e9d8acf..0000000 --- a/lib/ui/desktop/left/model/search.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:network_proxy/network/http/http.dart'; - -/// @author wanghongen -/// 2023/8/4 -class SearchModel { - String? keyword; - - //搜索范围 - Set