Skip to content

Instantly share code, notes, and snippets.

@Sinkmanu
Created October 31, 2016 09:32
Show Gist options
  • Save Sinkmanu/9fe4f1264e372c2f684ce0b0b5945b6b to your computer and use it in GitHub Desktop.
Save Sinkmanu/9fe4f1264e372c2f684ce0b0b5945b6b to your computer and use it in GitHub Desktop.
Remove the Tomcat banner
#!/bin/bash
CATALINAJARPATH=/path/to/catalina
cd $CATALINAJARPATH
echo "Removing banner..."
jar xf catalina.jar org/apache/catalina/util/ServerInfo.properties
sed -i -e 's/Apache Tomcat.*/Apache Tomcat/g' org/apache/catalina/util/ServerInfo.properties
sed -i -e 's/[[:digit:]].*\.[[:digit:]].*\.[[:digit:]].*\.[[:digit:]].*/0\.0\.0\.0/g' org/apache/catalina/util/ServerInfo.properties
sed -i -e 's/server\.built=.*/server\.built\=/g' org/apache/catalina/util/ServerInfo.properties
cat org/apache/catalina/util/ServerInfo.properties
jar uf catalina.jar org/apache/catalina/util/ServerInfo.properties
rm -R org/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment