resolver.pl
来自「linux平台上的开放源代码的网络摄像机程序.实现视频捕捉,传输以及云台控制等.」· PL 代码 · 共 25 行
PL
25 行
#!/usr/bin/perl# IP address resolver for Boa# If you want an "in place" change to the log file,# change the first line to#!/usr/local/bin/perl -i.bak# Otherwise, send the output of this program wherever you want:# resolver.pl access_log >access_log_resolved$AF_INET = 2;while(<>) { next unless (($ip, $rest) = /([\d\.]+) (.*)/o); if(!$hosts{$ip}) { $packed_ip = pack('C4', split(/\./, $ip)); $host = (gethostbyaddr($packed_ip, $AF_INET))[0]; $hosts{$ip} = ($host ? $host : $ip); } print "$hosts{$ip} $rest\n";}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?