Skip to content

Build New Hosts File #1166

Build New Hosts File

Build New Hosts File #1166

Workflow file for this run

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