Perl Program to find a jar persent within a jar
This .pl program is used to find a jar within a jar present in the directory/sub-directories:
main();
sub main
{
$list = "<root>/results/list.txt";
system("touch $list");
#system("find \. \-name \\\*\.jar > $list ");
system("find . -name *.jar > $list");
open(FILE,"$list");
$class="@ARGV[0]";
$flag=1;
print "$class in follwing jar files:::\n";
system("rm -f <root>/results/class_find");
system("touch <root>/results/class_find");
$dest = ("<root>/results/class_find");
while(<FILE>)
{
chop;
$fileName="$_";
@command=("unzip -l $fileName|grep $class >> $dest");
$flag=system("@command");
if($flag == 0)
{
print("JAR FILENAME: $fileName\n");
$flag=1;
}
}
}
main();
sub main
{
$list = "<root>/results/list.txt";
system("touch $list");
#system("find \. \-name \\\*\.jar > $list ");
system("find . -name *.jar > $list");
open(FILE,"$list");
$class="@ARGV[0]";
$flag=1;
print "$class in follwing jar files:::\n";
system("rm -f <root>/results/class_find");
system("touch <root>/results/class_find");
$dest = ("<root>/results/class_find");
while(<FILE>)
{
chop;
$fileName="$_";
@command=("unzip -l $fileName|grep $class >> $dest");
$flag=system("@command");
if($flag == 0)
{
print("JAR FILENAME: $fileName\n");
$flag=1;
}
}
}
Comments
Post a Comment