📄 userpassd.txt
字号:
#!/usr/bin/perl -w
while (1)
{
dbmopen(%comuser,"/etc/httpddata/comp.dat",0600);
dbmopen(%user,"/etc/httpddata/nuser.dat",0600);
dbmopen(%pidata,"/etc/httpddata/comudata.dat",0400);
foreach $key (sort keys %user)
{
if(!defined $comuser{$key})
{
$comuser{$key}=$user{$key};
`useradd -s /sbin/nologin $key &> /dev/null`;
`echo "$user{$key}" | passwd --stdin $key &> /dev/null`;
`mkdir /home/$key/www`;
`chmod 705 /home/$key/`;
`chmod 705 /home/$key/www`;
`chown $key:$key /home/$key/www`;
open(HT,">>/etc/httpd/conf/httpd.conf");
print HT <<"EEE";
<VirtualHost *:80>
ServerAdmin $key\@myproject.com
DocumentRoot /home/$key/www/
ServerName $key.myproject.com
ErrorLog logs/$key.myproject.com-error_log
CustomLog logs/$key.myproject.com-access_log common
</VirtualHost>
EEE
close(HT);
`/sbin/service httpd reload &> /dev/null`;
($fn,$ln,$sq,$as)=split(':',$pidata{$key});
`cat <<EOF >/home/$key/www/index.html
<html>
<body>
<H2>welcome to $fn $ln\'s website</H2>
<p>This website is under construction</p>
<p>Please contact at E-mail: $key\@myproject.com</p>
</body>
</html>
EOF`;
open(FZ,">>/var/named/chroot/var/named/for.db");
print FZ <<"NNN";
$key IN A 192.168.0.6
NNN
close(FZ);
`/sbin/service named reload &> /dev/null`;
$body=qq(
Dear $fn $ln,<BR>
<P>Welcome in the world of www.myproject.com. This site is a project site,
which is implemented by Er. Amandeep Kansal for his project work for 6 months
industrial training. Thanks For trusting me.</P>
<P>For Confirmation this is your account information.</p>
<P>Your User-ID is "$key".</P>
<P>Your Email ID is "$key\@myproject.com".</P>
<P>Your Password is "$user{$key}".</P>
<P>Your Name is "$fn $ln".</P>
<P>Your Secret question is "$sq".</P>
<P>Your answer is "$as".</P>
<p>Your Website is <a href="http://$key.myproject.com" target="newwin">http://$key.myproject.com</a> </p>
<p>You can upload your website files in html/text format though</p>
<p> <a href="ftp://$key\@www.myproject.com/www" target="newwin"> ftp://$key\@www.myproject.com/www</a> site with your User-ID and Password.</p>
<P> Thanks $fn $ln for registering with the www.myproject.com.</P>
);
dbmclose %pidata;
$sendmail="/usr/sbin/sendmail -t";
$fromname="webmaster";
$subject="Welcome";
sleep 1;
open(MAIL,"|$sendmail") ||
&InternalError('Could not fork sendmail with -f switch');
print MAIL <<"EEE";
From: $fromname <$fromname\@myproject.com>
To: $key\@myproject.com
Reply-To: $fromname
Errors-To: $fromname
Sender: $fromname
Subject: $subject
$body
EEE
close(MAIL);
delete $user{$key};
}
else
{
# print "user already exist";
delete $user{$key};
}
}
dbmclose %user;
dbmopen(%sdata,"/etc/httpddata/chpass.dat",0600);
foreach $upd (sort keys %sdata)
{
`echo "$sdata{$upd}" | passwd --stdin $upd &> /dev/null`;
$comuser{$upd}=$sdata{$upd};
delete $sdata{$upd};
}
dbmclose %comuser;
dbmclose %sdata;
sleep 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -