⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 freebsd-lib.pl

📁 Unix下基于Web的管理工具
💻 PL
字号:
# freebsd-lib.pl# Functions for freebsd format last output# passfiles_type()# Returns 0 for old-style passwords (/etc/passwd only), 1 for FreeBSD-style# (/etc/master.passwd) and 2 for SysV (/etc/passwd & /etc/shadow)sub passfiles_type{return 1;}# groupfiles_type()# Returns 0 for normal group file (/etc/group only) and 2 for shadowed# (/etc/group and /etc/gshadow)sub groupfiles_type{return 0;}# open_last_command(handle, user)sub open_last_command{local ($fh, $user) = @_;open($fh, "last $user |");}# read_last_line(handle)# Parses a line of output from last into an array of#  user, tty, host, login, logout, periodsub read_last_line{$fh = $_[0];while(1) {	chop($line = <$fh>);	if (!$line) { return (); }	if ($line =~ /^(reboot|shutdown)/) { next; }	if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((\d+:\d+)\)/) {		return ($1, $2, $3, $4, $5 eq "shutdown" ? "Shutdown" :					$5 eq "crash" ? "Crash" : $5, $6);		}	elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/) {		return ($1, $2, $3, $4);		}	}}# encrypt_password(password)sub encrypt_password{local $salt = chr(int(rand(26))+65) . chr(int(rand(26))+65);return crypt($_[0], $salt);}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -