Skip to content

Commit f0717a1

Browse files
committed
push v3.7.0
1 parent c3feaac commit f0717a1

File tree

5 files changed

+39
-11
lines changed

5 files changed

+39
-11
lines changed

CHANGELOG-en.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
### v3.7.0:
4+
Client: Added `--cut-left/--cut-right` parameters to adjust the offset of the body according to the special environment (such as Confluence)
5+
36
### v3.6.0:
47
Server: aspx/ashx added support for intranet forwarding function (reference -r)
58

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
### v3.7.0:
4+
Client: 新增 `--cut-left/--cut-right` 参数,可根据特殊环境进行调整body的偏移 (如Confluence)
5+
36
### v3.6.0:
47
Server: aspx/ashx 新增支持内网转发功能 (参考 -r)
58

README-en.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
## Version
1515

16-
3.6.0 - [Change Log](CHANGELOG-en.md)
16+
3.7.0 - [Change Log](CHANGELOG-en.md)
1717

1818

1919
## Features
@@ -130,9 +130,10 @@ $ python neoreg.py generate -h
130130
# Connection server
131131
$ python neoreg.py -h
132132
usage: neoreg.py [-h] -u URI [-r URL] [-t IP:PORT] -k KEY [-l IP] [-p PORT]
133-
[-s] [-H LINE] [-c LINE] [-x LINE] [--local-dns]
134-
[--read-buff KB] [--read-interval MS] [--write-interval MS]
135-
[--max-threads N] [-v]
133+
[-s] [-H LINE] [-c LINE] [-x LINE] [--php-connect-timeout S]
134+
[--local-dns] [--read-buff KB] [--read-interval MS]
135+
[--write-interval MS] [--max-threads N] [--cut-left N]
136+
[--cut-right N] [-v]
136137

137138
Socks server for Neoreg HTTP(s) tunneller. DEBUG MODE: -k
138139
(debug_all|debug_base64|debug_headers_key|debug_headers_values)
@@ -158,12 +159,16 @@ $ python neoreg.py -h
158159
Custom init cookies
159160
-x LINE, --proxy LINE
160161
Proto://host[:port] Use proxy on given port
162+
--php-connect-timeout S
163+
PHP connect timeout.(default: 0.5)
161164
--local-dns Use local resolution DNS
162165
--read-buff KB Local read buffer, max data to be sent per
163166
POST.(default: 7, max: 50)
164167
--read-interval MS Read data interval in milliseconds.(default: 300)
165168
--write-interval MS Write data interval in milliseconds.(default: 200)
166169
--max-threads N Proxy max threads.(default: 1000)
170+
--cut-left N Truncate the left side of the response body
171+
--cut-right N Truncate the right side of the response body
167172
-v Increase verbosity level (use -vv or more for greater
168173
effect)
169174
```

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## Version
1616

17-
3.6.0 - [版本修改日志](CHANGELOG.md)
17+
3.7.0 - [版本修改日志](CHANGELOG.md)
1818

1919

2020

@@ -132,9 +132,10 @@ $ python neoreg.py generate -h
132132
# 连接服务端
133133
$ python neoreg.py -h
134134
usage: neoreg.py [-h] -u URI [-r URL] [-t IP:PORT] -k KEY [-l IP] [-p PORT]
135-
[-s] [-H LINE] [-c LINE] [-x LINE] [--local-dns]
136-
[--read-buff KB] [--read-interval MS] [--write-interval MS]
137-
[--max-threads N] [-v]
135+
[-s] [-H LINE] [-c LINE] [-x LINE] [--php-connect-timeout S]
136+
[--local-dns] [--read-buff KB] [--read-interval MS]
137+
[--write-interval MS] [--max-threads N] [--cut-left N]
138+
[--cut-right N] [-v]
138139

139140
Socks server for Neoreg HTTP(s) tunneller. DEBUG MODE: -k
140141
(debug_all|debug_base64|debug_headers_key|debug_headers_values)
@@ -160,12 +161,16 @@ $ python neoreg.py -h
160161
Custom init cookies
161162
-x LINE, --proxy LINE
162163
Proto://host[:port] Use proxy on given port
164+
--php-connect-timeout S
165+
PHP connect timeout.(default: 0.5)
163166
--local-dns Use local resolution DNS
164167
--read-buff KB Local read buffer, max data to be sent per
165168
POST.(default: 7, max: 50)
166169
--read-interval MS Read data interval in milliseconds.(default: 300)
167170
--write-interval MS Write data interval in milliseconds.(default: 200)
168171
--max-threads N Proxy max threads.(default: 1000)
172+
--cut-left N Truncate the left side of the response body
173+
--cut-right N Truncate the right side of the response body
169174
-v Increase verbosity level (use -vv or more for greater
170175
effect)
171176
```

neoreg.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
__author__ = 'L'
5-
__version__ = '3.6.0'
5+
__version__ = '3.7.0'
66

77
import sys
88
import os
@@ -371,6 +371,10 @@ def reader(self):
371371
status = rep_headers[K["X-STATUS"]]
372372
if status == V["OK"]:
373373
data = response.content
374+
if args.cut_left > 0:
375+
data = data[args.cut_left:]
376+
if args.cut_right > 0:
377+
data = data[:-args.cut_right]
374378
if len(data) == 0:
375379
sleep(READINTERVAL)
376380
continue
@@ -517,7 +521,13 @@ def askGeorg(conn, connectURLs, redirectURLs):
517521
if redirectURLs and response.status_code >= 400:
518522
log.warning('Using redirection will affect performance when the response code >= 400')
519523

520-
if BASICCHECKSTRING == response.content.strip():
524+
data = response.content
525+
if args.cut_left > 0:
526+
data = data[args.cut_left:]
527+
if args.cut_right > 0:
528+
data = data[:-args.cut_right]
529+
530+
if BASICCHECKSTRING == data.strip():
521531
log.info("Georg says, 'All seems fine'")
522532
return True
523533
else:
@@ -532,7 +542,7 @@ def askGeorg(conn, connectURLs, redirectURLs):
532542
log.error("Georg is not ready. Error message: %s" % message)
533543
else:
534544
log.warning('Expect Response: {}'.format(BASICCHECKSTRING[0:100]))
535-
log.warning('Real Response: {}'.format(response.content.strip()[0:100]))
545+
log.warning('Real Response: {}'.format(data.strip()[0:100]))
536546
log.error("Georg is not ready, please check URL and KEY. rep: [{}] {}".format(response.status_code, response.reason))
537547
log.error("You can set the `--skip` parameter to ignore errors")
538548
exit()
@@ -644,6 +654,8 @@ def file_write(filename, data):
644654
parser.add_argument("--read-interval", metavar="MS", help="Read data interval in milliseconds.(default: {})".format(READINTERVAL), type=int, default=READINTERVAL)
645655
parser.add_argument("--write-interval", metavar="MS", help="Write data interval in milliseconds.(default: {})".format(WRITEINTERVAL), type=int, default=WRITEINTERVAL)
646656
parser.add_argument("--max-threads", metavar="N", help="Proxy max threads.(default: 1000)", type=int, default=MAXTHERADS)
657+
parser.add_argument("--cut-left", metavar="N", help="Truncate the left side of the response body", type=int, default=0)
658+
parser.add_argument("--cut-right", metavar="N", help="Truncate the right side of the response body", type=int, default=0)
647659
parser.add_argument("-v", help="Increase verbosity level (use -vv or more for greater effect)", action='count', default=0)
648660
args = parser.parse_args()
649661

0 commit comments

Comments
 (0)