Sander Smith
Sander Smith

Reputation: 1437

Listing the strings inside of a JAR file

I need to distribute a Java JAR file that I've written and am concerned that there may be some sensitive data that's still in the file (like passwords or keys for webapps). I've gone through the code and tried to be careful not to package anything that I don't want distributed, but I still have the fear that something slipped in.

Is there some easy way for me to dump the list of all of the constant strings that are in the class files in my JAR? I don't think the list would be TOO long and I could scan it for things that look questionable.

Upvotes: 0

Views: 693

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

On Linux (or any system with Info-Zip available) you can do

unzip -p filename.jar|strings|sort|more

The -p option writes the extracted output to stdout, and sort makes it easier to scan visually.

On Windows the above works in a Cygwin terminal assuming you have the unzip package installed.

Upvotes: 2

Related Questions