This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,32 @@
#!C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc-gui.exe
PAP-Version: 1.0
Packer: C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc.exe
Script: WOL.pl
Cwd: G:\My Documents\Diverse Skripts\WOL
Clean: 1
Date: 2011-03-21 16:04:20
Debug:
Dependent: 0
Dyndll: 0
Exe: WOL.exe
Force: 1
Hostname: neticfsys03
Manifest:
No-Compress: 0
No-Logo: 0
Runlib:
Shared: none
Tmpdir:
Verbose: 0
Version-Comments:
Version-CompanyName:
Version-FileDescription: WakeOnLan Client
Version-FileVersion: 1
Version-InternalName: WOLawClient
Version-LegalCopyright:
Version-LegalTrademarks:
Version-OriginalFilename: WOLawClient
Version-ProductName: WOLawClient
Version-ProductVersion: 1
Warnings: 0
Xclude: 0

View File

@@ -0,0 +1,130 @@
#!perl -w
package PerlSvc;
use strict;
use warnings;
use Net::Wake;
my $service = 'WOLawClient';
my $servno = 0;
my $logfile = 'c:/wol.log';
my $configfile = 'c:/wol.conf';
my $delay = 30;
my @options = ('log=s' => \$logfile,
'config=s' => \$configfile,
'service=s' => \$servno,
);
# turn on autoflush
$|=1;
(my $progname = $0) =~ s/.*?([^\\]+?)(\.\w+)$/$1/;
our(%Config,$Verbose);
sub get_options {
require Getopt::Long;
my @options = @_;
my $usage = pop @options;
$SIG{__WARN__} = sub { print "$usage\n$_[0]"; exit 1 };
Getopt::Long::GetOptions(@options);
$SIG{__WARN__} = 'DEFAULT';
}
sub configure {
%Config = (ServiceName => "WOLawClient$servno",
DisplayName => "WOLawClient$servno",
Parameters => "--log $logfile --config $configfile --service $servno",
Description => "WakeOnLan Client");
}
sub Startup {
get_options(@options, <<__USAGE__);
Try `$progname --help` to get a list of valid options.
__USAGE__
Log("\n$Config{DisplayName} starting at: ".localtime);
my ($FILE)=@ARGV;
open FH, "<$configfile";
my @CONF=<FH>;
close FH;
while (ContinueRun($delay)) {
foreach my $line (@CONF) {
chomp;
next if ($line =~ /^#/);
my ($IP,$MAC,$PORT)=split / /,$line;
Net::Wake::by_udp($IP,$MAC,$PORT);
}
}
Log("$Config{DisplayName} stopped at: ".localtime);
}
sub Log {
my $msg = shift;
open(my $f, ">>$logfile") or die $!;
print $f "$msg\n";
close $f;
}
sub Install {
#get_options('name=s' => \$service, @options, <<__USAGE__);
get_options(@options, <<__INSTALL__);
Valid --install suboptions are:
auto automatically start service
--log log file name [$logfile]
--config config file name [$configfile]
--service service number [$servno]
For example:
$progname --install auto --log logfile --config configfile --service servicenumber
__INSTALL__
configure();
}
sub Help {
print <<__HELP__;
Sends WakeOnLan Packets to MAC addresses defined in configfile
Install it as a service:
$progname --install auto --log logfile --config configfile --service servicenumber
net start $service
You can pause and resume the service with:
net pause $service
net continue $service
To remove the service from your system, stop und uninstall it:
net stop $service
$progname --remove
servicenumber defaults to 0
logfile defaults to c:\\wol.log
configfile defaults to c:\\wol.conf
__HELP__
# Don't display standard PerlSvc help text
$Verbose = 0;
}
sub Pause {
Log("$Config{ServiceName} is about to pause at ".localtime);
}
sub Continue {
Log("$Config{ServiceName} is continuing at ".localtime);
}
sub Remove {
get_options('service=s' => \$servno, <<__REMOVE__);
Valid --remove suboptions are:
--service service number [$servno]
For example:
$progname --remove --service 0
__REMOVE__
$Config{ServiceName} = "$service$servno";
$Config{DisplayName} = "$service$servno";
}

View File

@@ -0,0 +1,32 @@
#!C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc-gui.exe
PAP-Version: 1.0
Packer: C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc.exe
Script: WOL.pl
Cwd: G:\My Documents\Diverse Skripts\WOL
Clean: 0
Date: 2011-03-21 18:21:51
Debug:
Dependent: 0
Dyndll: 0
Exe: WOL.exe
Force: 0
Hostname: neticfsys03
Manifest:
No-Compress: 0
No-Logo: 0
Runlib:
Shared: none
Tmpdir:
Verbose: 0
Version-Comments:
Version-CompanyName:
Version-FileDescription:
Version-FileVersion: 2
Version-InternalName: WOLawClient
Version-LegalCopyright:
Version-LegalTrademarks:
Version-OriginalFilename: WOLawClient
Version-ProductName: WOLawClient
Version-ProductVersion: 2
Warnings: 0
Xclude: 0

View File

@@ -0,0 +1,2 @@
#ip mac port
255.255.255.255 00:24:a5:00:ec:17 9

View File

@@ -0,0 +1,12 @@
WOLawClient2 starting at: Mon Mar 21 17:48:31 2011
WOLawClient2 stopped at: Mon Mar 21 17:51:36 2011
WOLawClient0 starting at: Thu Nov 10 10:18:49 2011
WOLawClient0 stopped at: Thu Nov 10 10:19:11 2011
WOLawClient0 starting at: Thu Nov 10 10:19:16 2011
WOLawClient0 stopped at: Thu Nov 10 10:41:26 2011
WOLawClient0 starting at: Thu Nov 10 10:47:53 2011
WOLawClient0 stopped at: Thu Nov 10 10:48:13 2011

View File

@@ -0,0 +1,115 @@
#!/usr/bin/perl
use strict;
use IO::Socket;
###############################################################################
# main program
###############################################################################
my $AW;
my %conf;
my %menu = (
'97' => 'blank',
'98' => 'line',
'99|0|Ende' => sub { exit 0; },
);
read_config();
my $i=1;
foreach (sort keys %conf) {
print $_ . "\n";
$menu{"$i|$i|Wecke $_"} = \&wol;
print $conf{$_} . "\n";
$i++;
}
show_menu(\%menu, "Hauptmenue");
0; # end with exit code 0
###############################################################################
# subs
###############################################################################
sub wol {
my $NAME;
my $IP;
my $MAC;
my $i=1;
foreach (sort keys %conf) {
$NAME=$_;
($IP,$MAC) = split /;/,$conf{$NAME};
last if ($i == $AW);
$i++;
}
$MAC=~tr/-/:/;
for (1..5) { # 5 mal WOL Magic Packet senden
wol_magic($IP,$MAC,9);
}
print "Starte $NAME\n";
sleep 3;
}
sub show_menu {
my $m=shift;
my $t=shift;
my %m=%{$m};
my %menu;
my ($k, $e);
while (1) {
clrscr();
printf "\n $t\n\n";
foreach my $l (sort keys %m) {
if ($m{$l} eq "blank") {
printf "\n";
}
elsif ($m{$l} eq "line") {
for (1..26) { printf "-"; } printf "\n";
}
else {
my ($r,$k,$e) = split /\|/, $l;
$menu{$k}=$m{$l};
printf " %2s %-20s\n", $k, $e;
}
}
print "\n\n\n\nAuswahl: ";
my $in = <STDIN>;
chomp $in;
$AW=$in;
$menu{$in}->() unless ($menu{$in} eq "");
}
}
sub read_config {
open CF, "config";
foreach (<CF>) {
chomp;
#my ($k,$v) = split /:/,$_;
my ($k,$v) = $_ =~ m/([^:]*):(.*)/;
$conf{"$k"} = $v;
}
close CF;
}
sub clrscr {
for (0..50) {
print "\n";
}
}
sub wol_magic {
my ($host, $mac_addr, $port) = @_;
if (! defined $host) { $host = '255.255.255.255' }
if (! defined $port || $port !~ /^\d+$/ ) { $port = 9 }
my $sock = new IO::Socket::INET(Proto=>'udp') || return undef;
my $ip_addr = inet_aton($host);
my $sock_addr = sockaddr_in($port, $ip_addr);
$mac_addr =~ s/://g;
my $packet = pack('C6H*', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, $mac_addr x 16);
setsockopt($sock, SOL_SOCKET, SO_BROADCAST, 1);
send($sock, $packet, 0, $sock_addr);
close ($sock);
return 1;
}

View File

@@ -0,0 +1,3 @@
Markus1:192.168.88.255;f0-92-1c-dc-df-29
Markus2:192.168.88.255;f0:92:1c:dc:df:29
REL:10.130.10.255;b4:b5:2f:d9:53:1c

View File

@@ -0,0 +1,32 @@
#!C:\Program Files\ActiveState Perl Dev Kit 9.0.1\bin\perlsvc-gui.exe
PAP-Version: 1.0
Packer: C:\Program Files\ActiveState Perl Dev Kit 9.0.1\bin\perlsvc.exe
Script: WOL.pl
Cwd: D:\Admin\WOL-AW
Clean: 0
Date: 2011-03-22 14:06:10
Debug:
Dependent: 0
Dyndll: 0
Exe: WOLx64.exe
Force: 0
Hostname: ADICFSP01
Manifest:
No-Compress: 0
No-Logo: 0
Runlib:
Shared: none
Tmpdir:
Verbose: 0
Version-Comments:
Version-CompanyName:
Version-FileDescription:
Version-FileVersion: 2
Version-InternalName: WOLawClient
Version-LegalCopyright:
Version-LegalTrademarks:
Version-OriginalFilename: WOLawClient
Version-ProductName: WOLawClient
Version-ProductVersion: 2
Warnings: 0
Xclude: 0

View File

@@ -0,0 +1,130 @@
#!perl -w
package PerlSvc;
use strict;
use warnings;
use Net::Wake;
my $service = 'WOLawClient';
my $servno = 0;
my $logfile = 'c:/wol.log';
my $configfile = 'c:/wol.conf';
my $delay = 30;
my @options = ('log=s' => \$logfile,
'config=s' => \$configfile,
'service=s' => \$servno,
);
# turn on autoflush
$|=1;
(my $progname = $0) =~ s/.*?([^\\]+?)(\.\w+)$/$1/;
our(%Config,$Verbose);
sub get_options {
require Getopt::Long;
my @options = @_;
my $usage = pop @options;
$SIG{__WARN__} = sub { print "$usage\n$_[0]"; exit 1 };
Getopt::Long::GetOptions(@options);
$SIG{__WARN__} = 'DEFAULT';
}
sub configure {
%Config = (ServiceName => "WOLawClient$servno",
DisplayName => "WOLawClient$servno",
Parameters => "--log $logfile --config $configfile --service $servno",
Description => "WakeOnLan Client");
}
sub Startup {
get_options(@options, <<__USAGE__);
Try `$progname --help` to get a list of valid options.
__USAGE__
Log("\n$Config{DisplayName} starting at: ".localtime);
my ($FILE)=@ARGV;
open FH, "<$configfile";
my @CONF=<FH>;
close FH;
while (ContinueRun($delay)) {
foreach my $line (@CONF) {
chomp;
next if ($line =~ /^#/);
my ($IP,$MAC,$PORT)=split / /,$line;
Net::Wake::by_udp($IP,$MAC,$PORT);
}
}
Log("$Config{DisplayName} stopped at: ".localtime);
}
sub Log {
my $msg = shift;
open(my $f, ">>$logfile") or die $!;
print $f "$msg\n";
close $f;
}
sub Install {
#get_options('name=s' => \$service, @options, <<__USAGE__);
get_options(@options, <<__INSTALL__);
Valid --install suboptions are:
auto automatically start service
--log log file name [$logfile]
--config config file name [$configfile]
--service service number [$servno]
For example:
$progname --install auto --log logfile --config configfile --service servicenumber
__INSTALL__
configure();
}
sub Help {
print <<__HELP__;
Sends WakeOnLan Packets to MAC addresses defined in configfile
Install it as a service:
$progname --install auto --log logfile --config configfile --service servicenumber
net start $service
You can pause and resume the service with:
net pause $service
net continue $service
To remove the service from your system, stop und uninstall it:
net stop $service
$progname --remove
servicenumber defaults to 0
logfile defaults to c:\\wol.log
configfile defaults to c:\\wol.conf
__HELP__
# Don't display standard PerlSvc help text
$Verbose = 0;
}
sub Pause {
Log("$Config{ServiceName} is about to pause at ".localtime);
}
sub Continue {
Log("$Config{ServiceName} is continuing at ".localtime);
}
sub Remove {
get_options('service=s' => \$servno, <<__REMOVE__);
Valid --remove suboptions are:
--service service number [$servno]
For example:
$progname --remove --service 0
__REMOVE__
$Config{ServiceName} = "$service$servno";
$Config{DisplayName} = "$service$servno";
}

View File

@@ -0,0 +1,39 @@
art WOLawClient
You can pause and resume the service with:
net pause WOLawClient
net continue WOLawClient
To remove the service from your system, stop und uninstall it:
net stop WOLawClient
wol --remove
servicenumber defaults to 0
logfile defaults to c:\wol.log
configfile defaults to c:\wol.conf
Mit Angabe der Servicenummer ist es jetzt sogar möglich den Dienst mehrfach zu starten!!
Für unterschiedliche MAC Adressen kannst du die Dienste so einrichten
wol --install --service 1 --log c:\wol1.log --config c:\wol1.conf
wol --install --service 2 --log c:\wol2.log --config c:\wol2.conf
Zum Stoppen/Starten
net stop/start WOLawClient1
net stop/start WOLawClient2
Entfernen
wol --remove --service 1
wol --remove --service 2
Nach wie vor schicken die Dienste alle 30s ein MagicPacket
Im übrigen wird die Config Datei nur einmal beim Servicestart eingelesen

Binary file not shown.

View File

@@ -0,0 +1,4 @@
#ip mac port
192.168.2.255 00:24:a5:00:ec:17 9
192.168.2.25 00:24:a5:00:ec:17 9
255.255.255.255 00:24:a5:00:ec:17 9