init III
This commit is contained in:
41
Perl CGI remote delete SOS/client.pl
Normal file
41
Perl CGI remote delete SOS/client.pl
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use WWW::Mechanize;
|
||||
|
||||
my $os=$^O;
|
||||
my $host="arg-nuc";
|
||||
my $mech = WWW::Mechanize->new(onerror => undef);
|
||||
$mech->get("http://sos.andregeissler.de/cgi-bin/index.cgi?host=$host");
|
||||
my $html = $mech->text();
|
||||
|
||||
my @dirs;
|
||||
my @ddirs;
|
||||
my $pd=';';
|
||||
my $vd='|';
|
||||
|
||||
@dirs = split /$pd/,$html;
|
||||
|
||||
foreach my $dir (@dirs) {
|
||||
chomp $dir;
|
||||
my ($d,$y) = split /[$vd]/,$dir;
|
||||
push @ddirs, $d if ($y eq "1");
|
||||
}
|
||||
|
||||
foreach my $dd (@ddirs) {
|
||||
if ($dd =~ /^!/) {
|
||||
# execute something
|
||||
$dd=~s/^!//;
|
||||
`$dd`;
|
||||
}
|
||||
else {
|
||||
if ($os =~ /linux/) {
|
||||
`rm -fR $dd`;
|
||||
}
|
||||
else {
|
||||
`rmdir /Q /S $dd`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user