From 93824af81ba8014cdac22be644fa2323f6e4c5cf Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Mon, 10 Oct 2022 09:13:39 +0000 Subject: [PATCH] fix: add user agent to phishtank request https://phishtank.org/developer_info.php --- src/script.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/script.sh b/src/script.sh index c76ec631..7d849ae9 100644 --- a/src/script.sh +++ b/src/script.sh @@ -35,11 +35,20 @@ fi mkdir -p "tmp/" cd "tmp/" +USER_AGENT="phishtank/malware-filter" +if [ -n "$GITLAB_USER_LOGIN" ]; then + USER_AGENT="phishtank/$GITLAB_USER_LOGIN" +elif [ -n "$GITHUB_REPOSITORY_OWNER" ]; then + USER_AGENT="phishtank/$GITHUB_REPOSITORY_OWNER" +fi + ## Prepare datasets if [ -n "$PHISHTANK_API" ]; then - curl -L "https://data.phishtank.com/data/$PHISHTANK_API/online-valid.csv.bz2" -o "phishtank.bz2" + curl -L --user-agent "$USER_AGENT" \ + "https://data.phishtank.com/data/$PHISHTANK_API/online-valid.csv.bz2" -o "phishtank.bz2" else - curl -L "https://data.phishtank.com/data/online-valid.csv.bz2" -o "phishtank.bz2" + curl -L --user-agent "$USER_AGENT" \ + "https://data.phishtank.com/data/online-valid.csv.bz2" -o "phishtank.bz2" fi curl -L "https://openphish.com/feed.txt" -o "openphish-raw.txt"