( ** Go back to PARENTPAGE ../Script-jarsimilarity-pl.html)
( ** Go back to HOMESITE https://www.tcnd.com)
( ** Go back to SetSphere https://www.setsphere.com)

Comparing Java JAR archives with jarsimilarity.pl

Comparing the JAR archives on Linux filesystem is made easy with ASPL scripting language. On the UNIX prompt We will run jarsimilarity.pl on three JAR archives:

# jarsimilarity.pl /tmp/JMX/2151754-wasjmx.jar /tmp/JMX/2281258-wasjmx.jar /tmp/JMX/2376115-wasjmx.jar

The PERL program generates the following ASPL script and run it via the ASPL interpreter:
  #!/usr/bin/env aspl -groupingclass POSIX -wsname TRANSIENT -dm 3 -singlepass

  timeout 120
  ks chksum size ppdd ffl 
  displayoff
  jar0 = ggjar(jarfile,/tmp/JMX/2151754-wasjmx.jar,calchksum,1,calentropy,1)
  jar1 = ggjar(jarfile,/tmp/JMX/2281258-wasjmx.jar,calchksum,1,calentropy,1)
  jar2 = ggjar(jarfile,/tmp/JMX/2376115-wasjmx.jar,calchksum,1,calentropy,1)

  displayon
  print ##### SHOWING THE GROUP UNION #####
  ,gU jar0 jar1 jar2
  print ##### SHOWING SET SIMILARITY #####
  sim jar0 jar1 jar2
  print ##### SHOWING SET SIMILARITY w. FILE CHECKSUMS #####
  sim`fflc jar0 jar1 jar2
  println
  v

Once the program terminates the user can see the difference between all the three JAR archives.

ASPL 1> timeout 120
set timeout to 120 seconds, extracting a large archive and objectifying it may take some time

ASPL 2> ks chksum size ppdd ffl
set the ks vector to 'chksum size ppdd ffl' all known attributes in POSIX grouping class

ASPL 3> displayoff
turn off display so command won't print lengthy output

ASPL 4> jar0 = ggjar(jarfile,/tmp/JMX/2151754-wasjmx.jar,calchksum,1,calentropy,1)
create jar0 variable and assign it the result of GG function ggjar() for /tmp/JMX/2151754-wasjmx.jar archive, also consider calculating the checksum and enthropy

ASPL 5> jar1 = ggjar(jarfile,/tmp/JMX/2281258-wasjmx.jar,calchksum,1,calentropy,1)
create jar1 variable and assign it the result of GG function ggjar() for /tmp/JMX/2281258-wasjmx.jar archive

ASPL 6> jar2 = ggjar(jarfile,/tmp/JMX/2376115-wasjmx.jar,calchksum,1,calentropy,1)
create jar1 variable and assign it the result of GG function ggjar() for /tmp/JMX/2376115-wasjmx.jar archive

ASPL 7> displayon
turn display on

ASPL 8> print ##### SHOWING THE GROUP UNION #####
print an information string ##### SHOWING THE GROUP UNION #####

ASPL 9> ,gU jar0 jar1 jar2
show the difference between all three JAR archives by displaying the labinated group union of the set variables jar0 jar1 jar2

ASPL 10> print ##### SHOWING SET SIMILARITY #####

ASPL 11> sim jar0 jar1 jar2
show the similarity between all three JAR archives, notice that they really look similar when considering only the file names regardless of their checksums

ASPL 12> print ##### SHOWING SET SIMILARITY w. FILE CHECKSUMS #####
print an information string ##### SHOWING SET SIMILARITY w. FILE CHECKSUMS #####

ASPL 13> sim`fflc jar0 jar1 jar2
show the similarity between all three JAR archives considering the checksum of the files in the archives, notice how similarity dropped since many files by the same name are different

ASPL 14> print ##### SHOWING ASPL SYMBOL TABLE #####

ASPL 15> v
display the symbol table