-
Notifications
You must be signed in to change notification settings - Fork 77
234 lines (178 loc) · 9.4 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Rule Provider
on:
schedule:
- cron: '0 20 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pandas tldextract pyyaml openpyxl
- 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()
payload_lines = re.findall(r"\|\|(.+)\^", input_text)
payload = [f'"+.{line}"' for line in payload_lines]
data = {
"payload": payload
}
yaml_output = yaml.dump(data, sort_keys=False, default_flow_style=False)
formatted_yaml = re.sub(r"(\s+-) '(.+)'", r"\1 \2", yaml_output)
with open("rule_basicads.yaml", "w") as file:
file.write(formatted_yaml)
EOF
rm oisd-full.txt
echo "Downloading oisd nsfw source list..."
curl -sSf -o oisd-nsfw.txt https://nsfw.oisd.nl
python3 - <<EOF
import re
import yaml
with open("oisd-nsfw.txt", "r") as file:
input_text = file.read()
payload_lines = re.findall(r"\|\|(.+)\^", input_text)
payload = [f'"+.{line}"' for line in payload_lines]
data = {
"payload": payload
}
yaml_output = yaml.dump(data, sort_keys=False, default_flow_style=False)
formatted_yaml = re.sub(r"(\s+-) '(.+)'", r"\1 \2", yaml_output)
with open("rule_nsfw.yaml", "w") as file:
file.write(formatted_yaml)
EOF
rm oisd-nsfw.txt
echo "Downloading Bank-ID source list"
python3 - <<EOF
import pandas as pd
import tldextract
import yaml
import re
excel_url = "https://ojk.go.id/id/kanal/perbankan/data-dan-statistik/Documents/Pages/Daftar-Alamat-Kantor-Pusat-Bank-Umum-Dan-Syariah/Daftar%20Alamat%20Kantor%20Pusat%20Bank%20Umum%20Dan%20Syariah%20-%20Februari%202023.xlsx"
# Read the Excel file
df = pd.read_excel(excel_url)
# Extract valid domain TLDs
valid_tlds = []
for website in df["Website"].dropna():
domain = tldextract.extract(website).registered_domain
if domain:
valid_tlds.append(f'"+.{domain}"')
# Create the data dictionary
data = {"payload": valid_tlds}
# Convert the data to YAML format
yaml_output = yaml.dump(data, sort_keys=False)
formatted_yaml = re.sub(r"(\s+-) '(.+)'", r"\1 \2", yaml_output)
# Save the formatted YAML to a file
output_file = "rule_bank-id.yaml"
with open(output_file, "w") as file:
file.write(formatted_yaml)
EOF
echo "Downloading Malicious Sites source list..."
curl -sSf -o rule-malicious.txt https://raw.githubusercontent.com/elliotwutingfeng/Inversion-DNSBL-Blocklists/main/Google_hostnames_ABP.txt
python3 - <<EOF
import re
import yaml
with open("rule-malicious.txt", "r") as file:
input_text = file.read()
payload_lines = re.findall(r"\|\|(.+)\^", input_text)
payload = [f'"+.{line}"' for line in payload_lines]
data = {
"payload": payload
}
yaml_output = yaml.dump(data, sort_keys=False, default_flow_style=False)
formatted_yaml = re.sub(r"(\s+-) '(.+)'", r"\1 \2", yaml_output)
with open("rule_malicious.yaml", "w") as file:
file.write(formatted_yaml)
EOF
rm rule-malicious.txt
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