From 81c343223e5549cbddb731563f75ddd601d7eacd Mon Sep 17 00:00:00 2001 From: minoplhy Date: Mon, 2 Aug 2021 18:50:11 +0700 Subject: [PATCH] Hype Hype --- action.py | 25 +++++++++++++++++++++++++ action.yml | 4 ++++ crawler.py | 7 ++++++- filters.sh | 4 +--- maker-domains.py => maker_domains.py | 0 maker-rpz.py => maker_rpz.py | 2 -- 6 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 action.py rename maker-domains.py => maker_domains.py (100%) rename maker-rpz.py => maker_rpz.py (98%) diff --git a/action.py b/action.py new file mode 100644 index 0000000..cad5277 --- /dev/null +++ b/action.py @@ -0,0 +1,25 @@ +import sys +sys.path.append('/filters-maker/') + +import crawler +import maker_rpz +import maker_domains + +input = '/repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/domains.txt' +excluded = '/repros/Resources/excluded.txt' +rpz_locat = '/repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/rpz.txt' + +crawler.download_filters("https://dbl.oisd.nl/" ,input) +crawler.download_filters("https://hosts.netlify.app/Pro/rpz.txt" ,input) +crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/dns.txt" ,input) +crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/cname-tracker.txt" ,input) +crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/cname-original.txt" ,input) +crawler.download_filters("https://filters.kylz.nl/RPZ/stevenblack/f-s.txt" ,input) +crawler.download_filters("https://filters.kylz.nl/RPZ/someonewhocares/rpz.txt" ,input) +crawler.download_filters("https://urlhaus.abuse.ch/downloads/rpz/" ,input) +crawler.download_filters("https://github.com/easylist/easylist/raw/master/easylist/easylist_adservers.txt" ,input) +crawler.filtering(input) +crawler.filteringcon(input) +crawler.killingdup(input) +maker_rpz.RPZbuilding(excluded, input, rpz_locat) +maker_domains.domainsbuilding(excluded, input) \ No newline at end of file diff --git a/action.yml b/action.yml index 81d2175..e30e0e5 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: Destination_VERSION: description: "version" required: true + ACTION_NAME: + description: 'action script' + required: true GIT_NAME: description: 'username' required: true @@ -39,6 +42,7 @@ runs: - ${{ inputs.Destination_REPO }} - ${{ inputs.Destination_FOLDER }} - ${{ inputs.Destination_VERSION }} + - ${{ inputs.ACTION_FILE }} - ${{ inputs.GIT_NAME }} - ${{ inputs.GIT_EMAIL }} - ${{ inputs.REPO_BRANCH }} diff --git a/crawler.py b/crawler.py index aa1ec25..5a18d16 100644 --- a/crawler.py +++ b/crawler.py @@ -12,7 +12,12 @@ try: except OSError: pass -def download_filters(url): +def download_filters(url,input): + try: + os.remove(input) + except OSError: + pass + print("downloading: ",url) get = requests.get(url) diff --git a/filters.sh b/filters.sh index 0839bca..2496400 100644 --- a/filters.sh +++ b/filters.sh @@ -3,10 +3,8 @@ git clone https://github.com/minoplhy/filters-maker /filters-maker git clone https://x-access-token:$API_TOKEN_GITHUB@github.com/$INPUT_DESTINATION_UNAME/$INPUT_DESTINATION_REPO.git /repros mkdir /repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION pip3 install -r /filters-maker/requirements.txt -python3 /filters-maker/crawler.py /repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/domains.txt -python3 /filters-maker/maker-rpz.py /repros/Resources/excluded.txt /repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/domains.txt /repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/rpz.txt -python3 /filters-maker/maker-domains.py /repros/Resources/excluded.txt /repros/$INPUT_DESTINATION_FOLDER/$INPUT_DESTINATION_VERSION/domains.txt cd /repros +python3 /repros/$INPUT_ACTION_FILE git config --local user.name $INPUT_GIT_NAME git config --local user.email $INPUT_GIT_EMAIL git add . diff --git a/maker-domains.py b/maker_domains.py similarity index 100% rename from maker-domains.py rename to maker_domains.py diff --git a/maker-rpz.py b/maker_rpz.py similarity index 98% rename from maker-rpz.py rename to maker_rpz.py index 1908073..4af18da 100644 --- a/maker-rpz.py +++ b/maker_rpz.py @@ -40,6 +40,4 @@ def RPZbuilding(): if not line.strip(): f.write('\n'.join([line + '\n'])) f.close() - -RPZbuilding() exit() \ No newline at end of file