From 797024c209c4198b4f827a5e516e3aaebadc3a5f Mon Sep 17 00:00:00 2001 From: L Date: Tue, 16 Jan 2024 14:37:36 +0800 Subject: [PATCH] add --php && release v5.2.0 --- CHANGELOG-en.md | 4 ++++ CHANGELOG.md | 4 ++++ README-en.md | 3 ++- README.md | 5 +++-- neoreg.py | 11 +++++++---- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG-en.md b/CHANGELOG-en.md index 9151e19..1090018 100644 --- a/CHANGELOG-en.md +++ b/CHANGELOG-en.md @@ -1,5 +1,9 @@ # Change Log +### v5.2.0: +##### New Features + 1. Added `--php` parameter. By default, it is judged based on the URL set by --url whether the .php suffix uses the PHP connection method. In special cases, you can manually use --php to specify the PHP connection method. + ### v5.1.0: ##### New Features 1. Add `--request-template` parameter to set request template to avoid traffic detection diff --git a/CHANGELOG.md b/CHANGELOG.md index 37bdf63..ecc2d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +### v5.2.0: +##### 新特征 + 1. 新增 `--php` 参数,默认根据 --url 设置的 URL 判断是否 .php 后缀使用 PHP 连接方式,特殊情况下可手工使用 --php 指定为 PHP 的连接方式 + ### v5.1.0: ##### 新特征 1. 新增 `--request-template` 参数,用于设置请求模板,规避流量检测 diff --git a/README-en.md b/README-en.md index 3c2c10a..99f31c3 100644 --- a/README-en.md +++ b/README-en.md @@ -137,7 +137,7 @@ $ python neoreg.py generate -h # Connection server usage: neoreg.py [-h] -u URI [-r URL] [-R] [-t IP:PORT] -k KEY [-l IP] [-p PORT] [-s] [-H LINE] [-c LINE] [-x LINE] - [--php-connect-timeout S] [--local-dns] [--read-buff KB] + [--php] [--php-connect-timeout S] [--local-dns] [--read-buff KB] [--read-interval MS] [--write-interval MS] [--max-threads N] [--max-retry N] [--cut-left N] [--cut-right N] [--extract EXPR] [-v] @@ -169,6 +169,7 @@ $ python neoreg.py generate -h -T STR/FILE, --request-template STR/FILE HTTP request template (eg: 'img=data:image/png;base64,NEOREGBODY&save=ok') + --php Use php connection method --php-connect-timeout S PHP connect timeout (default: 0.5) --local-dns Use local resolution DNS diff --git a/README.md b/README.md index f70464f..9a25f94 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## Version -5.1.0 - [版本修改日志](CHANGELOG.md) +5.2.0 - [版本修改日志](CHANGELOG.md) ## Features @@ -139,7 +139,7 @@ $ python neoreg.py generate -h $ python neoreg.py -h usage: neoreg.py [-h] -u URI [-r URL] [-R] [-t IP:PORT] -k KEY [-l IP] [-p PORT] [-s] [-H LINE] [-c LINE] [-x LINE] - [--php-connect-timeout S] [--local-dns] [--read-buff KB] + [--php] [--php-connect-timeout S] [--local-dns] [--read-buff KB] [--read-interval MS] [--write-interval MS] [--max-threads N] [--max-retry N] [--cut-left N] [--cut-right N] [--extract EXPR] [-v] @@ -171,6 +171,7 @@ $ python neoreg.py -h -T STR/FILE, --request-template STR/FILE HTTP request template (eg: 'img=data:image/png;base64,NEOREGBODY&save=ok') + --php Use php connection method --php-connect-timeout S PHP connect timeout (default: 0.5) --local-dns Use local resolution DNS diff --git a/neoreg.py b/neoreg.py index 34b68b5..e413cdc 100755 --- a/neoreg.py +++ b/neoreg.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- __author__ = 'L' -__version__ = '5.1.0' +__version__ = '5.2.0' import sys import os @@ -49,6 +49,7 @@ MAXRETRY = 10 READINTERVAL = 300 WRITEINTERVAL = 200 +PHPSERVER = False PHPTIMEOUT = 0.5 # Logging @@ -459,7 +460,7 @@ def setupRemoteSession(self, target, port): info = {'CMD': 'CONNECT', 'MARK': self.mark, 'IP': self.target, 'PORT': str(self.port)} - if '.php' in self.connectURLs[0]: + if '.php' in self.connectURLs[0] or PHPSERVER: try: rinfo = self.neoreg_request(info, timeout=PHPTIMEOUT) except: @@ -612,7 +613,7 @@ def askNeoGeorg(conn, connectURLs, redirectURLs, force_redirect): else: response = conn.get(connectURLs[0], headers=headers, timeout=10) log.debug("[HTTP] Ask NeoGeorg Response => HttpCode: {}".format(response.status_code)) - if '.php' in connectURLs[0]: + if '.php' in connectURLs[0] or PHPSERVER: if 'Expires' in response.headers: expires = response.headers['Expires'] try: @@ -775,6 +776,7 @@ def choice_useragent(): parser.add_argument("-c", "--cookie", metavar="LINE", help="Custom init cookies") parser.add_argument("-x", "--proxy", metavar="LINE", help="Proto://host[:port] Use proxy on given port", default=None) parser.add_argument("-T", "--request-template", metavar="STR/FILE", help="HTTP request template (eg: 'img=data:image/png;base64,NEOREGBODY&save=ok')", type=str) + parser.add_argument("--php", help="Use php connection method", action='store_true') parser.add_argument("--php-connect-timeout", metavar="S", help="PHP connect timeout (default: {})".format(PHPTIMEOUT), type=float, default=PHPTIMEOUT) parser.add_argument("--local-dns", help="Use local resolution DNS", action='store_true') parser.add_argument("--read-buff", metavar="KB", help="Local read buffer, max data to be sent per POST (default: {}, max: 50)".format(READBUFSIZE), type=int, default=READBUFSIZE) @@ -848,7 +850,8 @@ def choice_useragent(): print(separation) print(" Log Level set to [%s]" % LEVELNAME) - USERAGENT = choice_useragent() + USERAGENT = choice_useragent() + PHPSERVER = args.php PHPTIMEOUT = args.php_connect_timeout urls = args.url