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;
|
||||
60
Perl CGI remote delete SOS/index.cgi
Normal file
60
Perl CGI remote delete SOS/index.cgi
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/perl
|
||||
use CGI;
|
||||
|
||||
$q = new CGI;
|
||||
$host = $q->param("host");
|
||||
|
||||
### HTML Start
|
||||
printf "Content-type: text/html\n\n";
|
||||
printf "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n
|
||||
<html>
|
||||
<head>
|
||||
<title>$title</title>
|
||||
</head>
|
||||
<body>";
|
||||
|
||||
### Ausgabe
|
||||
my $pd=';';
|
||||
my $vd='|';
|
||||
my %path;
|
||||
|
||||
if ($host eq "ubuntu1") { # Sony Notebook Ubuntu
|
||||
# Ubuntu auf Sony VAIO
|
||||
$path{"/tmp/test1/"} = "1"; # 1: nicht loeschen, 0: loeschen
|
||||
$path{"\"/tmp/test 2/\""} = "1";
|
||||
$path{"/tmp/test3/"} = "1";
|
||||
}
|
||||
elsif ($host eq "test") {
|
||||
# Test, existiert nicht
|
||||
}
|
||||
elsif ($host eq "arg-nuc") {
|
||||
$path{'/home/andre/'} = "0";
|
||||
$path{'/mnt/data/'} = "0";
|
||||
$path{'/tmp/'} = "0";
|
||||
$path{'!killall owncloud'} = "1";
|
||||
$path{'!umount /mnt/*'} = "0";
|
||||
}
|
||||
elsif ($host eq "windows-conet") {
|
||||
$path{'D:\Daten\Users\AWisniewski\Downloads'} = "0";
|
||||
$path{'D:\Daten\Users\AWisniewski\OC_agadmin'} = "0";
|
||||
$path{'D:\Administrator'} = "0";
|
||||
$path{'D:\temp'} = "1";
|
||||
$path{'C:\temp'} = "1";
|
||||
}
|
||||
else {
|
||||
# Kein Host angegeben
|
||||
print "Aufruf http://sos.andregeissler.de/cgi-bin/index.cgi?host=HOSTNAME<br>\nServerkonfig<br>\n\$path{\"Pfad mit Leerzeichen\"} = \"x\"; wenn x = 1 dann entfernen anderenfalls nicht.";
|
||||
}
|
||||
|
||||
foreach my $p (keys %path) {
|
||||
print "$p$vd$path{$p}$pd";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
|
||||
### HTML Ende
|
||||
printf "</body>
|
||||
</html>";
|
||||
|
||||
#################################################################################################################
|
||||
Reference in New Issue
Block a user