fix: unzip alternatives

This commit is contained in:
MDLeom 2024-07-15 09:43:11 +00:00
parent f07ad2ce4e
commit 8702981a79
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 16 additions and 5 deletions

View File

@ -39,19 +39,30 @@ check_grep() {
}
check_grep
## Fallback to busybox's dos2unix if installed
if ! command -v dos2unix &> /dev/null
then
if command -v busybox &> /dev/null
then
alias dos2unix="busybox dos2unix"
else
echo "dos2unix or busybox not found"
echo "dos2unix not found"
exit 1
fi
fi
if command -v unzip &> /dev/null
then
alias unzip="unzip -p"
elif command -v busybox &> /dev/null
then
alias unzip="busybox unzip -p"
elif command -v bsdunzip &> /dev/null
then
alias unzip="bsdunzip -p"
else
echo "unzip not found"
exit 1
fi
## Create a temporary working folder
mkdir -p "tmp/"
@ -125,7 +136,7 @@ sort -u > "phishing-domains.txt"
cp "../src/exclude.txt" "."
## Parse the Umbrella 1 Million
unzip -p "top-1m-umbrella.zip" | \
unzip "top-1m-umbrella.zip" | \
dos2unix | \
tr "[:upper:]" "[:lower:]" | \
# Parse domains only
@ -136,7 +147,7 @@ sed "s/^www\.//g" | \
sort -u > "top-1m-umbrella.txt"
## Parse the Tranco 1 Million
unzip -p "top-1m-tranco.zip" | \
unzip "top-1m-tranco.zip" | \
dos2unix | \
tr "[:upper:]" "[:lower:]" | \
# Parse domains only