不好意思,我正在学习。我正在尝试通过Jsoup登录。但是,表单中有一个javascript函数可通过邮寄发送。是否有办法在Jsoup中执行Encriptar_Enviar()函数。
<form name="frmLogin" action="javascript:Encriptar_Enviar();void(0);"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="1">
<tbody><tr>
<td colspan="3" class="txt">
</td>
</tr>
<tr>
<td class="subsubtitulo">Login</td>
<td class="subsubtitulo">Senha</td>
<td width="24%" rowspan="3" id="td_btn_ok"><input id="btnOk" class="btnOk" type="submit" name="Submit" value="OK">
</td>
</tr>
<tr>
<td width="36%" class="conteudoTexto">
<input class="formulario" name="LOGIN" type="text" id="txtLogin" size="15" maxlength="30">
</td>
<td width="40%" valign="top">
<input class="formulario" name="SENHA" type="password" id="txtSenha" size="15" maxlength="30">
</td>
</tr>
<tr>
<td colspan="3">
<a href="https://qacademico.ifpe.edu.br/qacademicodotnet/recuperar_senha.aspx">Esqueci minha senha</a>
</td>
</tr>
<script src="lib/scripts/logins.js"></script>
</tbody></table><input type="hidden" name="TIPO_USU" value="1"></form>
这是我的代码,但出现错误。请帮助我。
Connection.Response loginForm = Jsoup.connect("https://qacademico.ifpe.edu.br/qacademico/index.asp?t=1001")
.method(Connection.Method.GET)
.execute();
Map<String, String> loginCookies = loginForm.cookies();
Document document = Jsoup
.connect("https://qacademico.ifpe.edu.br/qacademico/lib/validalogin.asp")
.data("Submit", "OK")
.data("LOGIN", "MATRICULA_DO_ALUNO")
.data("SENHA", "SENHA_DO_ALUNO")
.data("TIPO_USU", "1")
.cookies(loginCookies)
.post();
答案 0 :(得分:0)
这是一个非常棘手的问题,使用Jsoup不可能做到这一点。提交表单时,它不仅发布您的登录名和密码。它获取此附加URL:https://qacademico.ifpe.edu.br/qacademico/lib/rsa/gerador_chaves_rsa.asp?form=frmLogin&action=%2Fqacademico%2Flib%2Fvalidalogin%2Easp以获取RSA密钥对。
然后,它使用以下JavaScript库加密您的数据:https://qacademico.ifpe.edu.br/qacademico/lib/rsa/RSA.js并发布加密的登录数据: