Skip to content

Commit

Permalink
add --php && release v5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
L-codes committed Jan 16, 2024
1 parent 015c557 commit 797024c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-en.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

### v5.2.0:
##### 新特征
1. 新增 `--php` 参数,默认根据 --url 设置的 URL 判断是否 .php 后缀使用 PHP 连接方式,特殊情况下可手工使用 --php 指定为 PHP 的连接方式

### v5.1.0:
##### 新特征
1. 新增 `--request-template` 参数,用于设置请求模板,规避流量检测
Expand Down
3 changes: 2 additions & 1 deletion README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## Version

5.1.0 - [版本修改日志](CHANGELOG.md)
5.2.0 - [版本修改日志](CHANGELOG.md)


## Features
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions neoreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

__author__ = 'L'
__version__ = '5.1.0'
__version__ = '5.2.0'

import sys
import os
Expand Down Expand Up @@ -49,6 +49,7 @@
MAXRETRY = 10
READINTERVAL = 300
WRITEINTERVAL = 200
PHPSERVER = False
PHPTIMEOUT = 0.5

# Logging
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 797024c

Please sign in to comment.