add script

This commit is contained in:
lidehua 2018-08-09 22:19:05 +08:00
parent eee663fdfe
commit 8ec2636354
2 changed files with 41 additions and 1 deletions

View File

@ -373,4 +373,4 @@ c28uY29tCkBAfHxzb3NvLmNvbQpAQHx8dWx1YWkuY29tLmNuCkBAfHx3ZWliby5j
b20KQEB8fHlhaG9vLmNuCkBAfHx5b3VkYW8uY29tCkBAfHx6aG9uZ3NvdS5jb20K
QEB8aHR0cDovL2ltZS5iYWlkdS5qcAohIyMjIyMjIyMjIyMjIyMjI1doaXRlbGlz
dCBFbmQjIyMjIyMjIyMjIyMjIyMjIyMKIS0tLS0tLS0tLS0tLS0tLS0tLS0tLUVP
Ri0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCg==
Ri0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCg==

40
tobase64.py Normal file
View File

@ -0,0 +1,40 @@
#! /usr/bin/python
import base64
import sys
sl = len(sys.argv)
if sl == 1:
tag = 0
else:
tag = 1
print(tag)
if tag == 0:
print("encode")
fo = open("./gfwlist-raw.txt")
so = fo.read()
fo.close()
sb64 = base64.b64encode(so)
ft = open("./gfwlist-tiny.txt", "w")
i = 0;
for s in sb64 :
ft.write(s)
i = i + 1
if i % 64 == 0 :
ft.write("\n")
ft.close()
else:
print("decode")
fo = open("./gfwlist.txt")
s = base64.b64decode(fo.read())
fo.close()
ft = open("./gfwlist-temp.txt", "w")
ft.write(s)
ft.close()
print("done")