diff --git a/CHANGELOG-en.md b/CHANGELOG-en.md index 6743908..8e5699d 100644 --- a/CHANGELOG-en.md +++ b/CHANGELOG-en.md @@ -1,5 +1,8 @@ # Change Log +### v3.7.0: + Client: Added `--cut-left/--cut-right` parameters to adjust the offset of the body according to the special environment (such as Confluence) + ### v3.6.0: Server: aspx/ashx added support for intranet forwarding function (reference -r) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8763497..a5d2e2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +### v3.7.0: + Client: 新增 `--cut-left/--cut-right` 参数,可根据特殊环境进行调整body的偏移 (如Confluence) + ### v3.6.0: Server: aspx/ashx 新增支持内网转发功能 (参考 -r) diff --git a/README-en.md b/README-en.md index d2f1043..b2767c9 100644 --- a/README-en.md +++ b/README-en.md @@ -13,7 +13,7 @@ ## Version -3.6.0 - [Change Log](CHANGELOG-en.md) +3.7.0 - [Change Log](CHANGELOG-en.md) ## Features @@ -130,9 +130,10 @@ $ python neoreg.py generate -h # Connection server $ python neoreg.py -h usage: neoreg.py [-h] -u URI [-r URL] [-t IP:PORT] -k KEY [-l IP] [-p PORT] - [-s] [-H LINE] [-c LINE] [-x LINE] [--local-dns] - [--read-buff KB] [--read-interval MS] [--write-interval MS] - [--max-threads N] [-v] + [-s] [-H LINE] [-c LINE] [-x LINE] [--php-connect-timeout S] + [--local-dns] [--read-buff KB] [--read-interval MS] + [--write-interval MS] [--max-threads N] [--cut-left N] + [--cut-right N] [-v] Socks server for Neoreg HTTP(s) tunneller. DEBUG MODE: -k (debug_all|debug_base64|debug_headers_key|debug_headers_values) @@ -158,12 +159,16 @@ $ python neoreg.py -h Custom init cookies -x LINE, --proxy LINE Proto://host[:port] Use proxy on given port + --php-connect-timeout S + PHP connect timeout.(default: 0.5) --local-dns Use local resolution DNS --read-buff KB Local read buffer, max data to be sent per POST.(default: 7, max: 50) --read-interval MS Read data interval in milliseconds.(default: 300) --write-interval MS Write data interval in milliseconds.(default: 200) --max-threads N Proxy max threads.(default: 1000) + --cut-left N Truncate the left side of the response body + --cut-right N Truncate the right side of the response body -v Increase verbosity level (use -vv or more for greater effect) ``` diff --git a/README.md b/README.md index 8f4e0eb..cfe749a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## Version -3.6.0 - [版本修改日志](CHANGELOG.md) +3.7.0 - [版本修改日志](CHANGELOG.md) @@ -132,9 +132,10 @@ $ python neoreg.py generate -h # 连接服务端 $ python neoreg.py -h usage: neoreg.py [-h] -u URI [-r URL] [-t IP:PORT] -k KEY [-l IP] [-p PORT] - [-s] [-H LINE] [-c LINE] [-x LINE] [--local-dns] - [--read-buff KB] [--read-interval MS] [--write-interval MS] - [--max-threads N] [-v] + [-s] [-H LINE] [-c LINE] [-x LINE] [--php-connect-timeout S] + [--local-dns] [--read-buff KB] [--read-interval MS] + [--write-interval MS] [--max-threads N] [--cut-left N] + [--cut-right N] [-v] Socks server for Neoreg HTTP(s) tunneller. DEBUG MODE: -k (debug_all|debug_base64|debug_headers_key|debug_headers_values) @@ -160,12 +161,16 @@ $ python neoreg.py -h Custom init cookies -x LINE, --proxy LINE Proto://host[:port] Use proxy on given port + --php-connect-timeout S + PHP connect timeout.(default: 0.5) --local-dns Use local resolution DNS --read-buff KB Local read buffer, max data to be sent per POST.(default: 7, max: 50) --read-interval MS Read data interval in milliseconds.(default: 300) --write-interval MS Write data interval in milliseconds.(default: 200) --max-threads N Proxy max threads.(default: 1000) + --cut-left N Truncate the left side of the response body + --cut-right N Truncate the right side of the response body -v Increase verbosity level (use -vv or more for greater effect) ``` diff --git a/neoreg.py b/neoreg.py index 326e5e0..233d885 100755 --- a/neoreg.py +++ b/neoreg.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- __author__ = 'L' -__version__ = '3.6.0' +__version__ = '3.7.0' import sys import os @@ -371,6 +371,10 @@ def reader(self): status = rep_headers[K["X-STATUS"]] if status == V["OK"]: data = response.content + if args.cut_left > 0: + data = data[args.cut_left:] + if args.cut_right > 0: + data = data[:-args.cut_right] if len(data) == 0: sleep(READINTERVAL) continue @@ -517,7 +521,13 @@ def askGeorg(conn, connectURLs, redirectURLs): if redirectURLs and response.status_code >= 400: log.warning('Using redirection will affect performance when the response code >= 400') - if BASICCHECKSTRING == response.content.strip(): + data = response.content + if args.cut_left > 0: + data = data[args.cut_left:] + if args.cut_right > 0: + data = data[:-args.cut_right] + + if BASICCHECKSTRING == data.strip(): log.info("Georg says, 'All seems fine'") return True else: @@ -532,7 +542,7 @@ def askGeorg(conn, connectURLs, redirectURLs): log.error("Georg is not ready. Error message: %s" % message) else: log.warning('Expect Response: {}'.format(BASICCHECKSTRING[0:100])) - log.warning('Real Response: {}'.format(response.content.strip()[0:100])) + log.warning('Real Response: {}'.format(data.strip()[0:100])) log.error("Georg is not ready, please check URL and KEY. rep: [{}] {}".format(response.status_code, response.reason)) log.error("You can set the `--skip` parameter to ignore errors") exit() @@ -644,6 +654,8 @@ def file_write(filename, data): parser.add_argument("--read-interval", metavar="MS", help="Read data interval in milliseconds.(default: {})".format(READINTERVAL), type=int, default=READINTERVAL) parser.add_argument("--write-interval", metavar="MS", help="Write data interval in milliseconds.(default: {})".format(WRITEINTERVAL), type=int, default=WRITEINTERVAL) parser.add_argument("--max-threads", metavar="N", help="Proxy max threads.(default: 1000)", type=int, default=MAXTHERADS) + parser.add_argument("--cut-left", metavar="N", help="Truncate the left side of the response body", type=int, default=0) + parser.add_argument("--cut-right", metavar="N", help="Truncate the right side of the response body", type=int, default=0) parser.add_argument("-v", help="Increase verbosity level (use -vv or more for greater effect)", action='count', default=0) args = parser.parse_args()