qq的网页登录是通过加密的,直接上最关键代码
使用JavaScript引擎调用qqRSA.js的加密文件
参数包含 用户名 密码 验证码
/**
*
* @return 返回加密后的字符串
*/
public String encrypt() {
try {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine se = m.getEngineByName("javascript");
InputStream jmpath = this.getClass().getResourceAsStream("/QQRSA.js");
se.eval(new BufferedReader(new InputStreamReader(jmpath)));
Invocable invocable = (Invocable) se;
Object o = invocable.invokeFunction("getEncryption", pass, name, vcode);
return o.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}