bash脚本登录到网页 [英] bash script to login to webpage
问题描述
我试图登录到此页面,但我不能为我的生命得到它的工作。我有我的时候,为了启动一个会话连接到我校的WiFi登录到这个网站。
到目前为止,香港专业教育学院尝试使用bash和卷曲来实现这一点,但只取得了给自己一个头痛的问题。将卷曲的工作还是我在错误的轨道上?任何帮助是极大AP preciated!
谢谢,
N
下面是我的尝试:
卷曲--cookie-JAR cjar --output的/ dev / null的http://campus.fsu.edu/webapps/login/卷曲--cookie cjar --cookie-JAR cjar \\
--data'用户名=富'\\
--data密码=栏'\\
--data'服务= HTTP://campus.fsu.edu/webapps/login/'\\
--data'loginurl = HTTP://campus.fsu.edu/webapps/login/bb_bb60/logincas.jsp'\\
- 位置 \\
--output〜/ loginresult.html \\
http://campus.fsu.edu/webapps/login/
有些事情你明明做错了 - 你的形式如下:
<形成的onsubmit =返回validate_form(本)的方法=邮报行动=https://bb5.fsu.edu/cas/ID =登录 AUTOCOMPLETE =关>
&所述;! - 等 - >
< /表及GT;
您需要提交您的要求,以表格的行动的网址,你需要使它成为一个POST请求,而不是一个GET请求到一些其他的URL。
I am trying to login into this page but I cannot for the life of me get it to work. I have to login to this site when i connect to my school's wifi in order to start a session.
So far ive tried to use bash and cUrl to achieve this but have only achieved to give myself a headache. will cUrl work or am I on the wrong track? Any help is greatly appreciated!
Thanks,
N
Here's what i tried:
curl --cookie-jar cjar --output /dev/null http://campus.fsu.edu/webapps/login/
curl --cookie cjar --cookie-jar cjar \
--data 'username=foo' \
--data 'password=bar' \
--data 'service=http://campus.fsu.edu/webapps/login/' \
--data 'loginurl=http://campus.fsu.edu/webapps/login/bb_bb60/logincas.jsp' \
--location \
--output ~/loginresult.html \
http://campus.fsu.edu/webapps/login/
Some things you're obviously doing wrong - your form looks like this:
<form onsubmit="return validate_form(this)" method="post" action="https://bb5.fsu.edu/cas/" id="login" AUTOCOMPLETE="off">
<!-- etc -->
</form>
You need to submit your request to the "action" URL of the form, and you need to make it a POST request instead of a GET request to some other URL.
这篇关于bash脚本登录到网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!