Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 22nd October 2016
jb_daefo jb_daefo is offline
Spam Deminer
Join Date: May 2008
Posts: 302
Default new perl code from web

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.

perl [ program below.pl] [binary ]


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.
	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";
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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

All times are GMT. The time now is 02:43 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick