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

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

?? psa-chapter04.txt

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

Chapter Four
============
#*
#* show the PSN list under Mac OS
#*

use Mac::Processes;
print map{"$_\n"} keys %Process;
-------
#*
#* show the list of running processes and their names under Mac OS
#*

use Mac::Processes;
while(($psn, $psi) = each (%Process)){
  $name = $psi->processName();	
  write;
}

format STDOUT_TOP =
Process Serial Number      Process Name
=====================      =========================================
.

format STDOUT =
@<<<<<<                    @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$psn,                      $name
.
-------
#*
#* show the process list on NT/2000 using PULIST from the NT Resource Kit
#*

$pulistexe = "\\bin\\PULIST.EXE"; # location of the executable
open(PULIST,"$pulistexe|") or die "Can't execute $pulistexe:$!\n";

scalar <PULIST>; # drop the first title line
while(defined($_=<PULIST>)){
    ($pname,$pid,$puser) = /^(\S+)\s*(\d+)\s*(.+)/;
    print "$pname:$pid:$puser\n";

close(PULIST);
-------
#*
#* show the list of process ids under NT/2000 using Win32::IProc
#*
use Win32::IProc;

# note case of object is important, must be "IProc"
$pobj = new Win32::IProc or die "Unable to create proccess object: $!\n";

$pobj-> EnumProccesses(\@processlist) or 
   die "Unable to get process list:$!\n";
-------
#*
#* show the list of process ids and names under NT/2000 using Win32::IProc
#*
use Win32::IProc;

$pobj=new Win32::IProc or die "Unable to create process object: $!\n";

$pobj->EnumProcesses(\@processlist) or 
  die "Unable to get process list:$!\n";

foreach $process (@processlist){
  $pid  = $process->{ProcessId};
  $name = $process->{ProcessName};
  write;
}

format STDOUT_TOP =
Process ID      Process Name
==========      ===============================
.
format STDOUT =
@<<<<<<<        @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pid,           $name
.
-------
#*
#* show the list of process names and their dlls using Win32::IProc
#*

# imports the FULLPATH constant to show the path for the dlls, could be NOPATH
use Win32::IProc "FULLPATH"; 

$pobj = new Win32::IProc;

$pobj->EnumProcesses(\@processlist) or 
  die "Unable to get process list:$!\n";

foreach $process (@processlist){
  print "\n",$process->{ProcessName},
        "\n",('=' x length($process->{ProcessName})),"\n";

  $pobj->GetProcessModules($process->{ProcessId},\@modules,FULLPATH);
  print join("\n",map {lc $_->{ModuleName}} @modules),"\n";
}
-------
#*
#* show the process time info under NT/2000 using Win32::Iproc
#*

use Win32::IProc qw(PROCESS_QUERY_INFORMATION INHERITED DIGITAL);

$pobj = new Win32::IProc;

$pobj->Open($ARGV[0],PROCESS_QUERY_INFORMATION,INHERITED,\$handle) or
  warn "Can't get handle:".$pobj->LastError()."\n";

# DIGITAL = pretty-printed times
$pobj->GetStatus($handle,\$statusinfo,DIGITAL); 

$pobj->CloseHandle($handle);

while (($procname,$value)=each %$statusinfo){
  print "$procname: $value\n";
}
-------
#*
#* show the process ids and names under NT/2000 using Win32::Setupsup
#*
use Win32::Setupsup;

$machine = ""; # query the list on the current machine

Win32::Setupsup::GetProcessList($machine, \@processlist, \@threadlist) or 
  die "process list error: ".Win32::Setupsup::GetLastError()."\n";

pop(@processlist); # remove the bogus entry always appended to the list
foreach $processlist (@processlist){
  $pid  = $processlist->{pid};
  $name = $processlist->{name};
  write;
}

format STDOUT_TOP =
Process ID      Process Name
==========      ===============================
.
format STDOUT =
@<<<<<<<        @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$pid,           $name
.
-------
#*
#* show the window handle and title under NT/2000 
#*

use Win32::Setupsup;

Win32::Setupsup::EnumWindows(\@windowlist) or 
  die "process list error: ".Win32::Setupsup::GetLastError()."\n";

foreach $whandle (@windowlist){
    if (Win32::Setupsup::GetWindowText($whandle,\$text)){
      print "$whandle: $text","\n";
    }
    else {
      warn "Can't get text for $whandle" .    
            Win32::Setupsup::GetLastError()."\n";
    }
}
-------
#*
#* show the window hierarchy under NT/2000
#*

use Win32::Setupsup;

# get the list of windows
Win32::Setupsup::EnumWindows(\@windowlist) or 
  die "process list error: ".Win32::Setupsup::GetLastError()."\n";

# turn window handle list into a hash
# NOTE: this conversion populates the hash with plain numbers and 
# not actual window handles as keys. Some functions, like 
# GetWindowProperties (which we'll see in a moment) can't use these 
# converted numbers. Caveat implementor.
for (@windowlist){$windowlist{$_}++;}

# check each window for children
foreach $whandle (@windowlist){
    if (Win32::Setupsup::EnumChildWindows($whandle,\@children)){
       # keep a sorted list of children for each window
       $children{$whandle} = [sort {$a <=>$b} @children];     

       # remove all children from the hash, we won't directly 
       #iterate over them
       foreach $child (@children){
         delete $windowlist{$child};
       }
    }
}

# iterate through the list of parent or childless windows and
# recursively print each window handle and its children (if any)
foreach my $window (sort {$a <=> $b} keys %windowlist){
  &printfamily($window,0);
}

# print a given window handle number and its children (recursively)
sub printfamily {
  # starting window, how deep in a tree are we?
  my($startwindow,$level) = @_; 

  # print the window handle number at the appropriate indentation
  print(("  " x $level)."$startwindow\n");
 
  return unless (exists $children{$startwindow}); # no children, done.
 
  # otherwise, we have to recurse for each child
  $level++;
  foreach $childwindow (@{$children{$startwindow}}){
     &printfamily($childwindow,$level);
  }
}
-------
#*
#* show the geometry of a particular window under NT/2000
#*

use Win32::Setupsup;

Win32::Setupsup::GetWindowProperties($ARGV[0],[rect,id],\%info);

print "\t" . $info{rect}{top} . "\n";
print $info{rect}{left} . " -" . $ARGV[0] . "- " . $info{rect}{right} . "\n";
print "\t" . $info{rect}{bottom} . "\n";
-------
#*
#* make the specified window jump to a particular place on the screen
#*

use Win32::Setupsup;

$info{rect}{left}  = 0;
$info{rect}{right} = 600;
$info{rect}{top}   = 10;
$info{rect}{bottom}= 500;
Win32::Setupsup::SetWindowProperties($ARGV[0],\%info);
-------
#*
#* send text (as if typed) to a particular window
#*

use Win32::Setupsup;

$texttosend = "\\DN\\Low in the gums";
Win32::Setupsup::SendKeys($ARGV[0],$texttosend,'',0);
-------
#*
#* retrieve a WMI Win32_Process object (the hard way)
#*
use Win32::OLE('in');

$server = ''; # connect to local machine

# get a SWbemLocator object
$lobj = Win32::OLE->new('WbemScripting.SWbemLocator') or 
  die "can't create locator object: ".Win32::OLE->LastError()."\n";

# set the impersonate level to "impersonate"
$lobj->{Security_}->{impersonationlevel} = 3;

# use it to get a an SWbemServices object 
$sobj = $lobj->ConnectServer($server, 'root\cimv2') or 
  die "can't create server object: ".Win32::OLE->LastError()."\n";

# get the schema object
$procschm = $sobj->Get('Win32_Process'); 
-------
#*
#* retrieve a WMI Win32_Process object (the easy way)
#*
use Win32::OLE('in');

$procschm = Win32::OLE->GetObject(                    
  'winmgmts:{impersonationLevel=impersonate}!Win32_Process')
     or die "can't create server object: ".Win32::OLE->LastError()."\n"; 
-------
#*
#* show the properties and methods of the Win32_Process object by querying 
#* the schema 
#*
use Win32::OLE('in');

# connect to namespace, set the impersonate level, and retrieve the 
# Win32_process object just by using a display name
$procschm = Win32::OLE->GetObject(
             'winmgmts:{impersonationLevel=impersonate}!Win32_Process')
     or die "can't create server object: ".Win32::OLE->LastError()."\n"; 

print "--- Properties ---\n";
print join("\n",map {$_->{Name}}(in $procschm->{Properties_}));
print "--- Methods ---\n";
print join("\n",map {$_->{Name}}(in $procschm->{Methods_}));
-------
#*
#* retrieve the list of currently running processes using WMI under NT/2000
#*

use Win32::OLE('in');

# perform all of the initial steps in one swell foop

$sobj = Win32::OLE->GetObject(
                      'winmgmts:{impersonationLevel=impersonate}')
      or die "can't create server object: ".Win32::OLE->LastError()."\n"; 

foreach $process (in $sobj->InstancesOf("Win32_Process")){
  print $process->{Name}." is pid #".$process->{ProcessId},"\n";
}
-------
#*
#* retrieve the process id/user list under UNIX by looking at /proc
#*

opendir(PROC,"/proc") or die "Unable to open /proc:$!\n";
while (defined($_= readdir(PROC))){
    next if ($_ eq "." or $_ eq "..");
    next unless /^\d+$/; # filter out any random non-pid files
    print "$_\t". getpwuid((lstat "/proc/$_")[4])."\n";
}
closedir(PROC);
-------
#*
#* retrieve a list of process ids/owners under UNIX using Proc::ProcessTable
#*

use Proc::ProcessTable;

$tobj = new Proc::ProcessTable;
$proctable = $tobj->table();
for (@$proctable){
    print $_->pid."\t". getpwuid($_->uid)."\n";
}
-------
#*
#* look and log processes named "eggdrop" under UNIX
#*

use Proc::ProcessTable;

open(LOG,">>$logfile") or die "Can't open logfile for append:$!\n";

$t = new Proc::ProcessTable;
foreach $p (@{$t->table}){    
    if ($p->fname() =~ /eggdrop/i){
	print LOG time."\t".getpwuid($p->uid)."\t".$p->fname()."\n";
    }             
}
close(LOG);
-------
#*
#* collect stats on running processes under UNIX and dump them once an hour
#*

use Proc::ProcessTable;

$interval    = 600; # sleep interval of 5 minutes
$partofhour  =   0; # keep track of where in hour we are

$tobj = new Proc::ProcessTable; # create new process object

# forever loop, collecting stats every $intervar secs 
# and dumping them once an hour
while(1){
    &collectstats;
    &dumpandreset if ($partofhour >= 3600);
    sleep($interval);
}

# collect the process statistics
sub collectstats {
    my($process);
    foreach $process (@{$tobj->table}){
	    
        # we should ignore ourself
        next if ($process->pid() == $$);
        
        # save this process info for our next run
        push(@last,$process->pid(),$process->fname());

        # ignore this process if we saw it last iteration
        next if ($last{$process->pid()} eq $process->fname());

        # else, remember it
        $collection{$process->fname()}++;
    }
    # set the last hash using the current table for our next run
    %last = @last;
    $partofhour += $interval;
}

# dump out the results and reset our counters
sub dumpandreset{
    print scalar localtime(time).("-"x50)."\n";
    for (sort reverse_value_sort keys %collection){
        write;
    }

    # reset counters
    undef %collection;
    $partofhour = 0;
}

# (reverse) sort by values in %collection and by key name
sub reverse_value_sort{
    return $collection{$b} <=> $collection{$a} || $a cmp $b;
}

format STDOUT =
@<<<<<<<<<<<<<  @>>>>
$_,             $collection{$_}
.

format STDOUT_TOP =
Name            Count
--------------  -----
.
-------
#*
#* audit a filesystem for 5 changes under NT/2000
#*

use Win32::AdvNotify qw(All %ActionName); 
use Data::Dumper;

$aobj = new Win32::AdvNotify() or die "Can't make a new object:\n";

$thread = $aobj->StartThread(Directory => 'C:\temp',
                             Filter => All,
                             WatchSubtree => 0) 
  or die "Unable to start thread\n";

$thread->EnableWatch() or die "Can't start watching\n";

while($thread->Wait(INFINITE)){
    while ($thread->Read(\@status)){
        foreach $event (@status){
            $filename = $event->{FileName};
            $time     = $event->{DateTime};
            $action   = $ActionName{$event->{Action}};
            write;
        }
    }
    last if ($changes++ == 5);
}

$thread->Terminate();
undef $aobj;

format STDOUT = 
@<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<
$filename,$time,$action
.

format STDOUT_TOP =
File Name            Date                 Action
-------------------  -------------------- ---------------------
.
-------
#*
#* show open network ports under NT/2000 using Win32::IpHelp
#*

use Win32::IpHelp;

# note: the case of "IpHelp" is signficant in this call
my $iobj = new Win32::IpHelp; 

# populates list of hash of hashes
$iobj->GetTcpTable(\@table,1); 

foreach $entry (@table){
    print $entry->{LocalIP}->{Value} . ":" . 
          $entry->{LocalPort}->{Value}. " -> ";
    print $entry->{RemoteIP}->{Value} . ":" . 
          $entry->{RemotePort}->{Value}."\n";
}
-------
#*
#* show open files and the pids that user them under UNIX using lsof
#*

use Text::Wrap; # for pretty printing

$lsofexec = "/usr/local/bin/lsof"; # location of lsof executable

# (F)ield mode, NUL (0) delim, show (L)ogin, file (t)ype and file (n)ame
$lsofflag = "-FL0tn"; 
open(LSOF,"$lsofexec $lsofflag|") or  die "Unable to start $lsof:$!\n";

while(<LSOF>){
    # deal with a process set
    if (substr($_,0,1) eq "p"){
        ($pid,$login) = split(/\0/);
        $pid = substr($pid,1,length($pid));
    }

    # deal with a file set, note: we are only interested 
    # in "regular" files
    if (substr($_,0,5) eq "tVREG"){
        ($type,$pathname) = split(/\0/);

        # a process may have the same path name open twice, 
        # these two lines make sure we only record it once
        next if ($seen{$pathname} eq $pid);
        $seen{$pathname} = $pid;

        $pathname = substr($pathname,1,length($pathname));
        push(@{$paths{$pathname}},$pid);
    }
}

close(LSOF);

for (sort keys %paths){
    print "$_:\n";
    print wrap("\t","\t",join(" ",@{$paths{$_}})),"\n";
}
-------
#*
#* check for unauthorized IRC clients (e.g bots).
#*

$lsofexec = "/usr/local/bin/lsof";
$lsofflag = "-FL0c -iTCP:6660-7000";

# this is a hash slice being used to preload a hash table, the 
# existence of whose keys we'll check later. Usually this gets written 
# like this:
#     %approvedclients = ("ircII" => undef, "xirc" => undef, ...); 
# (but this is a cool idiom popularized by Mark-Jason Dominus)
@approvedclients{"ircII","xirc","pirc"} = (); 

open(LSOF,"$lsofexec $lsofflag|") or
  die "Unable to start $lsof:$!\n";

while(<LSOF>){
    ($pid,$command,$login) = /p(\d+)\000
                              c(.+)\000
                              L(\w+)\000/x;
    warn "$login using an unapproved client called $command (pid $pid)!\n"
      unless (exists $approvedclients{$command});
}

close(LSOF);


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区三区高清不卡| 亚洲乱码国产乱码精品精的特点| 国产女人18水真多18精品一级做| 一区二区三区欧美视频| 国内精品伊人久久久久av一坑| 91麻豆精品视频| 国产亚洲女人久久久久毛片| 另类小说一区二区三区| 99国产精品久久| 欧美电视剧在线观看完整版| 蜜桃视频在线观看一区二区| 欧美色爱综合网| 亚洲女爱视频在线| 成人h动漫精品| 国产三级三级三级精品8ⅰ区| 久久国产精品99久久久久久老狼| 欧美日韩免费电影| 亚洲精品高清在线| 日本高清视频一区二区| 中文成人av在线| 国产中文一区二区三区| 91精品欧美综合在线观看最新| 国产精品久久一级| 久久国产精品99精品国产| 欧美日韩在线播放三区| 色婷婷精品久久二区二区蜜臀av | 婷婷六月综合亚洲| 97se亚洲国产综合自在线观| 精品第一国产综合精品aⅴ| 亚洲成av人片一区二区三区| 91在线无精精品入口| 亚洲国产精品久久人人爱蜜臀| 国产成人精品亚洲日本在线桃色| 日韩欧美亚洲一区二区| 亚洲国产日韩一级| 在线观看一区二区视频| 亚洲三级在线免费观看| 91视频精品在这里| 国产精品久久久久一区二区三区 | 精品国产三级a在线观看| 亚洲一区二区欧美| 色播五月激情综合网| 亚洲欧美综合在线精品| 极品尤物av久久免费看| 欧美videos中文字幕| 亚洲成人免费电影| 欧美日韩一级视频| 亚洲狠狠丁香婷婷综合久久久| 91一区二区在线| 国产精品每日更新| 91丨九色丨国产丨porny| **欧美大码日韩| 成人av网址在线| 中文字幕在线一区| 99久久久久免费精品国产| 日韩美女视频一区| 在线精品视频免费播放| 亚洲一区二区欧美| 国产精品乱人伦| 96av麻豆蜜桃一区二区| 亚洲欧美aⅴ...| 欧美性猛交xxxxxx富婆| 五月天亚洲婷婷| 精品福利在线导航| av亚洲产国偷v产偷v自拍| 亚洲精品综合在线| 欧美精品粉嫩高潮一区二区| 免费成人小视频| 久久男人中文字幕资源站| jlzzjlzz欧美大全| 亚洲电影第三页| 欧美tickling网站挠脚心| 国产99久久久国产精品潘金网站| 国产精品久久久久久久久免费相片 | 国产91高潮流白浆在线麻豆| 亚洲图片你懂的| 5858s免费视频成人| 激情都市一区二区| 亚洲图片激情小说| 精品理论电影在线观看 | 欧美丝袜自拍制服另类| 无吗不卡中文字幕| 91麻豆精品国产无毒不卡在线观看 | 成人v精品蜜桃久久一区| 亚洲国产日韩av| 日本一区二区三区国色天香 | 韩国av一区二区三区四区| 亚洲丝袜另类动漫二区| 欧美一区二区免费观在线| 国产成人99久久亚洲综合精品| 亚洲视频 欧洲视频| www.成人在线| 欧美aaaaaa午夜精品| 中文无字幕一区二区三区| 欧洲精品在线观看| 国产真实乱子伦精品视频| 亚洲精品国产一区二区三区四区在线 | 欧美一区二区三区四区久久| 成人一级黄色片| 日本不卡视频一二三区| 亚洲天堂网中文字| 欧美另类久久久品| 99国产欧美另类久久久精品| 久久 天天综合| 亚洲一级二级三级在线免费观看| 精品国产三级电影在线观看| 欧美日免费三级在线| 高清国产午夜精品久久久久久| 99re成人精品视频| 久久精品久久精品| 视频一区中文字幕国产| 一区二区三区日韩在线观看| 久久综合九色综合久久久精品综合| 欧美日韩综合在线免费观看| 99久久婷婷国产| 成人听书哪个软件好| 经典三级视频一区| 五月激情六月综合| 一区二区三区欧美在线观看| 欧美videos大乳护士334| 欧美日本一道本| 欧美三级韩国三级日本一级| 色婷婷精品久久二区二区蜜臂av| 国产成人av电影在线| 国产精品主播直播| 精品无人码麻豆乱码1区2区| 秋霞电影一区二区| 丝袜亚洲另类欧美综合| 亚洲主播在线观看| 国产精品久久夜| 成人欧美一区二区三区在线播放| 中文字幕一区二区三区不卡 | 日韩一级完整毛片| 欧美一级夜夜爽| 日韩欧美国产麻豆| 精品成人一区二区| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 北条麻妃一区二区三区| 99精品视频在线免费观看| 91视频一区二区| 91成人在线观看喷潮| 欧美老年两性高潮| 欧美一区二区三区性视频| 精品国产麻豆免费人成网站| 国产亚洲福利社区一区| 欧美国产一区在线| 亚洲人成影院在线观看| 亚洲精品日韩专区silk| 亚洲电影视频在线| 国产一区二区导航在线播放| 精品一区二区免费在线观看| 国产成人免费xxxxxxxx| 成人高清免费在线播放| 91国在线观看| 日韩欧美黄色影院| 国产精品美女久久久久久2018 | 亚洲大片免费看| 国内外精品视频| 色综合中文字幕国产| 国产精品66部| 91久久精品一区二区| 欧美色爱综合网| 亚洲国产高清aⅴ视频| 一区二区三区不卡视频| 老司机精品视频线观看86| 久久er精品视频| 成人av手机在线观看| 欧美日韩亚洲综合一区| 久久蜜臀精品av| 怡红院av一区二区三区| 久久av中文字幕片| 99久久国产综合精品色伊| 26uuu国产一区二区三区| 亚洲狠狠丁香婷婷综合久久久| 久久97超碰色| 欧美日韩精品电影| 国产精品蜜臀在线观看| 麻豆91精品视频| 99久久99久久精品免费观看| 日韩一区二区三| 亚洲一区在线播放| 成人福利视频网站| 欧美一区午夜视频在线观看| 亚洲欧美日韩中文字幕一区二区三区 | 午夜精彩视频在线观看不卡| 国产精品91一区二区| 91精品福利在线一区二区三区| 中文字幕中文乱码欧美一区二区| 日日夜夜免费精品| 日本高清不卡aⅴ免费网站| 久久影院午夜论| 视频一区免费在线观看| 色婷婷综合久久久| 中文字幕五月欧美| 粉嫩av一区二区三区在线播放 | 国产精品美女久久久久久2018| 免费看黄色91| 欧美精品18+| 亚洲国产精品一区二区久久| 色综合色狠狠天天综合色|