- Timestamp:
- 09/01/09 00:40:39 (6 months ago)
- Location:
- bin
- Files:
-
- 2 modified
-
appFormat.pl (modified) (6 diffs)
-
sshjour (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bin/appFormat.pl
r1170 r1205 7 7 8 8 use File::Find; 9 use Getopt::Long; 10 use Pod::Usage; 9 11 10 12 sub machCPU { … … 37 39 read($df, my $data, 20) == 20 or return; 38 40 my $cpu = unpack($tmpl, substr($data, 0, 4)); 39 push @types, machCPU($cpu); 41 my $cpudesc = machCPU($cpu); 42 push @types, $cpudesc if $cpudesc; 40 43 } 41 44 return @types; … … 74 77 } 75 78 close $df; 79 return undef unless @types; 76 80 77 81 my %exec = (types => \@types, … … 133 137 } 134 138 139 # New apps should include Mach-O x86 or Mach-O AMD64 140 sub newExecType { 141 my $exec = shift; 142 my %okcpu = map { $_ => 1 } qw(x86 AMD64); 143 return grep { $_->{format} eq 'Mach-O' && $okcpu{$_->{cpu}} } @{$exec->{types}}; 144 } 145 135 146 sub dumpObj { 136 147 my $exec = shift; … … 160 171 } 161 172 162 sub findApps { 173 sub findPred { 174 my $pred = shift; 163 175 find(sub { 164 176 return unless -f; 165 177 my $exec = executableType($_) or return; 178 return unless $pred->($exec); 166 179 print "$File::Find::name\n"; 167 180 dumpObj($exec, " "); … … 169 182 } 170 183 171 findApps(@ARGV); 184 =head1 NAME 185 186 appFormat.pl - Find the format of Mac apps 187 188 =head1 SYNOPSIS 189 190 appFormat.pl [options] [path ...] 191 192 Options: 193 -o, --old Find only old apps 194 -h, --help Print this message 195 196 =cut 197 198 my $pred = sub { 1 }; # TRUE 199 my $help = 0; 200 GetOptions( 201 'old' => sub { $pred = sub { !newExecType(@_) } }, 202 'help' => \$help) or pod2usage(2); 203 pod2usage(1) if $help; 204 205 my @search = @ARGV ? @ARGV : ('.'); 206 findPred($pred, @search); -
bin/sshjour
r1195 r1205 10 10 end 11 11 12 unless found 13 STDERR.puts "Can't find host!" 14 exit 1 15 end 16 12 17 exec('nc', found, fport || '22')
