diff --git a/rasp/jvm/JVMAgent/src/main/java/com/security/smithloader/AttachInfo.java b/rasp/jvm/JVMAgent/src/main/java/com/security/smithloader/AttachInfo.java index cbfb72c50..e8c74bdbc 100644 --- a/rasp/jvm/JVMAgent/src/main/java/com/security/smithloader/AttachInfo.java +++ b/rasp/jvm/JVMAgent/src/main/java/com/security/smithloader/AttachInfo.java @@ -1,7 +1,35 @@ package com.security.smithloader; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import com.security.smithloader.common.ProcessHelper; + public class AttachInfo { public static void info() { - System.out.println("Your Service Will Be Protected By RASP"); + + try { + Path path = Paths.get("/proc/" + ProcessHelper.getCurrentPID() + "/cwd"); + String cwd = Files.readSymbolicLink(path).toString(); + File file = new File(cwd); + + if (file.exists()) { + + file = new File(cwd + "/0_your_service_has_been_protected_by_elkeid_rasp.log"); + if (!file.exists()) { + if (file.createNewFile()) { + FileWriter writer = new FileWriter(file); + writer.write("Your Java Service Will Be Protected By RASP"); + writer.close(); + } + } + } + } catch (IOException e) { + System.out.println(e); + } } -} +} \ No newline at end of file