Skip to content

Commit

Permalink
v1.02
Browse files Browse the repository at this point in the history
  • Loading branch information
PauperZ committed Oct 30, 2021
1 parent f5af071 commit b1e0a28
Show file tree
Hide file tree
Showing 28 changed files with 440 additions and 38 deletions.
Binary file modified __pycache__/config.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"remarks": "\u9999\u6e2fHKT3[x1|IEPL|NF|V2Ray]@480Mbps", "group": "N/A", "server": "br-gtm-iepl1.node-fnf.xyz", "server_port": 20110, "log": {"access": "", "error": "", "loglevel": "warning"}, "inbounds": [{"port": 1087, "listen": "127.0.0.1", "protocol": "socks", "sniffing": {"enabled": true, "destOverride": ["http", "tls"]}, "settings": {"auth": "noauth", "udp": true, "ip": null, "clients": null}, "streamSettings": null}], "outbounds": [{"tag": "proxy", "protocol": "vmess", "settings": {"vnext": [{"address": "br-gtm-iepl1.node-fnf.xyz", "port": 20110, "users": [{"id": "0eefa5b3-fe64-3319-ba6c-f4df1c2d9304", "alterId": 1, "email": "", "security": "auto"}]}], "servers": null, "response": null}, "streamSettings": {"network": "tcp", "security": "", "tlsSettings": {}, "tcpSettings": {}, "kcpSettings": {}, "wsSettings": {}, "httpSettings": {}, "quicSettings": {}}, "mux": {"enabled": true}}, {"tag": "direct", "protocol": "freedom", "settings": {"vnext": null, "servers": null, "response": null}, "streamSettings": {}, "mux": {}}, {"tag": "block", "protocol": "blackhole", "settings": {"vnext": null, "servers": null, "response": {"type": "http"}}, "streamSettings": {}, "mux": {}}], "dns": {}, "routing": {"domainStrategy": "IPIfNonMatch", "rules": []}}
{"server": "xrvn.rx140.xtonl.com", "server_port": 9944, "method": "aes-256-gcm", "protocol": "", "obfs": "", "plugin": "", "password": "5eb8b045-a2c8-4d72-8347-e43f5345e4d2", "protocol_param": "", "obfsparam": "", "plugin_opts": "", "plugin_args": "", "remarks": "\u7f8e\u56fd 07", "group": "Catnet", "timeout": 10, "local_port": 10870, "local_address": "127.0.0.1", "fastopen": false}
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import shutil
import json

__version__ = "1.01"
__version__ = "1.02"
__web_api_version__ = "0.5.2"

config = {
Expand Down
Binary file added drivers/chromedriver.exe
Binary file not shown.
Binary file added logos/Bahamut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/DisneyPlus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/HBO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/Netflix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/YouTube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/abema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logos/tvb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ aiohttp
aiohttp_socks
pynat
beautifulsoup4
selenium
Binary file added results/2021-10-30-14-59-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ssrspeed/client_launcher/__pycache__/client_v2ray.cpython-39.pyc
Binary file not shown.
Binary file modified ssrspeed/result/__pycache__/export_result.cpython-39.pyc
Binary file not shown.
137 changes: 120 additions & 17 deletions ssrspeed/result/export_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def __init__(self):
self.__hide_max_speed = config["exportResult"]["hide_max_speed"]
self.__hide_ntt = not config["ntt"]["enabled"]
self.__hide_netflix = not config["netflix"]
self.__hide_stream = not config["stream"]
self.__hide_stspeed = not config["StSpeed"]
self.__test_method = config["method"]
self.__colors = {}
self.__colorSpeedList = []
self.__font = ImageFont.truetype(self.__config["font"],18)
Expand Down Expand Up @@ -126,6 +128,21 @@ def __exportAsPng(self,result):
if (remarkWidth < 60):
remarkWidth = 90
otherWidth = 100

abema_logo = Image.open("./logos/abema.png")
abema_logo.thumbnail((28,28))
bahamut_logo = Image.open("./logos/Bahamut.png")
bahamut_logo.thumbnail((28,28))
disney_logo = Image.open("./logos/DisneyPlus.png")
disney_logo.thumbnail((28,28))
hbo_logo = Image.open("./logos/HBO.png")
hbo_logo.thumbnail((28,28))
netflix_logo = Image.open("./logos/Netflix.png")
netflix_logo.thumbnail((28,28))
tvb_logo = Image.open("./logos/tvb.png")
tvb_logo.thumbnail((28,28))
youtube_logo = Image.open("./logos/YouTube.png")
youtube_logo.thumbnail((28,28))

groupRightPosition = groupWidth
remarkRightPosition = groupRightPosition + remarkWidth
Expand All @@ -135,8 +152,6 @@ def __exportAsPng(self,result):
dspeedRightPosition = googlePingRightPosition + otherWidth
maxDSpeedRightPosition = dspeedRightPosition
imageRightPosition = dspeedRightPosition
ntt_right_position = imageRightPosition
netflix_right_position = imageRightPosition

if not self.__hide_max_speed:
imageRightPosition = maxDSpeedRightPosition + otherWidth
Expand All @@ -150,6 +165,10 @@ def __exportAsPng(self,result):
imageRightPosition = imageRightPosition + otherWidth + 60
netflix_right_position = imageRightPosition

if not self.__hide_stream:
imageRightPosition = imageRightPosition + otherWidth + 100
stream_right_position = imageRightPosition

newImageHeight = imageHeight + 30 * 3
resultImg = Image.new("RGB",(imageRightPosition, newImageHeight),(255,255,255))
draw = ImageDraw.Draw(resultImg)
Expand Down Expand Up @@ -179,7 +198,10 @@ def __exportAsPng(self,result):
draw.line((ntt_right_position, 30, ntt_right_position, imageHeight + 30 - 1),fill=(127,127,127),width=1)

if not self.__hide_netflix:
draw.line((netflix_right_position, 30, netflix_right_position, imageHeight + 30 - 1),fill=(127,127,127),width=1)
draw.line((netflix_right_position, 30, netflix_right_position, imageHeight + 30 - 1),fill=(127,127,127),width=1)

if not self.__hide_stream:
draw.line((stream_right_position, 30, stream_right_position, imageHeight + 30 - 1),fill=(127,127,127),width=1)

draw.line((imageRightPosition, 0, imageRightPosition, newImageHeight - 1),fill=(127,127,127),width=1)

Expand Down Expand Up @@ -222,20 +244,57 @@ def __exportAsPng(self,result):
)

if not self.__hide_stspeed:
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition, "单线程"), 30 + 4
),
"单线程", font=resultFont, fill=(0,0,0)
)
if(self.__test_method == "NETFLIX"):
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition,"EndSpeed"),
30 + 4
),
"EndSpeed", font=resultFont, fill=(0, 0, 0)
)
elif (self.__test_method == "YOUTUBE"):
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition,
"StSpeed"),
30 + 4
),
"StSpeed", font=resultFont, fill=(0, 0, 0)
)
else:
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition, "单线程"), 30 + 4
),
"单线程", font=resultFont, fill=(0,0,0)
)
else:
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition, "AvgSpeed"),
30 + 4
),
"AvgSpeed", font=resultFont, fill=(0, 0, 0)
)
if (self.__test_method == "NETFLIX"):
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition,
"EndSpeed"),
30 + 4
),
"EndSpeed", font=resultFont, fill=(0, 0, 0)
)
elif (self.__test_method == "YOUTUBE"):
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition,
"StSpeed"),
30 + 4
),
"StSpeed", font=resultFont, fill=(0, 0, 0)
)
else:
draw.text(
(
googlePingRightPosition + self.__getBasePos(dspeedRightPosition - googlePingRightPosition,"AvgSpeed"),
30 + 4
),
"AvgSpeed", font=resultFont, fill=(0, 0, 0)
)

if not self.__hide_max_speed:
if not self.__hide_stspeed:
Expand Down Expand Up @@ -268,7 +327,15 @@ def __exportAsPng(self,result):
ntt_right_position + self.__getBasePos(netflix_right_position - ntt_right_position, "Netfilx 解锁"), 30 + 4
),
"Netfilx 解锁", font=resultFont, fill=(0,0,0)
)
)

if not self.__hide_stream:
draw.text(
(
netflix_right_position + self.__getBasePos(stream_right_position - netflix_right_position, "流媒体解锁"), 30 + 4
),
"流媒体解锁", font=resultFont, fill=(0,0,0)
)
draw.line((0, 60, imageRightPosition - 1, 60),fill=(127,127,127),width=1)

totalTraffic = 0
Expand Down Expand Up @@ -334,6 +401,42 @@ def __exportAsPng(self,result):
netflix_type = item["Ntype"]
pos = ntt_right_position + self.__getBasePos(netflix_right_position - ntt_right_position, netflix_type)
draw.text((pos, 30 * j + 30 + 1), netflix_type,font=resultFont,fill=(0,0,0))

if not self.__hide_stream:
netflix_type = item["Ntype"]
hbo_type = item["Htype"]
disney_type = item["Dtype"]
youtube_type = item["Ytype"]
abema_type = item["Atype"]
bahamut_type = item["Btype"]
tvb_type = item["Ttype"]
if(netflix_type == "Full Native" or netflix_type == "Full DNS"):
n_type = True
else:
n_type = False
sums = n_type + hbo_type + disney_type + youtube_type + abema_type + bahamut_type + tvb_type
pos = netflix_right_position + (stream_right_position - netflix_right_position - sums * 35) / 2
if n_type:
resultImg.paste(netflix_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if hbo_type:
resultImg.paste(hbo_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if disney_type:
resultImg.paste(disney_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if youtube_type:
resultImg.paste(youtube_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if abema_type:
resultImg.paste(abema_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if bahamut_type:
resultImg.paste(bahamut_logo, (int(pos), 30 * j + 30 + 1))
pos += 35
if tvb_type:
resultImg.paste(tvb_logo, (int(pos), 30 * j + 30 + 1))
pos += 35

files = []
if (totalTraffic < 0):
Expand Down
Binary file modified ssrspeed/speed_test/__pycache__/speed_test.cpython-39.pyc
Binary file not shown.
146 changes: 145 additions & 1 deletion ssrspeed/speed_test/speed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@
PING_TEST = config["ping"]
GOOGLE_PING_TEST = config["gping"]
NETFLIX_TEXT = config["netflix"]
HBO_TEXT = config["hbo"]
DISNEY_TEXT = config["disney"]
YOUTUBE_TEXT = config["youtube"]
TVB_TEXT = config["tvb"]
ABEMA_TEXT = config["abema"]
BAHAMUT_TEXT = config["bahamut"]
ntype = "None"
htype = False
dtype = False
ytype = False
ttype = False
atype = False
btype = False

class SpeedTest(object):
def __init__(self, parser, method = "SOCKET", use_ssr_cs = False):
Expand Down Expand Up @@ -65,7 +77,13 @@ def __init__(self, parser, method = "SOCKET", use_ssr_cs = False):
"public_ip": "",
"public_port": 0
},
"Ntype": "N/A"
"Ntype": "N/A",
"Htype": False,
"Dtype": False,
"Ytype": False,
"Ttype": False,
"Atype": False,
"Btype": False,
}

def __getBaseResult(self):
Expand Down Expand Up @@ -176,6 +194,120 @@ def __geoIPOutbound(self):
except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if HBO_TEXT and outboundIP != "N/A":
logger.info("Performing HBO max test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global htype
r = requests.get("https://www.hbomax.com/", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, timeout=20, allow_redirects=False)

if (r.status_code == 200):
htype = True
else:
htype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if DISNEY_TEXT and outboundIP != "N/A":
logger.info("Performing Disney plus test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global dtype
r = requests.get("https://www.disneyplus.com/", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, timeout=20, allow_redirects=False)

if (r.status_code == 200):
dtype = True
else:
dtype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if YOUTUBE_TEXT and outboundIP != "N/A":
logger.info("Performing Youtube Premium test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global ytype
r = requests.get("https://music.youtube.com/", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, timeout=20, allow_redirects=False)

if (r.status_code == 200):
ytype = True
else:
ytype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if TVB_TEXT and outboundIP != "N/A":
logger.info("Performing TVB test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global ttype
r = requests.get("https://www.mytvsuper.com/iptest.php", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, timeout=20, allow_redirects=False)

if (r.text.count("HK") > 0):
ttype = True
else:
ttype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if ABEMA_TEXT and outboundIP != "N/A":
logger.info("Performing Abema test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global atype
r = requests.get("https://api.abema.io/v1/ip/check?device=android", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, timeout=20, allow_redirects=False)

if (r.text.count("Country") > 0):
atype = True
else:
atype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

if BAHAMUT_TEXT and outboundIP != "N/A":
logger.info("Performing Bahamut test LOCAL_PORT: {:d}.".format(LOCAL_PORT))
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36"}
global btype
r = requests.get("https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=14667", proxies={
"http": "socks5h://127.0.0.1:%d" % LOCAL_PORT,
"https": "socks5h://127.0.0.1:%d" % LOCAL_PORT
}, headers=headers, timeout=20, allow_redirects=False)

if (r.text.count("animeSn") > 0):
btype = True
else:
btype = False

except Exception as e:
logger.error('代理服务器连接异常:' + str(e.args))

return (outboundIP, outboundGeo, outboundInfo.get("country_code", "N/A"))

def __tcpPing(self, server, port):
Expand Down Expand Up @@ -374,9 +506,21 @@ def __start_test(self, test_mode = "FULL"):
logger.warn("Re-testing node.")
testRes = st.startTest(self.__testMethod)
global ntype
global htype
global dtype
global ytype
global ttype
global atype
global btype
_item["dspeed"] = testRes[0]
_item["maxDSpeed"] = testRes[1]
_item["Ntype"] = ntype
_item["Htype"] = htype
_item["Dtype"] = dtype
_item["Ytype"] = ytype
_item["Ttype"] = ttype
_item["Atype"] = atype
_item["Btype"] = btype
try:
_item["trafficUsed"] = testRes[3]
_item["rawSocketSpeed"] = testRes[2]
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit b1e0a28

Please sign in to comment.