#!/bin/bash
pages="0.php 1.php 2.php"
for page in ${pages}; do
wget -q --post-data 'user=username&password=password' --save-cookies cookies "http://server/${page}"
wget -O- --load-cookies cookies -p "http://server/${page}"
done
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizGeneral Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
What you were doing "-u username:password" is as far as I know a HTTP https://forum.tuteehub.com/tag/basic">basic authentication which is different from filling out a https://forum.tuteehub.com/tag/form">form and sending it via POST. This should work:
#!/bin/bash
pages="0.php 1.php 2.php"
for page in ${pages}; do
wget -q --post-data 'user=username&password=password' --save-cookies cookies "http://server/${page}"
wget -O- --load-cookies cookies -p "http://server/${page}"
done
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.
manpreet
Best Answer
2 years ago
I have 10 php files like
0.php , 1.php, 2.php etc
All those files contains an auth form which send two inputs username and password to itself via post.
After login there is a message displayed.
I am trying to write a script which fills out the login form for each page and then echo the message from each page on a new line.
I know that I can fill the form using wget or curl but I am not so sure how.
I tried with curl -u username:password /host/files/0.php but seems that it just displays the html output of that file.
I am thinking of writing a shell script which does the followind:
How can I achieve this?