File: //proc/self/root/scripts.20110531.215904.25158/fixtrojans
#!/usr/bin/perl
# cpanel - fixtrojans Copyright(c) 2010 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
BEGIN { unshift @INC, '/usr/local/cpanel'; }
use Cpanel::Sys::OS ();
use Net::FTP;
$|=1;
@IGNORERPMS=("kernel","apache","php");
$arch = 'x86'; #we only support x86 right now
if ($ARGV[0] eq "") {
die "Usage: fixtrojans <trojansfile>\n";
}
if(-e "/etc/mandrake-release") {
$distro = 'mandrake';
$version = Cpanel::Sys::OS::getversionfromfile('/etc/mandrake-release');
} elsif (-e "/etc/redhat-release") {
$distro = 'redhat';
$version = Cpanel::Sys::OS::getversionfromfile('/etc/redhat-release');
} else {
print "Your linux distro is NOT SUPPORTED\n";
}
open(TF,$ARGV[0]);
while(<TF>) {
if (/Possible Trojan - (\S+)/) {
chomp($pkg = `rpm -qf $1`);
@PK = split(/\n/, $pkg);
$pkg = $PK[$#PK];
$PKGS{$pkg} = 1;
}
}
close(TF);
#$updatesite = Net::FTP->new("httpupdate.cpanel.net");
#$updatesite->login("anonymous","root@");
#$updatesite->cwd("/pub/redhat/redhat-$version/i386/RedHat/RPMS");
foreach $rpm (sort keys %PKGS) {
print "Fetch $rpm\n";
# $updatesite->get("$rpm.i386.rpm");
}