1
0
Fork 0
mirror of https://github.com/vittorio88/cisco-scripts.git synced 2025-02-12 09:51:56 +00:00

add wol script

This commit is contained in:
Vittorio Alfieri 2015-08-02 20:27:36 +02:00
parent 2078381586
commit 8695ba052e

30
wol.tcl Normal file
View file

@ -0,0 +1,30 @@
## This script sends a WoL packet to destination MAC address
## how to use:
## tclsh flash:wol.tcl 0014D13F25F0
##
set macAddr [lindex $argv 0]
set broadcastAddr 255.255.255.255
proc WakeOnLan { } {
global macAddr
global broadcastAddr
set net [binary format H* [join [split $macAddr -:] ""]]
set pkt [binary format c* {0xff 0xff 0xff 0xff 0xff 0xff}]
for {set i 0} {$i < 16} {incr i} {
append pkt $net
}
# Open UDP and Send the Magic Paket.
set udpSock [udp_open]
fconfigure $udpSock -translation binary \
-remote [list $broadcastAddr 4580] \
-broadcast 1
puts $udpSock $pkt
flush $udpSock;
close $udpSock
}
WakeOnLan