#!/usr/bin/perl if ($#ARGV !=2) { print $#ARGV; print @ARGV; print "\nUsage: perl \n"; exit; } my $bin_file = $ARGV[0]; my $given_instr_file = $ARGV[1]; my $disas = $ARGV[2]; my $instr_file = " org.instr "; my $output_file = " CF_OP "; my $krug_op = " krug.op "; my $krug_instr = " krug.instr "; my $cmd1 = "cut -d' ' -f3 ".$given_instr_file." > ".$instr_file; print system($cmd1); my $cmd2 = "sed -i 's . ' ".$instr_file; print system($cmd2); my $cmd3 = $disas." ".$bin_file." > ".$krug_op; print system($cmd3); my $cmd4 = "cut -d':' -f1 ".$krug_op." > ".$krug_instr; print system($cmd4); my $cmd5 = "sed -i '1,2d' ".$krug_instr; print system($cmd5); my $cmd6 = "sed -i '/[...]/d' ".$krug_instr; print system($cmd6); my $cmd7 = "diff -w -B --suppress-common-lines ".$instr_file.$krug_instr." | sed -n -e '/^>/p' > ". $output_file; print system($cmd7); my $obf_lines = `wc -l $output_file | cut -d' ' -f1`; my $org_lines = `wc -l $instr_file | cut -d' ' -f1`; print "\n".$obf_lines; print "\n".$org_lines; print ($obf_lines/$org_lines); print "\n";