标签: RSA js python 模拟登陆
模拟登陆之后就可以通过cookie保持登陆状态,也可以用于记住密码登陆,可以用于快速抢课,快速爬取课程,该文章只用于技术交流请勿用于违法违纪的行为
1.前端提交form之前call后台,要求获得publicKey的相关参数。
var modulus,exponent;
//_path='http://jw.jluzh.com'
$.getJSON(_path+"/xtgl/login_getPublicKey.html?time="+new Date().getTime(),function(data){
modulus = data["modulus"];
exponent = data["exponent"];
});
2.后台生成密钥对,把privateKey存在session,把publicKey的modulus和exponent返回前台。
略
3.前台用publicKey对password加密
var rsaKey = new RSAKey();
rsaKey.setPublic(b64tohex(modulus), b64tohex(exponent));
var enPassword = hex2b64(rsaKey.encrypt($("#mm").val()));
$("#mm").val(enPassword);
$("#hidMm").val(enPassword);
4.把form提交到后台,后台使用privateKey对密码进行解密ÿ