Symantec Access Management

Expand all | Collapse all

Toolbelt:  Searching JAR files for a keyphrase / string

  • 1.  Toolbelt:  Searching JAR files for a keyphrase / string

    Posted 09-04-2015 06:08 PM

    Hello,

     

    Sometimes you wish to dive in deep to your own teams' custom code.  

    I found a nice script that help speed up the "find" process to isolate the exact JAR file where that code may exist.

    Of course, after you have now identified the JAR file, you can use a 3rd party tool, such as JDGUI to view the business logic. Java Decompiler

     

    Ref:  Searching JARs for String (Linux) | JavaWorld

    I modified the script to make it case-insensitive.

     

    *** ***

    #!/bin/bash

    printf "Searching JARs for string '${1}'...\n"

    find . -iname '*.jar' -printf "unzip -c %p | grep -iq '${1}' && echo %p\n" | sh

    *** ***

     

    Example:  

      [root@sandbox01 /]# ./find-in-jar.sh keyparams

    Searching JARs for string 'keyparams'...

    ./opt/CA/jdk/jdk1.7.0_71_x86/jre/lib/rt.jar

    ./opt/CA/jdk/jdk1.7.0_71_x64/jre/lib/rt.jar

    ./opt/CA/jdk/jdk1.6.0_45_x86/jre/lib/rt.jar

    ./opt/CA/jdk/jdk1.6.0_45_x64/jre/lib/rt.jar

    ./opt/CA/siteminder/install_config_info/install_config_jre/lib/rt.jar

    ./opt/CA/siteminder/bin/thirdparty/cryptoj.jar

    ./opt/CA/siteminder/bin/thirdparty/cryptojFIPS.jar

    ./opt/CA/aas/lib/cryptoj.jar

    ./opt/CA/aas/lib/cryptojFIPS.jar

    ./opt/CA/aas/resources/DBPopulator/DBPopulator.jar

    ./opt/CA/aas/jre/lib/rt.jar

    ./opt/CA/webagent/install_config_info/install_config_jre/lib/rt.jar

    ./opt/CA/webagent/java/cryptoj.jar

    ./opt/CA/jboss/im_01/jboss-eap-6.2/modules/system/layers/base/org/opensaml/main/xmltooling-1.3.4.redhat-1.jar

    ./opt/CA/media/iso/jboss/wildfly-9.0.1.Final/modules/system/layers/base/org/bouncycastle/main/bcprov-jdk15on-1.52.jar

    ./opt/CA/media/iso/jboss/wildfly-9.0.1.Final/modules/system/layers/base/org/jboss/resteasy/jose-jwt/main/jose-jwt-3.0.11.Final.jar

    ./opt/CA/media/iso/jboss/wildfly-9.0.1.Final/modules/system/layers/base/org/opensaml/main/xmltooling-1.4.1.jar

    ./opt/CA/media/iso/ca/iam_suite/r12-6-5/server/PasswordTool/lib/cryptojFIPS.jar

    ./opt/CA/media/iso/ca/iam_suite/r12-6-5/server/PasswordTool/lib/idmutils.jar

    ./opt/CA/media/iso/ca/iam_suite/r12-6-6/server/PasswordTool/lib/cryptojFIPS.jar

    ./opt/CA/media/iso/ca/iam_suite/r12-6-6/server/PasswordTool/lib/idmutils.jar

     

     

     

    Cheers,

     

    A.



  • 2.  Re: Toolbelt:  Searching JAR files for a keyphrase / string

    Broadcom Employee
    Posted 09-05-2015 08:01 PM

    This is great Alan! I get into such situations all the time. I think this will be very helpful.



  • 3.  Re: Toolbelt:  Searching JAR files for a keyphrase / string

    Broadcom Employee
    Posted 09-07-2015 03:25 AM

    Hi Alan,

    Good command for Unix. thanks.

    I add that under Windows when you have WinRAR, this is too easy.

    Just start a search from the location you want with by instance; file names as *.class, archive types as *.jar and your string to find,

    selecting check boxes 'find in sub folders' and 'find in archives'.

    Cheers,

    Philippe.    



  • 4.  Re: Toolbelt:  Searching JAR files for a keyphrase / string

    Posted 09-07-2015 06:39 PM

    Thanks Philippe,

     

    That is good to know. 

     

    My other tool for Win OS, that I am fond of, to search for key phrases in binaries, text file, and MS Outlook PST file, is File Locator Pro.

     

    I have used the limited version for quite awhile, but have purchase this tool to search through years of emails, necessary for projects that have 3-5 year lifespans.

     

    https://www.mythicsoft.com/filelocatorpro

     

     

     

    Cheers,

     

    A.