@@ -22,20 +22,24 @@ public static void agentmain(String cmdline, Instrumentation instrumentation) th
2222 if (TEST_AGENT_CMD_LINE != null ) {
2323 cmdline = TEST_AGENT_CMD_LINE ;
2424 }
25+
2526 String [] args = Utils .decodeArgs (cmdline );
2627 Options options = new Options (args );
28+
2729 Report report = new Report (getHeader (), options .isVerbose (), options .isLogToStdErr ());
28- report .println ("Agent loaded with options: %s" , String .join (" " , args ));
30+ report .println ("Agent loaded with options: %s%n" , String .join (" " , args ));
31+
2932 report .println ("Querying classes..." );
3033 Class <?>[] classes = Arrays .stream (instrumentation .getAllLoadedClasses ())
3134 .filter (clazz -> !clazz .isArray ())
3235 .filter (clazz -> !clazz .isSynthetic ())
3336 .filter (instrumentation ::isModifiableClass )
3437 .filter (clazz -> options .getFilterPredicate ().test (clazz .getName ()))
3538 .toArray (Class []::new );
39+ report .println ("" );
3640
3741 if (classes .length == 0 ) {
38- report .println ("WARNING: No classes were found, bad filter ?" );
42+ report .println ("WARNING: No classes were found, bad filter ?%n " );
3943 }
4044
4145 // The transformer could (as a side effect by the JVM) be called with classes not in the list which is why we pass the filtered classes to it as well
@@ -49,11 +53,13 @@ public static void agentmain(String cmdline, Instrumentation instrumentation) th
4953 } finally {
5054 instrumentation .removeTransformer (dumper );
5155 }
56+ report .println ("" );
5257
5358 // Validate that no exceptions were generated during the dump process
5459 if (dumper .getLastException () != null ) {
5560 report .println ("WARNING: One or more exceptions occurred while dumping classes." );
5661 report .dump (dumper .getLastException ());
62+ report .println ("" );
5763 }
5864
5965 File destination = new File (options .getDestination ());
@@ -70,7 +76,7 @@ public static void agentmain(String cmdline, Instrumentation instrumentation) th
7076 });
7177 writeZipEntry (jar , "report.txt" , report .generate ().getBytes (StandardCharsets .UTF_8 ));
7278 }
73- report .println ("Done" );
79+ report .println ("%nDumped classes, including report.txt, can be found in: %s" , options . getDestination () );
7480 }
7581
7682 private static void writeZipEntry (JarOutputStream jar , String name , byte [] data ) throws IOException {
@@ -101,7 +107,7 @@ private static void showUsage() {
101107 System .out .println ("pid\t process id of the target java process" );
102108 System .out .println ();
103109 System .out .println ("example:" );
104- System .out .println ("java -jar JavaForensicsToolkit.jar -d dump.jar -f java\\ \\ . -f sun\\ \\ . -f jdk\\ \\ . -f com\\ \\ .sun\\ \\ . -x 123456" );
110+ System .out .println ("java -jar JavaForensicsToolkit.jar -d dump.jar -f java\\ \\ ..* -f sun\\ \\ ..* -f jdk\\ \\ ..* -f com\\ \\ .sun\\ \\ ..* -x 123456" );
105111 }
106112
107113 /**
0 commit comments