Skip to content

Instantly share code, notes, and snippets.

@rossbu
Created July 28, 2021 17:27
Show Gist options
  • Save rossbu/142e2ef7e2878b6c7337c0fe4adb7e7a to your computer and use it in GitHub Desktop.
Save rossbu/142e2ef7e2878b6c7337c0fe4adb7e7a to your computer and use it in GitHub Desktop.
find the class in your web application -jsp
<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
     <title>Servlet Container Class Finder</title>
</head>
<body>
<h2>Servlet Container Class Finder</h2>
<p>Enter the fully-qualified name of a Java class
(e.g. org.apache.oro.text.regex.Perl5Compiler) in the field below. The
servlet will attempt to load the class and, if successful, query the
class' <em>java.security.CodeSource</em> for the location of the class
using the following methods:
     <pre>
     Class.forName(className).getProtectionDomain().getCodeSource()
     </pre>
</p>
<p>
<%
     String className = request.getParameter("className");
     String prefill = "";
     if (className != null)
     {
          prefill = className;
          if (className.trim().length() != 0)
          {
               try
               {
                    java.security.ProtectionDomain pd = Class.forName(className).getProtectionDomain();
                    if (pd != null)
                    {
                         java.security.CodeSource cs = pd.getCodeSource();
                         if (cs != null)
                         {
                              out.println(cs);
                         }
                         else
                         {
                              out.println("No CodeSource found");
                         }
                    }
                    else
                    {
                         out.println("No ProtectionDomain found");
                    }
               }
               catch (Throwable t)
               {
                    out.println(t);
               }
          }
     }
%>
</p>
<form method="post" action="<%= request.getRequestURI()%>">
     <p>
     Class Name: <input type="text" name="className" value="<%= prefill %>" size="40"/>
     <input type="submit" value="Submit"/>
     </p>
</form>
<p>
     Code taken from
     <a href="http://www.ibm.com/developerworks/websphere/techjournal/0406_brown/0406_brown.html">
     this DeveloperWorks article</a>.
</p>
</body>
</html>
2. find class jsp
https://www.ibm.com/developerworks/community/blogs/Dougclectica/entry/revive_finding_a_java_class_in_your_servlet_container2?lang=en
<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
     <title>Servlet Container Class Finder</title>
</head>
<body>
<h2>Servlet Container Class Finder</h2>
<p>Enter the fully-qualified name of a Java class
(e.g. org.apache.oro.text.regex.Perl5Compiler) in the field below. The
servlet will attempt to load the class and, if successful, query the
class' <em>java.security.CodeSource</em> for the location of the class
using the following methods:
     <pre>
     Class.forName(className).getProtectionDomain().getCodeSource()
     </pre>
</p>
<p>
<%
     String className = request.getParameter("className");
     String prefill = "";
     if (className != null)
     {
          prefill = className;
          if (className.trim().length() != 0)
          {
               try
               {
                    java.security.ProtectionDomain pd = Class.forName(className).getProtectionDomain();
                    if (pd != null)
                    {
                         java.security.CodeSource cs = pd.getCodeSource();
                         if (cs != null)
                         {
                              out.println(cs);
                         }
                         else
                         {
                              out.println("No CodeSource found");
                         }
                    }
                    else
                    {
                         out.println("No ProtectionDomain found");
                    }
               }
               catch (Throwable t)
               {
                    out.println(t);
               }
          }
     }
%>
</p>
<form method="post" action="<%= request.getRequestURI()%>">
     <p>
     Class Name: <input type="text" name="className" value="<%= prefill %>" size="40"/>
     <input type="submit" value="Submit"/>
     </p>
</form>
<p>
     Code taken from
     <a href="http://www.ibm.com/developerworks/websphere/techjournal/0406_brown/0406_brown.html">
     this DeveloperWorks article</a>.
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment