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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? psa-chapter05.txt

?? perl語言的經典文章
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
#*
#* generate complete set of DNS config files and check into RCS
#*

use Rcs;

$datafile   = "./database"; # our host database
$outputfile = "zone.$$";    # our temporary output file
$target     = "zone.db";    # our target output
$revtarget  = "rev.db";     # out target output for the reverse mapping
$defzone    = ".oog.org";   # the default zone being created
$recordsep  = "-=-\n";     

# get today's date in the form of YYYYMMDD 
@localtime = localtime;
$today = sprintf("%04d%02d%02d",$localtime[5]+1900,
                                $localtime[4]+1,
                                $localtime[3]);

# get username on either NT/2000 or UNIX
$user = ($^O eq "MSWin32")? $ENV{USERNAME} :
                            (getpwuid($<))[6]." (".(getpwuid($<))[0].")";

$/=$recordsep;

# read in the database file
open(DATA,$datafile) or die "Unable to open datafile:$!\n";

while (<DATA>) {
    chomp; # remove record separator
    # split into key1,value1
    @record = split /:\s*|\n/m; 

    $record ={};                     # create a reference to empty hash
    %{$record} = @record;            # populate that hash with @record

    # check for bad hostname
    if ($record->{name} =~ /[^-.a-zA-Z0-9]/) {
	warn "!!!! ",$record->{name} .
	     " has illegal host name characters, skipping...\n";
	next;
    }

    # check for bad aliases
    if ($record->{aliases} =~ /[^-.a-zA-Z0-9\s]/) {
	warn "!!!! " . $record->{name} .
	     " has illegal alias name characters, skipping...\n";
	next;
    }

    # check for missing address
    unless ($record->{address}) {
	warn "!!!! " . $record->{name} .
             " does not have an IP address, skipping...\n";
	next;
    }

    # check for duplicate address
    if (defined $addrs{$record->{address}}) {
	warn "!!!! Duplicate IP addr:" . $record->{name}.
	     " & " . $addrs{$record->{address}} . ", skipping...\n";
	next;
    }
    else {
	$addrs{$record->{address}} = $record->{name};
    }

    $entries{$record->{name}} = $record; # add this to a hash of hashes

}
close(DATA);

$header = &GenerateHeader;

# create the forward mapping file
open(OUTPUT,"> $outputfile") or 
  die "Unable to write to $outputfile:$!\n";
print OUTPUT $header;

foreach my $entry (sort byaddress keys %entries) {
    print OUTPUT
          "; Owned by ",$entries{$_}->{owner}," (",
          $entries{$entry}->{department},"): ",
          $entries{$entry}->{building},"/",
          $entries{$entry}->{room},"\n";

    # print A record
    printf OUTPUT "%-20s\tIN A     %s\n",      
      $entries{$entry}->{name},$entries{$entry}->{address};

    # print any CNAMES (aliases)
    if (defined $entries{$entry}->{aliases}){
	foreach my $alias (split(' ',$entries{$entry}->{aliases})) {
	    printf OUTPUT "%-20s\tIN CNAME %s\n",$alias,
		                                 $entries{$entry}->{name};
	}
    }
    print OUTPUT "\n";
}

close(OUTPUT);

Rcs->bindir('/usr/local/bin');
my $rcsobj = Rcs->new;
$rcsobj->file($target);
$rcsobj->co('-l');
rename($outputfile,$target) or 
  die "Unable to rename $outputfile to $target:$!\n";
$rcsobj->ci("-u","-m"."Converted by $user on ".scalar(localtime));

# now create the reverse mapping file
open(OUTPUT,"> $outputfile") or 
  die "Unable to write to $outputfile:$!\n";
print OUTPUT $header;
foreach my $entry (sort byaddress keys %entries) {
    print OUTPUT
          "; Owned by ",$entries{$entry}->{owner}," (",
          $entries{$entry}->{department},"): ",
          $entries{$entry}->{building},"/",
          $entries{$entry}->{room},"\n";

    printf OUTPUT "%-3d\tIN PTR    %s$defzone.\n\n", 
      (split/\./,$entries{$entry}->{address})[3], $entries{$entry}->{name};

}

close(OUTPUT);
$rcsobj->file($revtarget);
$rcsobj->co('-l'); # assumes target has been checked out at least once
rename($outputfile,$revtarget) or 
  die "Unable to rename $outputfile to $revtarget:$!\n";
$rcsobj->ci("-u","-m"."Converted by $user on ".scalar(localtime));

sub GenerateHeader{
    my($header);
    if (open(OLDZONE,$target)){
	while (<OLDZONE>) {
	    next unless (/(\d{8}).*serial/);
	    $oldserial = $1;
	    last;
	}
	close(OLDZONE);
    }
    else {
	$oldserial = "000000";
    }
    
    $olddate = substr($oldserial,0,6);
    $count = ($olddate == $today) ? substr($oldserial,6,2)+1 : 0;

    $serial = sprintf("%6d%02d",$today,$count);

    $header .= "; dns zone file - GENERATED BY $0\n";
    $header .= "; DO NOT EDIT BY HAND!\n;\n";
    $header .= "; Converted by $user on ".scalar(localtime)."\n;\n";

    # count the number of entries in each department and then report
    foreach $entry (keys %entries){
        $depts{$entries{$entry}->{department}}++;
    }
    foreach $dept (keys %depts) {
        $header .= "; number of hosts in the $dept department: 
                    $depts{$dept}.\n";
    }
    $header .= "; total number of hosts: ".scalar(keys %entries)."\n#\n\n";

    $header .= <<"EOH";

@ IN SOA   dns.oog.org. hostmaster.oog.org. (
                          $serial ; serial
                            10800    ; refresh
                            3600     ; retry
                            604800   ; expire
                            43200)   ; TTL

@                           IN  NS  dns.oog.org.

EOH

    return $header;
}

sub byaddress {
   @a = split(/\./,$entries{$a}->{address});
   @b = split(/\./,$entries{$b}->{address});
   ($a[0]<=>$b[0]) ||
   ($a[1]<=>$b[1]) ||
   ($a[2]<=>$b[2]) ||
   ($a[3]<=>$b[3]);
}
-------
#*
#* checking DNS server response integrity using nslookup
#*

use Data::Dumper;

$hostname = $ARGV[0];
$nslookup = "/usr/local/bin/nslookup";              # nslookup binary
@servers = qw(nameserver1 nameserver2 nameserver3); # name of the name servers
foreach $server (@servers) {
    &lookupaddress($hostname,$server);              # populates %results
}
%inv = reverse %results;                            # invert the result hash
if (scalar(keys %inv) > 1) {                       
    print "There is a discrepancy between DNS servers:\n";
    print Data::Dumper->Dump([\%results],["results"]),"\n";
}

# ask the server to look up the IP address for the host
# passed into this program on the command line, add info to 
# the %results hash
sub lookupaddress {
    my($hostname,$server) = @_;

    open(NSLOOK,"$nslookup $hostname $server|") or
      die "Unable to start nslookup:$!\n";
    
    while (<NSLOOK>) {
        # ignore until we hit "Name: "
	next until (/^Name:/);              
        # next line is Address: response
	chomp($results{$server} = <NSLOOK>); 
        # remove the field name
        die "nslookup output error\n" unless /Address/;
	$results{$server} =~ s/Address(es)?:\s+//;	    
        # we're done with this nslookup 
        last;
    }
    close(NSLOOK);
}
-------
#*
#* checking DNS server response integrity "by hand" using raw sockets
#*

use IO::Socket;
$hostname = $ARGV[0];
$defdomain = ".oog.org"; # default domain if not present

@servers = qw(nameserver1 nameserver2 nameserver3); # name of the name servers
foreach $server (@servers) {
    &lookupaddress($hostname,$server);              # populates %results
}
%inv = reverse %results;        # invert the result hash
if (scalar(keys %inv) > 1) {    # see how many elements it has
    print "There is a discrepancy between DNS servers:\n";
    use Data::Dumper;
    print Data::Dumper->Dump([\%results],["results"]),"\n";
}

sub lookupaddress{
    my($hostname,$server) = @_;

    my($qname,$rname,$header,$question,$lformat,@labels,$count);
    local($position,$buf);

    ###
    ### Construct the packet header
    ###
    $header = pack("n C2 n4", 
		   ++$id,  # query id
		   1,  # qr, opcode, aa, tc, rd fields (only rd set)
		   0,  # rd, ra
		   1,  # one question (qdcount)
		   0,  # no answers (ancount)
		   0,  # no ns records in authority section (nscount)
		   0); # no addtl rr's (arcount)

    # if we do not have any separators in the name of the host, 
    # append the default domain
    if (index($hostname,'.') == -1) {
	$hostname .= $defdomain;
    }
    
    # construct the qname section of a packet (domain name in question) 
    for (split(/\./,$hostname)) {
	$lformat .= "C a* ";
	$labels[$count++]=length;
	$labels[$count++]=$_;
    }
    
    ###
    ### construct the packet question section
    ###
    $question = pack($lformat."C n2",
		     @labels,
		     0,  # end of labels
		     1,  # qtype of A 
		     1); # qclass of IN
    
    ###
    ### send the packet to the server and read the response
    ###
    $sock = new IO::Socket::INET(PeerAddr => $server,
				 PeerPort => "domain",
				 Proto    => "udp");
    
    $sock->send($header.$question);
    # we're using UDP, so we know the max packet size
    $sock->recv($buf,512); 
    close($sock);
    
    # get the size of the response, since we're going to have to keep 
    # track of where we are in the packet as we parse it (via $position)
    $respsize = length($buf);
    
    ### 
    ### unpack the header section
    ###
    ($id,
     $qr_opcode_aa_tc_rd,
     $rd_ra,
     $qdcount,
     $ancount,
     $nscount,
     $arcount) = unpack("n C2 n4",$buf);
    
    if (!$ancount) {
	warn "Unable to lookup data for $hostname from $server!\n";
	return;
    }

    ###
    ### unpack the question section
    ###
    # question section starts 12 bytes in
    ($position,$qname) = &decompress(12); 
    ($qtype,$qclass)=unpack('@'.$position.'n2',$buf);
    # move us forward in the packet to end of question section
    $position += 4; 
    
    ###
    ### unpack all of the resource record sections
    ###
    for ( ;$ancount;$ancount--){
	($position,$rname) = &decompress($position);
	($rtype,$rclass,$rttl,$rdlength)=
	  unpack('@'.$position.'n2 N n',$buf);
	$position +=10;
        # this next line could be changed to use a more sophisticated 
        # data structure, it currently picks the last rr returned            
        $results{$server}=
	  join('.',unpack('@'.$position.'C'.$rdlength,$buf));
	$position +=$rdlength;
    }
}    

# handle domain information which is "compressed" as per RFC1035
# we take in the starting position of our packet parse and return
# the name we found (after dealing with the compressed format pointer)
# and the place we left off in the packet at the end of the name we found
sub decompress { 
    my($start) = $_[0];
    my($domain,$i,$lenoct);
    
    for ($i=$start;$i<=$respsize;) { 
	$lenoct=unpack('@'.$i.'C', $buf); # get the length of label

	if (!$lenoct){        # 0 signals we are done with this section
	    $i++;
	    last;
	}

	if ($lenoct == 192) { # we've been handed a pointer, so recurse
	    $domain.=(&decompress((unpack('@'.$i.'n',$buf) & 1023)))[1];
	    $i+=2;
	    last
	}
	else {                # otherwise, we have a plain label
	    $domain.=unpack('@'.++$i.'a'.$lenoct,$buf).'.';
	    $i += $lenoct;
	}
    }
    return($i,$domain);
}
-------
#*
#* checking DNS server response integrity using Net::DNS
#*

use Net::DNS;

@servers = qw(nameserver1 nameserver2 nameserver3); # name of the name servers
foreach $server (@servers) {
    &lookupaddress($hostname,$server);              # populates %results
}
%inv = reverse %results;        # invert the result hash
if (scalar(keys %inv) > 1) {   # see how many elements it has
    print "There is a discrepency between DNS servers:\n";
    use Data::Dumper;
    print Data::Dumper->Dump([\%results],["results"]),"\n";
}

# only slightly modified from example in the Net::DNS manpage
sub lookupaddress{
    my($hostname,$server) = @_;

    $res = new Net::DNS::Resolver;

    $res->nameservers($server);

    $packet = $res->query($hostname);

    if (!$packet) {
	warn "Unable to lookup data for $hostname from $server!\n";
	return;
    }
    # stores the last RR we receive
    foreach $rr ($packet->answer) {
	$results{$server}=$rr->address;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合激情网...| 亚洲精品日韩专区silk| 国产成人综合亚洲91猫咪| 1区2区3区精品视频| 欧美成人福利视频| 极品少妇xxxx精品少妇偷拍| 亚洲美女视频在线观看| 久久久九九九九| 日韩午夜激情av| 欧美熟乱第一页| 国产成人在线看| 日韩av一二三| 亚洲伊人伊色伊影伊综合网| 欧美国产精品劲爆| 久久综合九色综合欧美就去吻| 国产成人av电影在线观看| 五月天国产精品| 亚洲成人自拍网| 亚洲一级二级三级| 一区二区免费视频| 一区二区三区中文免费| 国产精品久久看| 国产日韩精品久久久| 亚洲精品一区在线观看| 欧美电影免费观看完整版| 欧美精品一区二区三区一线天视频| 欧美精品日韩精品| 色综合久久中文字幕综合网| 成人app网站| 91视频你懂的| 欧美午夜免费电影| 这里是久久伊人| 亚洲欧美偷拍另类a∨色屁股| 亚洲一区成人在线| 日本免费新一区视频| jizzjizzjizz欧美| 91福利社在线观看| 日韩av在线播放中文字幕| 日本亚洲欧美天堂免费| 午夜精品视频在线观看| 午夜欧美一区二区三区在线播放| 一级日本不卡的影视| 亚洲一区二区三区四区不卡| 成人三级伦理片| 99精品视频一区二区| 欧美精品日日鲁夜夜添| 日本一区二区三级电影在线观看 | 国产精品女主播在线观看| 亚洲视频 欧洲视频| 美女被吸乳得到大胸91| 粉嫩av一区二区三区| 欧美激情一区在线| 日韩精品高清不卡| 亚洲成人激情av| 久久精品国产久精国产| 国产美女在线观看一区| 偷窥少妇高潮呻吟av久久免费 | 欧美一区二区三区四区在线观看 | 91麻豆蜜桃一区二区三区| 欧美日韩精品一区二区天天拍小说 | 午夜精品久久久久影视| 国产精品久久久久久久午夜片| 欧美www视频| 精品久久久久久久一区二区蜜臀| 精品99一区二区| 日本一区二区三区视频视频| 亚洲午夜免费电影| 免费高清在线一区| 免费观看一级欧美片| 裸体一区二区三区| 久久久精品免费网站| 精品久久99ma| 日韩亚洲电影在线| 精品国偷自产国产一区| 日韩免费高清电影| wwwwxxxxx欧美| 亚洲成av人片在线观看| 麻豆精品视频在线观看免费| 色综合久久88色综合天天免费| 亚洲一二三级电影| 欧美性受xxxx黑人xyx| 97精品久久久午夜一区二区三区| 精品国产免费人成在线观看| 一区二区欧美视频| 91久久线看在观草草青青| **性色生活片久久毛片| 欧美日韩午夜精品| 国产原创一区二区| 99国产精品久久久久久久久久久| 欧美一区二区私人影院日本| 国产亚洲va综合人人澡精品| 亚洲人123区| 久久国产综合精品| 69堂亚洲精品首页| 中文字幕一区二区三中文字幕 | 7777精品伊人久久久大香线蕉的| 亚洲精品老司机| 6080午夜不卡| 亚洲午夜国产一区99re久久| 欧美一区二区三区性视频| 丁香激情综合国产| 洋洋成人永久网站入口| 91精品久久久久久久91蜜桃 | 91精品国产91久久综合桃花| 国产美女精品人人做人人爽| 国产精品福利电影一区二区三区四区| 91视频免费看| 国产美女主播视频一区| 亚洲成a人片在线不卡一二三区| 91一区一区三区| 久久精品噜噜噜成人av农村| 96av麻豆蜜桃一区二区| 日韩一区在线看| 91蝌蚪porny成人天涯| 中文字幕亚洲区| 91日韩一区二区三区| 亚洲欧洲日韩女同| 色老综合老女人久久久| 狠狠色丁香九九婷婷综合五月| 伊人色综合久久天天| 久久精品综合网| 成人福利在线看| 99精品视频在线免费观看| 国产精品久久午夜夜伦鲁鲁| 国产精品一区二区在线播放| 欧美精选在线播放| 播五月开心婷婷综合| 久久国产精品99久久人人澡| 国产精品电影院| 日本精品视频一区二区三区| 午夜精品福利视频网站| 中文字幕一区二区在线观看| 久久久精品tv| 精品国一区二区三区| 日韩午夜在线影院| 欧美一级淫片007| 色婷婷精品久久二区二区蜜臂av | 视频一区在线播放| 午夜电影网一区| 亚洲宅男天堂在线观看无病毒| 国产欧美综合在线| 亚洲视频综合在线| 婷婷久久综合九色综合绿巨人| 青娱乐精品在线视频| 国产精品99久久久久久久vr| 色综合天天综合| 欧美va亚洲va| 亚洲视频一区在线观看| 爽爽淫人综合网网站| 九九九久久久精品| 91传媒视频在线播放| 精品久久国产老人久久综合| 亚洲欧洲日韩在线| 蜜臀a∨国产成人精品| 色婷婷久久久亚洲一区二区三区 | 国产精品久久午夜| 久久国产乱子精品免费女| 色综合久久99| 国产女同性恋一区二区| 久久精品久久精品| 欧美另类变人与禽xxxxx| 日本一区二区三区国色天香| 视频一区在线播放| 91性感美女视频| 国产丝袜美腿一区二区三区| 日韩国产欧美三级| 欧美在线观看视频一区二区三区| 久久久久久97三级| 麻豆视频一区二区| 欧美一区在线视频| 亚洲成a人片综合在线| 欧美午夜精品久久久久久超碰| 国产精品美女视频| 不卡视频一二三四| 中文字幕亚洲一区二区va在线| 国内精品久久久久影院一蜜桃| 国产剧情一区二区| 精品日韩欧美一区二区| 奇米一区二区三区av| 欧美精品亚洲二区| 日本成人在线电影网| 91精品国产综合久久久久| 日日欢夜夜爽一区| 91麻豆精品国产91久久久久久久久 | 免费在线成人网| 久久夜色精品国产噜噜av| 极品少妇一区二区| 国产精品色在线| 在线观看视频一区| 五月综合激情日本mⅴ| 精品久久久影院| 97精品国产露脸对白| 亚洲国产另类av| 欧美精品一区二区在线播放| 岛国av在线一区| 五月天久久比比资源色| 欧美成人aa大片| 91麻豆免费视频| 精品一区二区三区日韩| 亚洲人成网站影音先锋播放|