wakeup 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/wakeup +23 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1bd6911ede8e4519200aa7065243ba41938ed80
4
+ data.tar.gz: a36b49bbf914a10b7d64c608853e1331fc7bb1a2
5
+ SHA512:
6
+ metadata.gz: 1227a4d659b80b398374c037e07ac1a9b259c0842537221cc2d63b454422fc97ea597fa16a30d73c15bf372b00488b16687e35c0d14a82aa8c5d3ef74cafc607
7
+ data.tar.gz: 3ee225d8bf091d779fc344c741ff7b742366013bac9ab2ed9c8e9d538fbd0ffcc3ade947d12af3aadcf13343a93210259cfd82a82e20c76c495f49de8252aa04
data/bin/wakeup ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require 'socket'
3
+
4
+ if ARGV.length != 2
5
+ puts 'usage - wakeup 192.168.1.11 01:23:45:67:89:ab'
6
+ exit
7
+ end
8
+
9
+ PORT = 80
10
+ host, mac = ARGV
11
+ if (mac =~ /^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$/).nil?
12
+ puts 'invalid mac address'
13
+ exit
14
+ end
15
+
16
+ address = mac.split(':').map(&:hex).map(&:chr).inject(:+).force_encoding('UTF-8')
17
+ data = "\xFF\xFF\xFF\xFF\xFF\xFF" + (address * 16) # Purposefully using double quotes
18
+
19
+ UDPSock = UDPSocket.new
20
+ UDPSock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
21
+ UDPSock.send(data, 0, '<broadcast>', PORT) # Need to send this before in order for it to work
22
+ UDPSock.send(data, 0, host, PORT)
23
+ puts "Wakeup command sent to #{host}"
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wakeup
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.1'
5
+ platform: ruby
6
+ authors:
7
+ - Ankur Patel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Wake-on-LAN command line tool to wake up a server given a domain/ip-address
14
+ and MAC address
15
+ email: ankur.patel@ymail.com
16
+ executables:
17
+ - wakeup
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/wakeup
22
+ homepage: https://github.com/ankurp/wakeup
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.2.2
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Wake-on-LAN command line tool
46
+ test_files: []