check_modules.pl

来自「在网络安全中经常会遇到rootkit」· PL 代码 · 共 95 行

PL
95
字号
#!/usr/bin/perl -w################################################################################### Perl module checker 0.0.3#################################################################################### This Perl script checks for installed modules by trying to 'use' the# module. If the check fails, then the module is not present.## If you want to install additional modules, use:# > perl -MCPAN -e shell# > install [module name]## If the first one fails, please install the perl-CPAN package first## Upgrade CPAN if possible:# > install Bundle::CPAN# > reload cpan## Digest modules:# > install Digest::MD5# > install Digest::SHA1##################################################################################use strict;my $check = "0";# Modules to checkmy @modCheck = qw(Digest::MD5Digest::SHA1);# Use command-line module names if present.@modCheck = @ARGV if (@ARGV);for (@modCheck)  {    if (installed("$_"))      {        print "$_ installed (version ",$check,").\n"      }     else      {        print "$_ NOT installed.\n"      }  }########################################### SUB: Installed modules##########################################sub installed  {    my $module = $_;    # Try to use the Perl module    eval "use $module";    # Check eval response    if ($@)      {        # Module is NOT installed        $check = 0;      }     else      {        # Module is installed (reset module version to '1')	$check = 1;	        my $version = 0;	# Try to retrieve version number (by using eval again)        eval "\$version = \$$module\::VERSION";		# Set version number if no problem occurred        $check = $version if (!$@);      }          # Return version number    return $check;}exit();# The end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?