Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
Safelog4j
Commits
baac51e6
Commit
baac51e6
authored
3 years ago
by
Jeff Williams
Browse files
Options
Download
Plain Diff
Merge branch 'main' of
https://github.com/Contrast-Security-OSS/safelog4j
parents
996c9c53
6500ff68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/contrastsecurity/App.java
+10
-8
src/main/java/com/contrastsecurity/App.java
with
10 additions
and
8 deletions
+10
-8
src/main/java/com/contrastsecurity/App.java
+
10
-
8
View file @
baac51e6
package
com.contrastsecurity
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
net.bytebuddy.agent.ByteBuddyAgent
;
import
com.sun.tools.attach.AgentInitializationException
;
import
com.sun.tools.attach.AgentLoadException
;
import
com.sun.tools.attach.AttachNotSupportedException
;
import
com.sun.tools.attach.VirtualMachine
;
import
com.sun.tools.attach.VirtualMachineDescriptor
;
import
net.bytebuddy.agent.ByteBuddyAgent
;
public
class
App
{
public
static
void
main
(
String
[]
args
){
System
.
out
.
println
(
"SafeLog4j by Contrast Security"
);
System
.
out
.
println
(
"https://contrastsecurity.com"
);
...
...
@@ -21,8 +18,13 @@ public class App {
try
{
String
pid
=
args
[
0
];
String
options
=
args
.
length
>=
2
?
args
[
1
]
:
null
;
String
agentFilePath
=
"safelog4j-1.0.2.jar"
;
File
agentFile
=
new
File
(
agentFilePath
);
String
filename
=
App
.
class
.
getProtectionDomain
()
.
getCodeSource
()
.
getLocation
()
.
toURI
()
.
getPath
();
File
agentFile
=
new
File
(
filename
);
ByteBuddyAgent
.
attach
(
agentFile
.
getAbsoluteFile
(),
pid
,
options
);
System
.
out
.
println
(
"Attached to target jvm and loaded agent successfully"
);
}
catch
(
Exception
e
){
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help