以下代码返回
ptuiCB('22009','0','','0','对不起,你的号码登录异常,请使用QQ手机版扫描二维码安全登录。(帮助反馈)(22009)', '');
都说是js版本的问题
QQ邮箱登录地址:https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1
如果说是js版本问题,请问大牛有没有最新邮箱JS加密的方法 谢谢了!
WebClient webClients = new WebClient(BrowserVersion.CHROME);
webClients.getCookieManager().setCookiesEnabled(true);// 开启cookie管理
webClients.getOptions().setTimeout(90000);
webClients.getOptions().setCssEnabled(true);
webClients.getOptions().setJavaScriptEnabled(true);
webClients.setJavaScriptTimeout(40000);
webClients.getOptions().setRedirectEnabled(true);
webClients.getOptions().setThrowExceptionOnScriptError(false);
webClients.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClients.setAjaxController(new NicelyResynchronizingAjaxController());
webClients.getOptions().setCssEnabled(false);
webClients.getOptions().setJavaScriptEnabled(true);
HtmlPage page = webClients.getPage("https://ssl.ptlogin2.qq.com/check?pt_tea=2&uin=1121212159&appid=522005705&ptlang=2052®master=&pt_uistyle=9&r=0.07655477741844985&pt_jstoken=1515144655");
String info = page.asText();//返回结果为ptui_checkVC('0','!WMQ','\x00\x00\x00\x00\x42\xd4\x56\xff','c7b633efb1ed1aee687d7c01a5610dcddaf6401e6eb6bcb71530a57d261f1ed8964ea74d502171e67019c0018468e489bebfe01c55775031','2');
System.out.println(info);
//截取 ptui_checkVC('0','!WMQ','\x00\x00\x00\x00\x42\xd4\x56\xff','c7b633efb1ed1aee687d7c01a5610dcddaf6401e6eb6bcb71530a57d261f1ed8964ea74d502171e67019c0018468e489bebfe01c55775031','2');
String[] infoarry = info.split(",");
String xx = infoarry[2].replace("'", "");
String code = infoarry[1].replace("'", "");
String sess = infoarry[3].replace("'", "");
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval(new FileReader("D:/js/qq.js"));
engine.eval("var encryptionPassword = getEncryption('weizai9527','" + xx+ "','" + code + "', undefined);");
String p = engine.get("encryptionPassword").toString();
HtmlPage pages = webClients
.getPage("https://ssl.ptlogin2.qq.com/login?pt_vcode_v1=0&"
+ "pt_verifysession_v1="
+ sess
+ "&"
+ "verifycode="
+ code
+ "&u=1121212159&"
+ "p="
+ p
+ ""
+ "&"
+ "pt_randsalt=2&"
+ "ptlang=2052&"
+ "low_login_enable=1&"
+ "low_login_hour=720&"
+ "u1=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D%26ss%3D1&"
+ "from_ui=1&fp=loginerroralert&device=2&"
+ "aid=522005705&"
+ "daid=4&pt_3rd_aid=0&ptredirect=1&h=1&g=1&pt_uistyle=9®master=&");
System.out.println(pages.asText());
}