Skip to content

Rule Provider

Rule Provider #521

Workflow file for this run

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