forked from peasoft/NoMoreWalls
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathto_autochoose.py
More file actions
53 lines (41 loc) · 1.5 KB
/
Copy pathto_autochoose.py
File metadata and controls
53 lines (41 loc) · 1.5 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import re
config_file_meta = open("list.meta.yml")
content_lines = config_file_meta.readlines()
config_file_meta_autochoose = open("list.meta.autochoose.yml","w")
locations = ["- name: 🇯🇵 日本",
"- name: 🇺🇸 美国",
"- name: 🇭🇰 香港",
"- name: 🇨🇳 台湾",
"- name: 🇸🇬 新加坡",
"- name: 🇨🇦 加拿大",
"- name: 🇫🇷 法国",
"- name: 🇬🇧 英国",
"- name: 🇰🇷 韩国",
"- name: 🇩🇪 德国",
"- name: 🇨🇳 中国",
"- name: 🇷🇺 俄罗斯",]
rule_unchanged = True
for location in locations:
found_location=False
# print(location)
for i, line in enumerate(content_lines):
# print(line)
if location in line:
found_location = True
print("found ", location)
print(found_location)
continue
if found_location and "select" in line:
print("found \"select\"")
content_lines[i] = line.replace("select","url-test")
print(content_lines[i])
continue
if line.strip() == "rules:" and rule_unchanged:
print("yes")
content_lines.insert(i + 1, "- DOMAIN-KEYWORD,iclass30,DIRECT\n")
rule_unchanged = False
# else:
# continue
config_file_meta_autochoose.writelines(content_lines)
config_file_meta.close()
config_file_meta_autochoose.close()