1. #!/usr/bin/perl 2. 3. use strict; 4. use warnings; 5. 6. usage() unless @ARGV > 1; 7. sub usage { print join "",<DATA>; exit; } 8. 9. my $interpreter = "aspl -groupingclass POSIX -wsname TRANSIENT -dm 3 -singlepass"; 10. 11. # make sure the Jar files are readable 12. for (my $i=0; $i<@ARGV; $i++) { 13. die " PROGRAM EXITING BECAUSE CANNOT READ FILE $ARGV[$i]\n" unless -r $ARGV[$i]; 14. } 15. 16. # build the ASPL script 17. my $s = qq~ 18. timeout 120 19. ks chksum size ppdd ffl 20. displayoff 21. ~; 22. 23. my @v; 24. for (my $i=0; $i<@ARGV; $i++) { 25. # adding aspl variables jar0 jar1 jar2 .. assigned to ggjar() 26. $s .= "jar$i = ggjar(jarfile,$ARGV[$i],calchksum,1,calentropy,1)\n"; 27. # save the ASPL variables on the Perl stack (jar1 jar2 ..) in @v 28. push(@v,"jar$i"); 29. } 30. 31. $s .= qq~ 32. displayon 33. print ##### SHOWING THE GROUP UNION ##### 34. ,gU @v 35. print ##### SHOWING SET SIMILARITY ##### 36. sim @v 37. print ##### SHOWING SET SIMILARITY w. FILE CHECKSUMS ##### 38. sim`fflc @v 39. print ##### SHOWING ASPL SYMBOL TABLE ##### 40. v 41. 42. ~; 43. 44. open(ASPL, "| $interpreter -STDIN") or die "ERROR OPENING A PIPE TO aspl: $! \n"; 45. print ASPL $s; 46. close ASPL; 47. exit 0; 48. 49. __END__ 50. 51. jarsimilarity.pl compares a list of JAR archives via the ASPL interpreter. 52. 53. jarsimilarity.pl jarfile1 jarfile2 jarfile3 ... 54. 55. 56. Examples: 57. 58. jarsimilarity.pl /tmp/TX/27238-tx.jar /tmp/TX/38141-tx.jar /tmp/TX/38478-tx.jar 59. jarsimilarity.pl /tmp/JMX/2141611-wasjmx.jar /tmp/JMX/2151754-wasjmx.jar /tmp/JMX/2281258-wasjmx.jar /tmp/JMX/2376115-wasjmx.jar 60. jarsimilarity.pl /tmp/JMX/2151754-wasjmx.jar /tmp/JMX/2281258-wasjmx.jar /tmp/JMX/2376115-wasjmx.jar 61. 62.