Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在EXEC JS seting 如何调用如下函数? #37

Open
lzfls opened this issue Feb 16, 2023 · 9 comments
Open

在EXEC JS seting 如何调用如下函数? #37

lzfls opened this issue Feb 16, 2023 · 9 comments

Comments

@lzfls
Copy link

lzfls commented Feb 16, 2023

/**

/*

  • encrypt the string to string made up of hex

  • return the encrypted string
    */
    function strEnc(data, firstKey, secondKey, thirdKey) {

    var leng = data.length;
    var encData = "";
    var firstKeyBt, secondKeyBt, thirdKeyBt, firstLength, secondLength, thirdLength;
    if (firstKey != null && firstKey != "") {
    firstKeyBt = getKeyBytes(firstKey);
    firstLength = firstKeyBt.length;
    }
    if (secondKey != null && secondKey != "") {
    secondKeyBt = getKeyBytes(secondKey);
    secondLength = secondKeyBt.length;
    }
    if (thirdKey != null && thirdKey != "") {
    thirdKeyBt = getKeyBytes(thirdKey);
    thirdLength = thirdKeyBt.length;
    }

    if (leng > 0) {
    if (leng < 4) {
    var bt = strToBt(data);
    var encByte;
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
    var tempBt;
    var x, y, z;
    tempBt = bt;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    for (z = 0; z < thirdLength; z++) {
    tempBt = enc(tempBt, thirdKeyBt[z]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
    var tempBt;
    var x, y;
    tempBt = bt;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "") {
    var tempBt;
    var x = 0;
    tempBt = bt;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    encByte = tempBt;
    }
    }
    }
    encData = bt64ToHex(encByte);
    } else {
    var iterator = parseInt(leng / 4);
    var remainder = leng % 4;
    var i = 0;
    for (i = 0; i < iterator; i++) {
    var tempData = data.substring(i * 4 + 0, i * 4 + 4);
    var tempByte = strToBt(tempData);
    var encByte;
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
    var tempBt;
    var x, y, z;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    for (z = 0; z < thirdLength; z++) {
    tempBt = enc(tempBt, thirdKeyBt[z]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
    var tempBt;
    var x, y;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "") {
    var tempBt;
    var x;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    encByte = tempBt;
    }
    }
    }
    encData += bt64ToHex(encByte);
    }
    if (remainder > 0) {
    var remainderData = data.substring(iterator * 4 + 0, leng);
    var tempByte = strToBt(remainderData);
    var encByte;
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
    var tempBt;
    var x, y, z;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    for (z = 0; z < thirdLength; z++) {
    tempBt = enc(tempBt, thirdKeyBt[z]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
    var tempBt;
    var x, y;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    for (y = 0; y < secondLength; y++) {
    tempBt = enc(tempBt, secondKeyBt[y]);
    }
    encByte = tempBt;
    } else {
    if (firstKey != null && firstKey != "") {
    var tempBt;
    var x;
    tempBt = tempByte;
    for (x = 0; x < firstLength; x++) {
    tempBt = enc(tempBt, firstKeyBt[x]);
    }
    encByte = tempBt;
    }
    }
    }
    encData += bt64ToHex(encByte);
    }
    }
    }
    return encData;
    }

在其他位置,又有如下:
$("#rsa").val(strEnc(u + p + b, '1', '2', '3'));
u + p + b 对应如上面函数参数的data ,1、2、3对应firstkey、secondkey、thirdkey

此函数如何在EXEC JS seting 调用呢?

@lzfls lzfls changed the title 在EXECJS如何调用如下函数? 在EXEC JS seting 如何调用如下函数? Feb 16, 2023
@whwlsfb
Copy link
Owner

whwlsfb commented Feb 17, 2023

这个加密已经内置了,是DES里的strEnc

@lzfls
Copy link
Author

lzfls commented Feb 17, 2023 via email

@lzfls
Copy link
Author

lzfls commented Feb 17, 2023

这个加密已经内置了,是DES里的strEnc

听了老大的建议,尝试了一下。但是有一个问题:
上引函数
u + p + b 对应如strEnc函数参数的data,1、2、3对应firstkey、secondkey、thirdkey,且data=username+password+lt
查看网页源代码,每请求一次,则lt 的值变化一次,此类情况如何在本插件处理呢?
另外,看了您的网页文章,用custom iterator 的payload处理方式,但是无法处理lt
非常困惑,求教。

谢谢!

@whwlsfb
Copy link
Owner

whwlsfb commented Feb 17, 2023

如果lt值来自服务器生成,并且在登录接口的返回中生成,插件就处理不了了

@whwlsfb
Copy link
Owner

whwlsfb commented Feb 17, 2023

否则的话可以尝试写死lt值

@lzfls
Copy link
Author

lzfls commented Feb 17, 2023

如果lt值来自服务器生成,并且在登录接口的返回中生成,插件就处理不了了

我注意到,在response中lt可以通过grep的方式抓回来(这意味着值可以写死?),但接下来的payload processing 很费脑筋,我一直没有想好。
请指教

@lzfls
Copy link
Author

lzfls commented Feb 17, 2023

image

请看

@whwlsfb
Copy link
Owner

whwlsfb commented Feb 17, 2023

这个就比较麻烦了,回应里的lt确实是能通过grep取到,但是没法与用户名和密码一起组合,发给插件处理,目前插件还处理不了这种场景

@lzfls
Copy link
Author

lzfls commented Feb 17, 2023

这个就比较麻烦了,回应里的lt确实是能通过grep取到,但是没法与用户名和密码一起组合,发给插件处理,目前插件还处理不了这种场景
的确是!如果有可能,建议您再丰富一下插件,补充此类payload的生成功能,此类payload的确非常普遍。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants