-
Notifications
You must be signed in to change notification settings - Fork 77
173 lines (136 loc) · 7.44 KB
/
ruleUpdate.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Rule Provider
on:
schedule:
- cron: '0 20 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: rule providers
working-directory: ./rule_provider
run: |
echo "Downloading oisd full source list..."
curl -sSf -o oisd-full.txt https://big.oisd.nl/
python3 - <<EOF
import re
import yaml
with open("oisd-full.txt", "r") as file:
input_text = file.read()
title = re.search(r"! Title: (.+)", input_text).group(1)
last_modified = re.search(r"! Last modified: (.+)", input_text).group(1)
payload_lines = re.findall(r"\|\|(.+)\^", input_text)
payload = [f"+.{line}" for line in payload_lines]
data = {
"# Title": title,
"# Last modified": last_modified,
"payload": payload
}
yaml_output = yaml.dump(data, sort_keys=False)
formatted_yaml = re.sub(r"(?<!# )(\w+):", r"# \1:", yaml_output)
with open("rule_basicads.yaml", "w") as file:
file.write(formatted_yaml)
EOF
sed -i 's|# payload:|payload:|' rule_basicads.yaml
rm oisd-full.txt
echo "Downloading oisd nsfw source list..."
curl -s https://nsfw.oisd.nl -o rule_nsfw.yaml
sed -i 's/||\(.*\)\^/ - "+.\1"/' rule_nsfw.yaml
sed -i '1,8 s/\[\|\]\|!\{1,\}//g' rule_nsfw.yaml
#end word
sed -i '1,8 s/^/#/' rule_nsfw.yaml
sed -i '9s/^/payload: /' rule_nsfw.yaml
rm -fr rule_nsfw.yamle
echo "Downloading Malicious Sites source list..."
curl -s https://raw.githubusercontent.com/elliotwutingfeng/Inversion-DNSBL-Blocklists/main/Google_hostnames.txt -o rule_malicious.yaml
(echo "#payload:" && cat rule_malicious.yaml) > rule_malicious.tmp
mv rule_malicious.tmp rule_malicious.yaml
#start word
sed -ie '/^#/! s/^/- "/' rule_malicious.yaml
#end word
sed -ie '/^#/! s/$/"/' rule_malicious.yaml
sed -i 's|#payload:|payload:|' rule_malicious.yaml
rm -fr rule_malicious.yamle
echo "Downloading Malicious IP Addresses source list..."
curl -s https://raw.githubusercontent.com/elliotwutingfeng/Inversion-DNSBL-Blocklists/main/Google_ipv4.txt -o rule_maliciousip.yaml
(echo "#payload:" && cat rule_maliciousip.yaml) > rule_maliciousip.tmp
mv rule_maliciousip.tmp rule_maliciousip.yaml
#start word
sed -ie '/^#/! s/^/- "/' rule_maliciousip.yaml
#end word
sed -ie '/^#/! s/$/\/32"/' rule_maliciousip.yaml
sed -i 's|#payload:|payload:|' rule_maliciousip.yaml
rm -fr rule_maliciousip.yamle
echo "Downloading Discord source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Discord/Discord.yaml -o rule_discord.yaml
rm -fr rule_discord.yamle
echo "Downloading rule_hijacking source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Hijacking/Hijacking.yaml -o rule_hijacking.yaml
rm -fr rule_hijacking.yamle
echo "Downloading rule_privacy source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Privacy/Privacy_Classical.yaml -o rule_privacy.yaml
rm -fr rule_privacy.yamle
echo "Downloading rule_porn source list..."
curl -s https://rules.kr328.app/category-porn.yaml -o rule_porn.yaml
rm -fr rule_porn.yamle
echo "Downloading rule_lancidr source list..."
curl -s https://fastly.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt -o rule_lancidr.yaml
rm -fr rule_lancidr.yamle
echo "Downloading rule_telegramcidr source list..."
curl -s https://fastly.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt -o rule_telegramcidr.yaml
rm -fr rule_telegramcidr.yamle
echo "Downloading rule_telegram source list..."
curl -s https://rules.kr328.app/telegram.yaml -o rule_telegram.yaml
rm -fr rule_telegram.yamle
echo "Downloading rule_disneyplus source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Disney/Disney.yaml -o rule_disneyplus.yaml
rm -fr rule_disneyplus.yamle
echo "Downloading rule_games source list..."
curl -s https://rules.kr328.app/category-games.yaml -o rule_games.yaml
rm -fr rule_games.yamle
echo "Downloading rule_hbo source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/HBO/HBO.yaml -o rule_hbo.yaml
rm -fr rule_hbo.yamle
echo "Downloading rule_hboasia source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/HBOAsia/HBOAsia.yaml -o rule_hboasia.yaml
rm -fr rule_hboasia.yamle
echo "Downloading rule_hbohk source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/HBOHK/HBOHK.yaml -o rule_hbohk.yaml
rm -fr rule_hbohk.yamle
echo "Downloading rule_hbousa source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/HBOUSA/HBOUSA.yaml -o rule_hbousa.yaml
rm -fr rule_hbousa.yamle
echo "Downloading rule_iqiyi source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/iQIYI/iQIYI.yaml -o rule_iqiyi.yaml
rm -fr rule_iqiyi.yamle
echo "Downloading rule_iqiyiinter source list..."
curl -s https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/iQIYIIntl/iQIYIIntl.yaml -o rule_iqiyiinter.yaml
rm -fr rule_iqiyiinter.yamle
echo "Downloading rule_line source list..."
curl -s https://rules.kr328.app/line.yaml -o rule_line.yaml
rm -fr rule_line.yamle
echo "Downloading rule_metaverse source list..."
curl -s https://rules.kr328.app/facebook.yaml -o rule_metaverse.yaml
rm -fr rule_metaverse.yamle
echo "Downloading rule_netflix source list..."
curl -s https://rules.kr328.app/netflix.yaml -o rule_netflix.yaml
rm -fr rule_netflix.yamle
echo "Downloading rule_primevideo source list..."
curl -s https://rules.kr328.app/primevideo.yaml -o rule_primevideo.yaml
rm -fr rule_primevideo.yamle
echo "Downloading rule_tiktok source list..."
curl -s https://rules.kr328.app/tiktok.yaml -o rule_tiktok.yaml
rm -fr rule_tiktok.yamle
echo "Downloading rule_twitch source list..."
curl -s https://rules.kr328.app/twitch.yaml -o rule_twitch.yaml
rm -fr rule_twitch.yamle
echo "Downloading rule_twitter source list..."
curl -s https://rules.kr328.app/twitter.yaml -o rule_twitter.yaml
rm -fr rule_twitter.yamle
echo "Downloading rule_youtube source list..."
curl -s https://rules.kr328.app/youtube.yaml -o rule_youtube.yaml
rm -fr rule_youtube.yamle
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automatic update Rule Provider Clash