![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Found on perlmonks.org today...
One can check ascii from binaries, for example manpages embedded and/or .so. files found as dependencies Might be a duplicate of a tool in base. Usage: perl [ program below.pl] [binary ] Code:
#!perl use 5.010_000; use warnings; use strict; if ((@ARGV < 1)) { $0 =~ m#([^\\/]+$)#; my $name = $1 // $0; print STDERR "$name file ...\n" . <<'_DESCRIPTION_'; Extract ASCII strings from files listed. Multiple files allowed. _DESCRIPTION_ exit 1; } for my $file (@ARGV) { open my $fh, '<:bytes', $file or die "Error: Can't open '$file': $!\n"; my $buf; while (read $fh, $buf, 1024) { my @strings = split /\P{PosixGraph}/, $buf; for (@strings) { next if /^\s*$/; print "$_\n"; } } }
__________________
FreeBSD 13-STABLE |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Installation of Perl | ed.n1n2 | OpenBSD Packages and Ports | 17 | 10th April 2015 04:34 AM |
new perl! | thirdm | OpenBSD General | 0 | 26th March 2013 03:41 PM |
Perl 5.16.0 now available | J65nko | News | 1 | 22nd May 2012 05:37 PM |
Learning Perl | mtx | Book reviews | 7 | 22nd October 2008 05:55 PM |
perl/tk | bsdnewbie999 | OpenBSD Packages and Ports | 4 | 8th August 2008 12:34 AM |