By David N. Blank-Edelman
Price: $34.95 USD
£24.95 GBP
Cover | Table of Contents | Colophon
http://www.cpan.org. The easiest way to
find the modules on CPAN is to use the search engine developed and
maintained by Elaine Ashton, Graham Barr, and Clifton Posey at
http://search.cpan.org. The
"CPAN Search:" box makes it simple to find the right
modules for the job.
http://www.activestate.com/Products/ActivePerl//docs/faq/ActivePerl-faq2.html.
If a Win32 package we use does come from a repository other than
ActiveState's, I'll be sure to point you at it. For MacOS
modules, the canonical place to look is the MacPerl Module Porters
site at http://pudge.net/mmp/.
$< and
$> variables:# permanently drops privs
($<,$>) = (getpwnam('nobody'),getpwnam('nobody'));
$( and
$)to change the real and effective group IDs as
well.http://dwheeler.com/secure-programs/Secure-Programs-HOWTO.html is a HOWTO document for secure programming under Linux, but the concepts and techniques are applicable to other situations as well.http://www.cs.ucdavis.edu/~bishop/secprog.html contains more good secure programming resources from security expert Matt Bishop.http://www.homeport.org/~adam/review.html lists security code review guidelines by Adam Shostack.http://www.dnaco.net/~kragen/security-holes.html is a good paper on how to find security holes (especially in your own code) by Kragen Sitaker.http://www.shmoo.com/securecode/ offers an excellent collection of articles on how to write secure code. http://www.insecure.org/news/P55-07.txt or from the Phrack archives at http://www.phrack.com/archive.html.http://www.informatik.hu-berlin.de/~loewis/ntfs/
(now shipping with the Linux 2.2 kernels), I mounted the partition and was greeted
with what looked like all of my files intact.http://www.informatik.hu-berlin.de/~loewis/ntfs/
(now shipping with the Linux 2.2 kernels), I mounted the partition and was greeted
with what looked like all of my files intact./). To uniquely identify a file or
directory in a Unix filesystem, we construct a path starting with a
slash and then add directories, separating them with forward slashes,
as we descend deeper into the filesystem. The final component of this
path is the desired directory or filename. Directory and filenames in
modern Unix variants are case sensitive. Almost all ASCII characters
can be used in these names if you are crafty enough, but sticking to
alphanumeric characters and some limited punctuation will save you
hassle later.File::Find that allows Perl to emulate the Unix
find command. The easiest way to begin using this
module is to use the find2perl command to generate
prototypical Perl code for you.
@ARGV from a dialog box. Here's
a code snippet from Chris Nandor, co-author of MacPerl:
Power and Ease, to do this:
@ARGV = @ARGV ? @ARGV : split "\s",
MacPerl::Ask("Arguments?");
File::Find
module that find2perl and
find.pl use, so this should not be a real
problem. We'll show you how to call it directly later in this
chapter.
% find /home -name beesknees -print
% find2perl /home -name beesknees -print
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
require "find.pl";
# Traverse desired filesystems
&find('/home');
exit;
sub wanted {
/^beesknees$/ && print("$name\n");
}
require statement, then calls the subroutine
&find( ) with the name of the starting
directory. We'll discuss the purpose of the
&wanted( ) subroutine in a moment, since
that's where all of the interesting modifications we're
about to explore will live.#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options /dev/dsk/c0t0d0s7 /dev/dsk/c0d0t0d0s7 /home ufs 2 yes rq
$ quota -v sabramsPBHGetVInfo) to retrieve volume information,
but at the current time there is no MacPerl module available to make
calling this function easy. Instead, we have to take a roundabout
approach and ask the Finder to query this
information for us. This is easy in practice thanks to a glue module,
but the setup needed for this method makes MacOS the more difficult
operating system to deal with.http://pudge.net
or on CPAN. Bear with me as we go over this setup step by step:CPAN.pm module by Andreas J. König and other
handy modules we mentioned in Chapter 1. Even if
you don't want to query filesystem usage from MacOS,
you'll still be well served by installing this bundle. When you
install this bundle, be sure to follow all of the directions found in
the README file.Mac::AppleEvents::Simple module by dropping the distribution file on
top of the installme droplet.Mac::Glue
module. The
installme droplet decompresses and unpacks the
contents of the Mac::Glue distribution file into a
new folder as part of the installation process. Be sure to run the
gluedialect and gluescriptadds
setup scripts from the scripts subfolder of the
unpacked distribution.|
Name
|
CPAN ID
|
Version
|
|---|---|---|
File::Find (ships with Perl) | ||
File::Spec (ships with Perl) | ||
Cwd (ships with Perl) | ||
Win32::File::GetAttributes (ships with ActiveState
Perl) | ||
Win32::FileSecurity (ships with ActiveState Perl) | ||
File::Basename (ships with Perl) | ||
Getopt::Std (ships with Perl) | ||
Quota
|
TOMZO
|
1.2.3
|
|
cpan-mac (bundle)
|
CNANDOR
|
0.40
|
Mac::AppleEvents::Simple
|
CNANDOR
|
0.81
|
Mac::Glue
|
CNANDOR
|
0.58
|
http://pudge.net/macperl/tpc/98.dnb:fMP.olmno4jGA6:6700:520:David N. Blank-Edelman:/home/dnb:/bin/zsh
$passwd = "/etc/passwd";
open(PW,$passwd) or die "Can't open $passwd:$!\n";
while (<PW>){
($name,$passwd,$uid,$gid,$gcos,$dir,$shell) = split(/:/);
pack(
) and unpack( )) with the SAM,
providing you do so when NT/2000 is not running, but this way lies
madness and
misery.
C:\>net users
User accounts for \\HOTDIGGITYDOG
----------------------------------
Administrator Guest
The command completed successfully.
Win32::NetAdmin (bundled with the
ActiveState Perl distribution) or one of the modules created to fill
in the gaps in the functionality of
|
Name
|
CPAN ID
|
Version
|
|---|---|---|
User::pwent (ships with Perl) | ||
File::stat (ships with Perl) | ||
Win32::AdminMisc (found at http://www.roth.net) |
20000117
| |
Win32::Perms (found at http://www.roth.net) |
20000216
| |
Win32::Lanman (found at ftp://ftp.roth.net/pub/ntperl/Others/Lanman/) |
1.05
| |
IO::File (ships with Perl) |
GBARR
|
1.20
|
XML::Writer
|
DMEGG
|
0.30
|
XML::Parser
|
COOPERCL
|
2.27
|
Data::Dumper
|
GSAR
|
2.101
|
XML::Simple
|
GRANTM
|
1.01
|
http://www.freebsd.org/cgi/man.cgi is where the FreeBSD Project provides access to the online manual pages for *BSD and other Unix variants. This is a handy way to compare the file formats and user administration commands (useradd, et al.) for several operating systems.http://Jenda.Krynicky.cz is another site with useful Win32 modules applicable to user administration.http://windows.microsoft.com/windows2000/en/server/help/, from the Windows 2000 online help. (Navigate to the Active Directory→Concepts→Understanding Active Directory→Understanding Groups section.) This is a good overview of the new Windows 2000 group mechanisms.http://www.activestate.com/support/mailing_lists.htm hosts the Perl-Win32-Admin and Perl-Win32-Users mailing lists. Both lists and their archives are invaluable resources for Win32 programmers.http://www.mspress.com are the publishers of the Microsoft NT Resource kit. They also offer a subscription services that provides access to the latest RK utilities.http://www.roth.net is the home of Win32::AdminMisc, Win32::Perms, and other modules the Win32 community relies upon for user administration.Mac::Processes, we can interact with the Macintosh
Process Manager using the MacOS Toolbox API for process control. If
you are going to delve any deeper than surface level with this
module, you'll want to seek out a copy of the Inside
Macintosh:Processes volume that deals with the Process
Manager.
Mac::Processes via the standard
use Mac::Processes directive, it initializes a
special hash called %Process. This hash is magical
because it always contains a representation of the
current process state of the machine thanks to
Perl's tied variable functionality. Each time the contents of
%Process are accessed, information about the
machine's current running processes are returned. To see a list
of the current process serial numbers (the MacOS term for process ID,
often abbreviated as PSN ), we can simply query the list of keys in
this
hash:
use Mac::Processes;
print map{"$_\n"} keys %Process;
ProcessInfo structure. To
get at the individual fields of this structure, you call object
methods with their names. For more information on each field and what
it represents, see the canonical reference book Inside
Macintosh:Processes. The currently available method names
are processName( ), processNumber(
), processType( ),
processSignature( ), processSize(
), processMode( ),
processLocation( ), processLauncher(
), processLaunchDate( ),
processActiveTime( ), and
processAppSpec( ).use Mac::Processes;
while(($psn, $psi) = each (%Process)){
$name = $psi->processName( );
write;
}
format STDOUT_TOP =
Process Serial Number