📄 resolver.pl
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -