-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathssr-python3.py
28 lines (26 loc) · 922 Bytes
/
ssr-python3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: UTF-8 -*-
import base64, requests, os
root_dir = os.path.dirname(os.path.abspath(__file__))
path = root_dir+'/ssr.txt'
res = root_dir+'/ssr'
group = '左手zuoshou'
group = base64.urlsafe_b64encode(group.encode()).decode().strip('=')
try:
with open(path,'r') as f:
txt = f.read()
txt = txt.strip().split('\n')
yy = []
for i in txt:
j = i.split('ssr://')[1]
j = j.strip()
data = base64.urlsafe_b64decode((j + '=' * (-len(j) % 4)).encode()).decode()
data2 = base64.urlsafe_b64encode((data.split('group=')[0]+'group='+group).encode()).decode()
data = 'ssr://'+data2.strip('=')
yy.append(data)
d = '\n'.join(yy)
d = (base64.b64encode(d.encode()).decode()).strip('=')
print (d)
with open(res,'w+') as ff:
ff.writelines(d)
except Exception as e:
print (e)