pastebin - collaborative debugging tool
kpaste.net RSS


WoL Proxy
Posted by Anonymous on Sat 4th Feb 2012 20:12
raw | new post

  1. <?php
  2. $master = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
  3. socket_bind($master, "0.0.0.0", 9);
  4.  
  5. while (socket_recvfrom($master, $buf, 102, 0, $host, $port)) {
  6.         if ($host != "10.0.0.1") {
  7.                 echo "Forwarding packet from $host:$port.\n";
  8.                 $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
  9.                 socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1);
  10.                 socket_sendto($sock, $buf, strlen($buf), 0, "10.255.255.255", 9);
  11.         } else {
  12.                 echo "Ignoring packet from $host:$port.\n";
  13.         }
  14.         $buf = "";
  15. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at