-
-
Notifications
You must be signed in to change notification settings - Fork 20
85 lines (77 loc) · 2.51 KB
/
create_host.yml
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
name: Build New Hosts File
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * *"
jobs:
build-hosts:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: setup git config
run: |
git config user.name "pantsufan"
git config user.email "joel28@protonmail.com"
- name: Remove old file
run: |
git rm hosts
git commit -m "Removed Host File"
git push origin master
- name: Set up environment
run: |
sudo apt-get update
sudo apt-get install -y php-cli curl
- name: Download converter.php
run: |
curl -o converter.php https://gist.githubusercontent.com/pantsufan/e4b8876154d1436d8b13743bb07f3a8a/raw/5a87050d72ce1392e829b8975aeb5e3776397b5c/converter.php
- name: Run Script
run: |
echo "Project Lite"
php converter.php
sed -i "1,6d" AdguardMobileAds.txt
sed -i "1,6d" OISD.txt
sed -i "1,6d" AdguardMobileSpyware.txt
echo "" >> OISD.txt
cat AdguardMobileSpyware.txt >> OISD.txt
echo "" >> OISD.txt
cat AdguardMobileAds.txt >> OISD.txt
rm AdguardMobileAds.txt
rm AdguardMobileSpyware.txt
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn-only/hosts
sed -i "1,32d" hosts
echo "" >> OISD.txt
cat hosts >> OISD.txt
rm hosts
mv OISD.txt hosts
awk '!seen[$0]++' hosts > hosts_filter
{
echo "# PROJECT LITE"
echo "# Generated by Kninja"
echo "# Blocked domains: $(cat hosts_filter | wc -l)"
echo "# Date: $(date)"
echo ""
echo "# BEGIN HEADER"
echo "127.0.0.1 localhost"
echo "255.255.255.255 broadcasthost"
echo "::1 localhost"
echo "::1 ip6-localhost ip6-loopback"
echo "fe00::0 ip6-localnet"
echo "ff00::0 ip6-mcastprefix"
echo "ff02::1 ip6-allnodes"
echo "ff02::2 ip6-allrouters"
echo "ff02::3 ip6-allhosts"
echo "# END HEADER"
echo ""
echo "# BEGIN BLOCKLIST"
cat hosts_filter
} > hosts_new
rm hosts
mv hosts_new hosts
rm hosts_filter
echo "Done Building!"
- name: Commit and Push Changes
run: |
git add hosts
git commit -m "Update hosts file"
git push origin master