亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? psa-chapter10.txt

?? perl語言的經(jīng)典文章
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
Example code from Perl for System Administration by David N. Blank-Edelman
O'Reilly and Associates, 1st Edition, ISBN 1-56592-609-9

Chapter Ten
===========

#*
#* a program for storing and checking file information
#*

use Getopt::Std;

# we use this for prettier output later in &printchanged()
@statnames = qw(dev ino mode nlink uid gid rdev 
                size mtime ctime blksize blocks);

getopt('p:c:');

die "Usage: $0 [-p <filename>|-c <filename>]\n"
  unless ($opt_p or $opt_c);

if ($opt_p){
    die "Unable to stat file $opt_p:$!\n" unless (-e $opt_p);
    print $opt_p,"|",join('|',(lstat($opt_p))[0..7,9..12]),"\n";
    exit;
}

if ($opt_c){
    open(CFILE,$opt_c) or die "Unable to open check file $opt_c:$!\n";
    while(<CFILE>){
        chomp;
        @savedstats = split('\|');
        die "Wrong number of fields in line beginning with $savedstats[0]\n"
          unless ($#savedstats == 12);
        @currentstats = (lstat($savedstats[0]))[0..7,9..12];
        
        # print the changed fields only if something has changed
        &printchanged(\@savedstats,\@currentstats)
          if ("@savedstats[1..13]" ne "@currentstats");
    }
    close(CFILE);
}

# iterates through attributes lists and prints any changes between
# the two
sub printchanged{
    my($saved,$current)= @_;
    
    # print the name of the file after popping it off of the array read
    # from the check file
    print shift @{$saved},":\n";

    for (my $i=0; $i < $#{$saved};$i++){
	if ($saved->[$i] ne $current->[$i]){
	    print "\t".$statnames[$i]." is now ".$current->[$i];
	    print " (should be ".$saved->[$i].")\n";
	}     
    }
}
-------
#*
#* print the MD5 fingerprint for the /etc/passwd file
#*

use Digest::MD5 qw(md5);

$md5 = new Digest::MD5;

open(PASSWD,"/etc/passwd") or die "Unable to open passwd:$!\n";

# these two lines called also be rolled into one:
#   print Digest::MD5->new->addfile(PASSWD)->hexdigest,"\n";
$md5->addfile(PASSWD);
print $md5->hexdigest."\n";

close(PASSWD);

-------
#*
#* our previous file checking code with MD5 functionality added
#*

use Getopt::Std;
use Digest::MD5 qw(md5);

@statnames = 
 qw(dev ino mode nlink uid gid rdev size mtime ctime blksize blocks md5);

getopt('p:c:');

die "Usage: $0 [-p <filename>|-c <filename>]\n"
  unless ($opt_p or $opt_c);

if ($opt_p){
    die "Unable to stat file $opt_p:$!\n" unless (-e $opt_p);

    open(F,$opt_p) or die "Unable to open $opt_p:$!\n";
    $digest = Digest::MD5->new->addfile(F)->hexdigest;
    close(F);

    print $opt_p,"|",join('|',(lstat($opt_p))[0..7,9..12]),"|$digest","\n";
    exit;
}

if ($opt_c){
    open(CFILE,$opt_c) or die "Unable to open check file $opt_c:$!\n";

    while (<CFILE>){
        chomp;
        @savedstats = split('\|');
        die "Wrong number of fields in \'$savedstats[0]\' line.\n"
          unless ($#savedstats == 13);

        @currentstats = (lstat($savedstats[0]))[0..7,9..12];

        open(F,$savedstats[0]) or die "Unable to open $opt_c:$!\n";
        push(@currentstats,Digest::MD5->new->addfile(F)->hexdigest);
        close(F);

        &printchanged(\@savedstats,\@currentstats)
          if ("@savedstats[1..13]" ne "@currentstats");
    }
    close(CFILE);
}

sub printchanged {
    my($saved,$current)= @_;
    
    print shift @{$saved},":\n";

    for (my $i=0; $i <= $#{$saved};$i++){
	if ($saved->[$i] ne $current->[$i]){
	    print " ".$statnames[$i]." is now ".$current->[$i];
	    print " (".$saved->[$i].")\n";
	}
    }
}
-------
#*
#* transfer and print a DNS zone 
#*

use Net::DNS;

# takes two command-line arguments: the first is the name server 
# to query, the 
# second is the domain to query from that name server
$server = new Net::DNS::Resolver;
$server->nameservers($ARGV[0]); 

print STDERR "Transfer in progress...";
@zone = $server->axfr($ARGV[1]);
die $server->errorstring unless (defined @zone);
print STDERR "done.\n";

for $record (@zone){
    $record->print;
}
-------
#*
#* show the MD5 fingerprint for a DNS zone
#*

use Net::DNS;
use FreezeThaw qw{freeze};
use Digest::MD5 qw(md5);

$server = new Net::DNS::Resolver;
$server->nameservers($ARGV[0]);

print STDERR "Transfer in progress...";
@zone = $server->axfr($ARGV[1]);
die $server->errorstring unless (defined @zone);
print STDERR "done.\n";

$zone = join('',sort map(freeze($_),@zone));

print "MD5 fingerprint for this zone transfer is: ";
print Digest::MD5->new->add($zone)->hexdigest,"\n";
-------
#*
#* look for suspect directory names in a filesystem
#*

require "find.pl";

# Traverse desired filesystems

&find('.');

sub wanted {
    
    (-d $_) and                            # is a directory and is not . or ..
      $_ ne "." and $_ ne ".." and         
	(/[^-.a-zA-Z0-9+,:;_~$#()]/ or     # or contains a "bad" character
	 /^\.{3,}/ or                      # or starts with at least 3 dots
	 /^-/) and                         # or begins with a dash
	   print "'".&nice($name)."'\n";
}

# print a "nice" version of the directory name, i.e. with control chars 
# explicated. This subroutine barely modified from &unctrl() in Perl's
# stock dumpvar.pl
sub nice {
    my($name) = $_[0];
    $name =~ s/([\001-\037\177])/'^'.pack('c',ord($1)^64)/eg;

    $name;
}
-------
#*
#* lastcheck - look for logins from more than N domains
#*

sub usage {
    print <<"EOU"
lastcheck - check the output of the last command on a machine
            to determine if any user has logged in from > N domains
            (inspired by an idea from Daniel Rinehart)

   USAGE:  lastcheck [args], where args can be any of:
    -i:           for IP #'s, treat class C subnets as the same "domain"
    -h:           this help message
    -f <domain>   count only foreign domains, specify home domain
    -l <command>: use <command> instead of default /usr/ucb/last
                  note: no output format checking is done!
    -m <#>:       max number of unique domains allowed, default 3
    -u <user>:    perform check for only this username
EOU
    exit;
}

use Getopt::Std;       # standard option processor
getopts('ihf:l:m:u:'); # parse user input

&usage if (defined $opt_h);

# number of unique domains before we complain
$maxdomains = (defined $opt_m) ? $opt_m : 3;  

$lastex = (defined $opt_l) ? $opt_l : "/usr/ucb/last";

open(LAST,"$lastex|") || die "Can't run the program $lastex:$!\n";
while (<LAST>){

    # ignore special users
    next if /^reboot\s|^shutdown\s|^ftp\s/; 

    # if we've used -u to specify a specific user, skip all entries
    # that don't pertain to this user (whose name is stored in $opt_u 
    # by getopts for us).           
    next if (defined $opt_u && !/^$opt_u\s/); 

    # ignore X console logins
    next if /:0\s+:0/;
    
    # find the user's name, tty, and remote hostname
    ($user, $tty,$host) = split;
    
    # ignore if the log had a bad user name after parsing
    next if (length($user) < 2);

    # ignore if no domain name info in name
    next if $host !~ /\./; 

    # find the domain name of this host (see explanation below)
    $dn = &domain($host);

    # ignore if you get a bogus domain name
    next if (length ($dn) < 2); 

    # ignore this input line if it is in the home domain as specified 
    # by the -f switch
    next if (defined $opt_f && ($dn =~ /^$opt_f/));
     
    # if we've never seen this user before, simply create a list with 
    # the user's domain and store this in the hash of lists.
    unless (exists $userinfo{$user}){ 
	$userinfo{$user} = [$dn];
    }
    # otherwise, this can be a bit hairy, see the explanation below
    else {
	&AddToInfo($user,$dn); 
   }
}
close(LAST);

# take a FQDN and attempt to return FQD
sub domain{
    # look for IP addresses
    if ($_[0] =~ /^\d+\.\d+\.\d+\.\d+$/) {
	
	# if the user did not use -i, simply return the IP address as is
	unless (defined $opt_i){ 
	    return $_[0]; 
	}
	# otherwise, return everything but the last octet
	else {
	    $_[0] =~ /(.*)\.\d+$/;
	    return $1;
	}
    }

    # if we are not dealing with an IP address
    else {
	# downcase the info to make later processing simpler and quicker
	$_[0] = lc($_[0]);
	
	# then return everything after first dot
	$_[0] =~ /^[^.]+\.(.*)/; 
	return $1;
    }
}

sub AddToInfo{
    my($user, $dn) = @_;

    for (@{$userinfo{$user}}){

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品免费看国产免费软件| 欧美亚洲尤物久久| 亚洲成av人影院| 久久久久国产精品麻豆ai换脸 | 亚洲自拍偷拍av| 精品国产免费一区二区三区四区 | 蜜乳av一区二区| 亚洲欧洲日本在线| 欧美本精品男人aⅴ天堂| 91网站最新网址| 国产精品一区二区三区网站| 播五月开心婷婷综合| 免费在线看一区| 又紧又大又爽精品一区二区| 国产亚洲综合在线| 777午夜精品视频在线播放| 成人午夜又粗又硬又大| 理论电影国产精品| 亚洲成人久久影院| 一区二区三区加勒比av| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美精品在线观看一区二区| 91在线观看高清| 高清av一区二区| 黑人精品欧美一区二区蜜桃 | 成人毛片老司机大片| 激情成人综合网| 免费成人在线观看| 日本伊人色综合网| 日韩和欧美一区二区| 亚洲一区二区影院| 亚洲色图清纯唯美| 国产精品久久久久久户外露出| 国产亚洲欧美激情| wwwwww.欧美系列| 久久亚洲二区三区| 欧美精品一区二区在线播放| 精品免费日韩av| 精品美女在线播放| 精品1区2区在线观看| 精品精品欲导航| xnxx国产精品| 久久欧美一区二区| 国产人成一区二区三区影院| 久久综合色天天久久综合图片| 精品美女在线播放| 国产亚洲综合在线| 麻豆国产一区二区| 久草在线在线精品观看| 国产综合久久久久影院| 国产一区在线精品| 高清免费成人av| 99re免费视频精品全部| 色婷婷综合视频在线观看| 日本精品视频一区二区三区| 在线免费观看日本欧美| 欧美精品一卡二卡| 337p日本欧洲亚洲大胆精品| 国产欧美日本一区视频| 中文字幕在线观看不卡视频| 一区二区三区精品| 美女www一区二区| 国产成人久久精品77777最新版本| 波多野结衣中文一区| 一本一本大道香蕉久在线精品| 欧美日韩国产另类不卡| 精品国产一区二区精华| 国产精品每日更新| 一区二区三区加勒比av| 美女尤物国产一区| 国产成人av电影| 在线观看国产一区二区| 欧美一级日韩一级| 国产欧美日韩不卡| 亚洲一卡二卡三卡四卡| 久久精品国产免费| 91一区一区三区| 欧美一级片在线| 欧美激情一区二区三区全黄 | 久久91精品国产91久久小草| 国产精品综合av一区二区国产馆| 99re热这里只有精品视频| 制服丝袜日韩国产| 中文字幕不卡的av| 亚洲一区二区三区小说| 国产精品亚洲午夜一区二区三区| 97aⅴ精品视频一二三区| 91精品婷婷国产综合久久| 国产色综合久久| 午夜伦欧美伦电影理论片| 成人免费视频视频在线观看免费 | 国产成人自拍网| 欧美在线观看你懂的| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲宅男天堂在线观看无病毒| 国产资源精品在线观看| 欧美唯美清纯偷拍| 国产精品久线观看视频| 久久99精品久久久久久国产越南| 91免费看片在线观看| www亚洲一区| 日韩在线观看一区二区| 日本久久一区二区| 日本一区二区在线不卡| 美女视频第一区二区三区免费观看网站| a级精品国产片在线观看| 精品成人一区二区三区四区| 亚洲观看高清完整版在线观看| 成人三级伦理片| 久久久久久久一区| 奇米色777欧美一区二区| 欧美综合在线视频| 国产精品婷婷午夜在线观看| 欧美军同video69gay| ㊣最新国产の精品bt伙计久久| 国产在线一区二区综合免费视频| 欧美日韩成人在线| 亚洲精品欧美激情| 99精品桃花视频在线观看| 欧美精品一区二区高清在线观看| 日韩中文字幕一区二区三区| 欧美天堂一区二区三区| 亚洲精品国产成人久久av盗摄| 成人性生交大片免费看在线播放 | 精久久久久久久久久久| 91精品免费在线观看| 亚洲va韩国va欧美va精品 | 69堂亚洲精品首页| 亚洲综合免费观看高清完整版在线 | 99视频在线精品| 久久国产精品99久久人人澡| 懂色av一区二区三区蜜臀| 欧美电影免费观看高清完整版在| 视频一区在线播放| 91首页免费视频| 欧美一区二区三区视频在线 | 亚洲人成小说网站色在线| 国产丶欧美丶日本不卡视频| 精品成人私密视频| 国产黄色成人av| 欧美激情在线免费观看| 国产二区国产一区在线观看| 国产午夜精品理论片a级大结局| 国产一区二区视频在线播放| 欧美成人激情免费网| 久久精品理论片| 久久久久国产成人精品亚洲午夜| 国产乱码一区二区三区| 国产精品视频麻豆| 国产白丝精品91爽爽久久| 亚洲国产成人午夜在线一区| 99精品在线观看视频| 一区二区三区精品在线观看| 欧美欧美午夜aⅴ在线观看| 日韩电影在线一区| 精品女同一区二区| 国产91精品精华液一区二区三区| 综合激情成人伊人| 欧美亚洲动漫精品| 老司机精品视频线观看86| 久久久噜噜噜久噜久久综合| 99久久精品免费看国产免费软件| 一区二区三区精品在线| 7777精品伊人久久久大香线蕉| 国产在线精品视频| 亚洲欧美日韩一区二区三区在线观看| 欧洲人成人精品| 美女看a上一区| 国产精品女主播av| 欧美在线一区二区| 精品无人区卡一卡二卡三乱码免费卡| 国产日韩欧美综合在线| 成人午夜精品在线| 亚洲一线二线三线视频| 日韩精品中文字幕一区| 顶级嫩模精品视频在线看| 亚洲精品免费在线观看| 精品国产亚洲在线| 色婷婷av一区| 激情图片小说一区| 国产精品色哟哟| 日韩成人午夜精品| 日韩精品中文字幕在线不卡尤物| 国产乱码精品一区二区三区五月婷| 国产日产欧美一区二区三区| 91网址在线看| 日韩 欧美一区二区三区| 久久一区二区三区四区| www.色综合.com| 亚洲综合成人网| 欧美精品一区男女天堂| 99久久精品国产网站| 男女性色大片免费观看一区二区| 国产精品久久久久久久午夜片| 欧美一级理论片| 亚洲免费在线观看视频| 精品播放一区二区| 99久久久国产精品| 国产精品一区三区| 秋霞av亚洲一区二区三|