Skip to content

Commit

Permalink
feat jvm attach log
Browse files Browse the repository at this point in the history
  • Loading branch information
yoloyyh committed Jun 3, 2024
1 parent c0b320e commit 4f9ca2a
Showing 1 changed file with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}

0 comments on commit 4f9ca2a

Please sign in to comment.