Initial commit
This commit is contained in:
commit
aa8fc238d6
|
@ -0,0 +1,2 @@
|
|||
tmp/
|
||||
.vscode/
|
|
@ -0,0 +1,83 @@
|
|||
stages:
|
||||
- deploy_stage
|
||||
- failed_stage
|
||||
|
||||
image: alpine:latest # Use the latest version of Alpine Linux docker image
|
||||
|
||||
deploy_job:
|
||||
stage: deploy_stage
|
||||
|
||||
before_script:
|
||||
- 'which ssh-agent || (apk update && apk add curl openssh-client git grep)'
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
script:
|
||||
- sh src/script.sh
|
||||
|
||||
- git checkout master
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com"
|
||||
|
||||
# Commit the changes
|
||||
- sh src/commit.sh
|
||||
|
||||
# Generate successful status badge
|
||||
- mkdir -p .gitlab/
|
||||
- sh src/badge.sh "success"
|
||||
- git add .gitlab/status.svg
|
||||
# Only commit when diff exists https://stackoverflow.com/a/8123841
|
||||
- git diff-index --quiet HEAD || git commit -m "Success pipeline"
|
||||
|
||||
- ssh -T git@gitlab.com
|
||||
- git remote set-url origin git@gitlab.com:curben/phishing-filter.git
|
||||
# - git push origin master
|
||||
|
||||
rules:
|
||||
# Only trigger through schedule job in master branch
|
||||
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule"'
|
||||
when: always
|
||||
# Only trigger through "Run pipeline" in master branch
|
||||
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"'
|
||||
when: always
|
||||
|
||||
# Upload working folder as a job artifact
|
||||
artifacts:
|
||||
paths:
|
||||
- tmp/
|
||||
|
||||
failed_job:
|
||||
stage: failed_stage
|
||||
|
||||
before_script:
|
||||
- 'which ssh-agent || (apk update && apk add curl openssh-client git grep)'
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
script:
|
||||
- git checkout master
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com"
|
||||
|
||||
- mkdir -p .gitlab/
|
||||
- sh src/badge.sh "failed"
|
||||
- git add .gitlab/status.svg
|
||||
- git diff-index --quiet HEAD || git commit -m "Failed pipeline"
|
||||
- ssh -T git@gitlab.com
|
||||
- git remote set-url origin git@gitlab.com:curben/phishing-filter.git
|
||||
# - git push origin master
|
||||
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule"'
|
||||
# Run this job only when deploy_job failed
|
||||
when: on_failure
|
||||
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"'
|
||||
when: on_failure
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="102" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="102" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#4c1" d="M53 0h49v20H53z"/><path fill="url(#b)" d="M0 0h102v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">pipeline</text><text x="275" y="140" transform="scale(.1)" textLength="430">pipeline</text><text x="765" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">passed</text><text x="765" y="140" transform="scale(.1)" textLength="390">passed</text></g> </svg>
|
After Width: | Height: | Size: 959 B |
|
@ -0,0 +1,42 @@
|
|||
CC0 1.0 Universal
|
||||
==================
|
||||
|
||||
Statement of Purpose
|
||||
---------------------
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights.
|
||||
--------------------------------
|
||||
A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
|
||||
|
||||
2. Waiver.
|
||||
-----------
|
||||
To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback.
|
||||
----------------------------
|
||||
Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
--------------------------------
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
|
||||
|
||||
For more information, please see
|
||||
https://creativecommons.org/publicdomain/zero/1.0/
|
|
@ -0,0 +1,220 @@
|
|||
# Phishing URL Blocklist
|
||||
|
||||
A blocklist of phishing websites, based on the [PhishTank](https://www.phishtank.com/) list. Blocklist is updated twice a day.
|
||||
|
||||
There are multiple formats available, refer to the appropriate section according to the program used:
|
||||
|
||||
- uBlock Origin (uBO) -> [URL-based](#url-based) section (recommended)
|
||||
- Pi-hole -> [Domain-based](#domain-based) or [Hosts-based](#hosts-based) section
|
||||
- Hosts file -> [Hosts-based](#hosts-based) section
|
||||
- Dnsmasq -> [Dnsmasq](#dnsmasq) section
|
||||
- BIND -> [BIND](#bind) section
|
||||
- Unbound -> [Unbound](#unbound) section
|
||||
|
||||
Not sure which format to choose? See [Compatibility](https://gitlab.com/curben/urlhaus-filter/wikis/compatibility) page.
|
||||
|
||||
## URL-based
|
||||
|
||||
Import the following URL into uBO to subscribe:
|
||||
|
||||
- https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter.txt
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter.txt
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter.txt
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter.txt
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter.txt
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter.txt
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter.txt
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter.txt
|
||||
|
||||
</details>
|
||||
|
||||
## Domain-based
|
||||
|
||||
This blocklist includes domains and IP addresses.
|
||||
|
||||
- https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter-domains.txt
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter-domains.txt
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter-domains.txt
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter-domains.txt
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter-domains.txt
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter-domains.txt
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter-domains.txt
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter-domains.txt
|
||||
|
||||
</details>
|
||||
|
||||
## Hosts-based
|
||||
|
||||
This blocklist includes domains only.
|
||||
|
||||
- https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter-hosts.txt
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter-hosts.txt
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter-hosts.txt
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter-hosts.txt
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter-hosts.txt
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter-hosts.txt
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter-hosts.txt
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter-hosts.txt
|
||||
|
||||
</details>
|
||||
|
||||
## Dnsmasq
|
||||
|
||||
This blocklist includes domains only.
|
||||
|
||||
### Install
|
||||
|
||||
```
|
||||
# Create a new folder to store the blocklist
|
||||
mkdir -p /usr/local/etc/dnsmasq/
|
||||
|
||||
# Create a new cron job for daily update
|
||||
printf '#!/bin/sh\ncurl -L "https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter-dnsmasq.conf" -o "/usr/local/etc/dnsmasq/phishing-filter-dnsmasq.conf"\n' > /etc/cron.daily/phishing-filter
|
||||
|
||||
# cron job requires execution permission
|
||||
chmod 755 /etc/cron.daily/phishing-filter
|
||||
|
||||
# Configure dnsmasq to use the blocklist
|
||||
printf "\nconf-file=/usr/local/etc/dnsmasq/dist/phishing-filter-dnsmasq.conf\n" >> /etc/dnsmasq.conf
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter-dnsmasq.conf
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter-dnsmasq.conf
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter-dnsmasq.conf
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter-dnsmasq.conf
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter-dnsmasq.conf
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter-dnsmasq.conf
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter-dnsmasq.conf
|
||||
|
||||
</details>
|
||||
|
||||
## BIND
|
||||
|
||||
This blocklist includes domains only.
|
||||
|
||||
### Install
|
||||
|
||||
```
|
||||
# Create a new folder to store the blocklist
|
||||
mkdir -p /usr/local/etc/bind/
|
||||
|
||||
# Create a new cron job for daily update
|
||||
printf '#!/bin/sh\ncurl -L "https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter-bind.conf" -o "/usr/local/etc/bind/phishing-filter-bind.conf"\n' > /etc/cron.daily/phishing-filter
|
||||
|
||||
# cron job requires execution permission
|
||||
chmod 755 /etc/cron.daily/phishing-filter
|
||||
|
||||
# Configure BIND to use the blocklist
|
||||
printf '\ninclude "/usr/local/etc/bind/dist/phishing-filter-bind.conf";\n' >> /etc/bind/named.conf
|
||||
```
|
||||
|
||||
Add this to "/etc/bind/null.zone.file" (skip this step if the file already exists):
|
||||
|
||||
```
|
||||
$TTL 86400 ; one day
|
||||
@ IN SOA ns.nullzone.loc. ns.nullzone.loc. (
|
||||
2017102203
|
||||
28800
|
||||
7200
|
||||
864000
|
||||
86400 )
|
||||
NS ns.nullzone.loc.
|
||||
A 0.0.0.0
|
||||
@ IN A 0.0.0.0
|
||||
* IN A 0.0.0.0
|
||||
```
|
||||
|
||||
Zone file is derived from [here](https://github.com/tomzuu/blacklist-named/blob/master/null.zone.file).
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter-bind.conf
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter-bind.conf
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter-bind.conf
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter-bind.conf
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter-bind.conf
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter-bind.conf
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter-bind.conf
|
||||
|
||||
</details>
|
||||
|
||||
## Unbound
|
||||
|
||||
This blocklist includes domains only.
|
||||
|
||||
### Install
|
||||
|
||||
```
|
||||
# Create a new folder to store the blocklist
|
||||
mkdir -p /usr/local/etc/unbound/
|
||||
|
||||
# Create a new cron job for daily update
|
||||
printf '#!/bin/sh\ncurl -L "https://gitlab.com/curben/phishing-filter/raw/master/dist/phishing-filter-unbound.conf" -o "/usr/local/etc/unbound/phishing-filter-unbound.conf"\n' > /etc/cron.daily/phishing-filter
|
||||
|
||||
# cron job requires execution permission
|
||||
chmod 755 /etc/cron.daily/phishing-filter
|
||||
|
||||
# Configure Unbound to use the blocklist
|
||||
printf '\n include: "/usr/local/etc/unbound/dist/phishing-filter-unbound.conf"\n' >> /etc/unbound/unbound.conf
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Mirrors</summary>
|
||||
|
||||
- https://cdn.statically.io/gl/curben/phishing-filter/raw/master/dist/phishing-filter-unbound.conf
|
||||
- https://glcdn.githack.com/curben/phishing-filter/raw/master/dist/phishing-filter-unbound.conf
|
||||
- https://raw.githubusercontent.com/curbengh/phishing-filter/master/dist/phishing-filter-unbound.conf
|
||||
- https://cdn.statically.io/gh/curbengh/phishing-filter/master/dist/phishing-filter-unbound.conf
|
||||
- https://gitcdn.xyz/repo/curbengh/phishing-filter/master/dist/phishing-filter-unbound.conf
|
||||
- https://cdn.jsdelivr.net/gh/curbengh/phishing-filter/dist/phishing-filter-unbound.conf
|
||||
- https://repo.or.cz/phishing-filter.git/blob_plain/refs/heads/master:/dist/phishing-filter-unbound.conf
|
||||
|
||||
</details>
|
||||
|
||||
## Issues
|
||||
|
||||
This blocklist operates by blocking the **whole** website, instead of specific webpages; exceptions are made on popular websites (e.g. `https://docs.google.com/`), in which webpages are specified instead (e.g. `https://docs.google.com/phishing-page`). Phishing webpages are only listed in [URL-based](#url-based) filter, popular websites are excluded from other filters.
|
||||
|
||||
*Popular* websites are as listed in the [Umbrella Popularity List](https://s3-us-west-1.amazonaws.com/umbrella-static/index.html) (top 1M domains + subdomains) and [Tranco List](https://tranco-list.eu/) (top 1M domains) and this [custom list](src/exclude.txt).
|
||||
|
||||
If you wish to exclude certain website(s) that you believe is sufficiently well-known, please create an [issue](https://gitlab.com/curben/phishing-filter/issues) or [merge request](https://gitlab.com/curben/phishing-filter/merge_requests).
|
||||
|
||||
This filter **only** accepts new phishing URLs from [PhishTank](https://www.phishtank.com/).
|
||||
|
||||
Please report new phishing URL to the upstream maintainer through https://www.phishtank.com/add_web_phish.php.
|
||||
|
||||
## Cloning
|
||||
|
||||
Since the filter is updated frequently, cloning the repo would become slower over time as the revision grows.
|
||||
|
||||
Use shallow clone to get the recent revisions only. Getting the last five revisions should be sufficient for a valid MR.
|
||||
|
||||
`git clone --depth 5 https://gitlab.com/curben/phishing-filter.git`
|
||||
|
||||
## License
|
||||
|
||||
[Creative Commons Zero v1.0 Universal](LICENSE.md)
|
||||
|
||||
[Tranco List](https://tranco-list.eu/): [MIT License](https://choosealicense.com/licenses/mit/)
|
||||
|
||||
[Umbrella Popularity List](https://s3-us-west-1.amazonaws.com/umbrella-static/index.html): Available free of charge by Cisco Umbrella
|
||||
|
||||
[PhishTank](https://www.phishtank.com/): [CC BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/)
|
||||
|
||||
PhishTank and Cisco are either trademarks or registered trademarks of Cisco Systems, Inc. and/or its affiliates in the United States and certain other countries.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -efux -o pipefail
|
||||
|
||||
## Set status badge
|
||||
|
||||
successBadge='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="102" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="102" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#4c1" d="M53 0h49v20H53z"/><path fill="url(#b)" d="M0 0h102v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">pipeline</text><text x="275" y="140" transform="scale(.1)" textLength="430">pipeline</text><text x="765" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">passed</text><text x="765" y="140" transform="scale(.1)" textLength="390">passed</text></g> </svg>'
|
||||
|
||||
failedBadge='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="92" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="92" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h53v20H0z"/><path fill="#e05d44" d="M53 0h39v20H53z"/><path fill="url(#b)" d="M0 0h92v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">pipeline</text><text x="275" y="140" transform="scale(.1)" textLength="430">pipeline</text><text x="715" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">failed</text><text x="715" y="140" transform="scale(.1)" textLength="290">failed</text></g> </svg>'
|
||||
|
||||
if [ "$1" = "success" ]; then
|
||||
echo "$successBadge" > ".gitlab/status.svg"
|
||||
elif [ "$1" = "failed" ]; then
|
||||
echo "$failedBadge" > ".gitlab/status.svg"
|
||||
fi
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -efux -o pipefail
|
||||
|
||||
## Commit the filter update
|
||||
|
||||
## GitLab CI does not permit shell variable in .gitlab-ci.yml.
|
||||
## This file is a workaround for that.
|
||||
|
||||
CURRENT_TIME="$(date -R -u)"
|
||||
git commit -a -m "Filter updated: $CURRENT_TIME"
|
|
@ -0,0 +1 @@
|
|||
# Exclusion list
|
|
@ -0,0 +1,161 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -efux -o pipefail
|
||||
|
||||
## Detect Musl C library
|
||||
LIBC="$(ldd /bin/ls | grep 'musl' || [ $? = 1 ])"
|
||||
if [ -z "$LIBC" ]; then
|
||||
rm -f "/tmp/musl.log"
|
||||
# Not Musl
|
||||
CSVQUOTE="../utils/csvquote-bin-glibc"
|
||||
else
|
||||
# Musl
|
||||
CSVQUOTE="../utils/csvquote-bin-musl"
|
||||
fi
|
||||
|
||||
|
||||
## Create a temporary working folder
|
||||
mkdir -p "tmp/"
|
||||
cd "tmp/"
|
||||
|
||||
|
||||
## Prepare datasets
|
||||
curl -L "https://data.phishtank.com/data/$PHISHTANK_API/online-valid.csv.bz2" -o "phishtank.bz2"
|
||||
curl -L "https://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip" -o "top-1m-umbrella.zip"
|
||||
curl -L "https://tranco-list.eu/top-1m.csv.zip" -o "top-1m-tranco.zip"
|
||||
|
||||
bunzip2 -kc "phishtank.bz2" > "phishtank.csv"
|
||||
|
||||
|
||||
## Parse URLs
|
||||
cat "phishtank.csv" | \
|
||||
## Workaround for column with double quotes
|
||||
"./$CSVQUOTE" | \
|
||||
cut -f 2 -d "," | \
|
||||
"./$CSVQUOTE" -u | \
|
||||
sed 's/"$//g' | \
|
||||
cut -f 3- -d "/" | \
|
||||
# Domain must have at least a 'dot'
|
||||
grep -F "." | \
|
||||
sed "s/^www\.//g" | \
|
||||
sort -u > "phishtank.txt"
|
||||
|
||||
## Parse domain and IP address only
|
||||
cat "phishtank.txt" | \
|
||||
cut -f 1 -d "/" | \
|
||||
cut -f 1 -d ":" | \
|
||||
sort -u > "phishtank-domains.txt"
|
||||
|
||||
|
||||
cp "../src/exclude.txt" "."
|
||||
|
||||
## Parse the Umbrella 1 Million
|
||||
unzip -p "top-1m-umbrella.zip" | \
|
||||
dos2unix | \
|
||||
# Parse domains only
|
||||
cut -f 2 -d "," | \
|
||||
grep -F "." | \
|
||||
# Remove www.
|
||||
sed "s/^www\.//g" | \
|
||||
sort -u > "top-1m-umbrella.txt"
|
||||
|
||||
## Parse the Tranco 1 Million
|
||||
unzip -p "top-1m-tranco.zip" | \
|
||||
dos2unix | \
|
||||
# Parse domains only
|
||||
cut -f 2 -d "," | \
|
||||
grep -F "." | \
|
||||
# Remove www.
|
||||
sed "s/^www\.//g" | \
|
||||
sort -u > "top-1m-tranco.txt"
|
||||
|
||||
# Merge Umbrella, Traco and self-maintained top domains
|
||||
cat "top-1m-umbrella.txt" "top-1m-tranco.txt" "exclude.txt" | \
|
||||
sort -u > "top-1m-well-known.txt"
|
||||
|
||||
|
||||
## Parse popular domains from PhishTank
|
||||
cat "phishtank-domains.txt" | \
|
||||
# grep match whole line
|
||||
grep -Fx -f "top-1m-well-known.txt" > "phishtank-top-domains.txt"
|
||||
|
||||
|
||||
## Parse domains from PhishTank excluding popular domains
|
||||
cat "phishtank-domains.txt" | \
|
||||
grep -F -vf "phishtank-top-domains.txt" > "phishing-domains.txt"
|
||||
|
||||
## Parse phishing URLs from popular domains
|
||||
cat "phishtank.txt" | \
|
||||
grep -F -f "phishtank-top-domains.txt" | \
|
||||
sed "s/^/||/g" | \
|
||||
sed "s/$/^\$all/g" > "phishing-url-top-domains.txt"
|
||||
|
||||
|
||||
## Merge malware domains and URLs
|
||||
CURRENT_TIME="$(date -R -u)"
|
||||
FIRST_LINE="! Title: Phishing URL Blocklist"
|
||||
SECOND_LINE="! Updated: $CURRENT_TIME"
|
||||
THIRD_LINE="! Expires: 1 day (update frequency)"
|
||||
FOURTH_LINE="! Repo: https://gitlab.com/curben/phishing-filter"
|
||||
FIFTH_LINE="! License: https://creativecommons.org/publicdomain/zero/1.0/"
|
||||
SIXTH_LINE="! Source: https://www.phishtank.com/"
|
||||
COMMENT_UBO="$FIRST_LINE\n$SECOND_LINE\n$THIRD_LINE\n$FOURTH_LINE\n$FIFTH_LINE\n$SIXTH_LINE"
|
||||
|
||||
cat "phishing-domains.txt" "phishing-url-top-domains.txt" | \
|
||||
sort | \
|
||||
sed '1 i\'"$COMMENT_UBO"'' > "../dist/phishing-filter.txt"
|
||||
|
||||
|
||||
## Domains-only blocklist
|
||||
# awk + head is a workaround for sed prepend
|
||||
COMMENT=$(printf "$COMMENT_UBO" | sed "s/^!/#/g" | sed "1s/URL/Domains/" | awk '{printf "%s\\n", $0}' | head -c -2)
|
||||
|
||||
cat "phishing-domains.txt" | \
|
||||
sort | \
|
||||
sed '1 i\'"$COMMENT"'' > "../dist/phishing-filter-domains.txt"
|
||||
|
||||
|
||||
## Hosts file blocklist
|
||||
cat "../dist/phishing-filter-domains.txt" | \
|
||||
# Exclude comment with #
|
||||
grep -vE "^#" | \
|
||||
# Remove IPv4 address
|
||||
grep -vE "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | \
|
||||
sed "s/^/0.0.0.0 /g" | \
|
||||
# Re-insert comment
|
||||
sed '1 i\'"$COMMENT"'' | \
|
||||
sed "1s/Domains/Hosts/" > "../dist/phishing-filter-hosts.txt"
|
||||
|
||||
|
||||
## Dnsmasq-compatible blocklist
|
||||
cat "../dist/phishing-filter-hosts.txt" | \
|
||||
grep -vE "^#" | \
|
||||
sed "s/^0.0.0.0 /address=\//g" | \
|
||||
sed "s/$/\/0.0.0.0/g" | \
|
||||
sed '1 i\'"$COMMENT"'' | \
|
||||
sed "1s/Blocklist/dnsmasq Blocklist/" > "../dist/phishing-filter-dnsmasq.conf"
|
||||
|
||||
|
||||
## BIND-compatible blocklist
|
||||
cat "../dist/phishing-filter-hosts.txt" | \
|
||||
grep -vE "^#" | \
|
||||
sed 's/^0.0.0.0 /zone "/g' | \
|
||||
sed 's/$/" { type master; notify no; file "null.zone.file"; };/g' | \
|
||||
sed '1 i\'"$COMMENT"'' | \
|
||||
sed "1s/Blocklist/BIND Blocklist/" > "../dist/phishing-filter-bind.conf"
|
||||
|
||||
|
||||
## Unbound-compatible blocklist
|
||||
cat "../dist/phishing-filter-hosts.txt" | \
|
||||
grep -vE "^#" | \
|
||||
sed 's/^0.0.0.0 /local-zone: "/g' | \
|
||||
sed 's/$/" always_nxdomain/g' | \
|
||||
sed '1 i\'"$COMMENT"'' | \
|
||||
sed "1s/Blocklist/Unbound Blocklist/" > "../dist/phishing-filter-unbound.conf"
|
||||
|
||||
|
||||
## Clean up artifacts
|
||||
rm "phishtank.csv" "top-1m-umbrella.zip" "top-1m-umbrella.txt" "top-1m-tranco.txt"
|
||||
|
||||
|
||||
cd ../
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue