Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat jvm attach log #629

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.getMessage());
}
}
}
}
Loading