Commit fa068c40 authored by Medicean's avatar Medicean

(Add: Encoder) ASPX 新增 `url_unicode` 编码器 (thx @yzddmr6...

(Add: Encoder) ASPX 新增 `url_unicode` 编码器 (thx @yzddmr6 https://github.com/AntSwordProject/AwesomeEncoder/issues/2)
parent c2860b8c
......@@ -16,6 +16,10 @@
> hex_base64 是指 shell 返回数据时, 先将明文数据使用 base64 编码, 再将结果 hex 编码
* ASPX 新增 `url_unicode` 编码器 (thx @yzddmr6 https://github.com/AntSwordProject/AwesomeEncoder/issues/2)
> 将 pwd payload 全部转换成 `%uxxxx` 这种形式, eg: `Re` => `%u0052%u0065`
### 其它
* 修复 `jsp_custom_script_for_mysql.jsp` 使用 `base64` 编码器连接数据库时 `characterEncoding` 二次解码导致的无法识别的问题 #171
......
/**
* aspx::url_unicode 编码器
* 把字符转成 %uXXXX 形式
* eg: Re => %u0052%u0065
* Create at: 2019/05/31 17:11:01
*/
'use strict';
function char2unicode(c) {
if(c.length != 1) {
return '';
}
let buff = Buffer.alloc(4, '0');
let hexstr = c.charCodeAt().toString(16);
buff.write(hexstr, buff.length - hexstr.length, hexstr.length);
return "\\u" + buff.toString();
}
function string2unicode(str){
var ret = "";
for(var i=0; i<str.length; i++){
ret += char2unicode(str[i]);
}
return ret;
}
/*
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
module.exports = (pwd, data, ext={}) => {
data[pwd] = string2unicode(data['_']).replace(/\\u/g, 'asunescape(%)u');
// 删除 _ 原有的payload
delete data['_'];
// 返回编码器处理后的 payload 数组
return data;
}
\ No newline at end of file
......@@ -40,7 +40,7 @@ class ASPX extends Base {
* @return {array} 编码器列表
*/
get encoders() {
return ["base64","hex"];
return ["base64","hex", "url_unicode"];
}
get decoders() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment