Minimal Python 2.7 Wake-on-LAN script

Tested on QNAP QTS 5.0.1 with Python 2.7.13.

#!/usr/local/bin/python

import re, sys, struct, socket

def wake(mac_string):
  # Convert mac address string
  mac_segments = mac_string.split(':')
  mac_int = struct.pack('BBBBBB',
    int(mac_segments[0], 16),
    int(mac_segments[1], 16),
    int(mac_segments[2], 16),
    int(mac_segments[3], 16),
    int(mac_segments[4], 16),
    int(mac_segments[5], 16))

  # Build magic packet
  magic_packet = '\xff' * 6 + mac_int * 16

  # Send magic packet to broadcast address on UDP port 9
  sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  sock.sendto(magic_packet, ("<broadcast>", 9))
  sock.close()

# Compile mac address pattern
mac_pattern = re.compile("^[0-9a-f]{2}(:[0-9a-f]{2}){5}$", re.IGNORECASE)

# Handle input and output
if len(sys.argv) != 2:
  print "Usage: wol.py <mac_address>"
  print "Example: wol.py 00:11:22:33:44:55"
  sys.exit(1)
elif mac_pattern.match(sys.argv[1]):
  wake(sys.argv[1])
  print "wol.py: Magic packet was sent to " + sys.argv[1] + "."
else:
  print "Invalid mac address format: " + sys.argv[1]
  print "Use format 00:11:22:33:44:55"
  sys.exit(2)

Backup to Microsoft OneDrive for Business (SharePoint) with Synology’s Hyper Backup

This is a follow-up to my article Backup to Microsoft OneDrive with Synology’s Hyper Backup. After presenting my solution for using Microsoft OneDrive (Personal) as a backup destination in Synology’s Hyper Backup, I was asked if it could also be used with OneDrive for Business. OneDrive for Business is based on SharePoint, which can be configured in different ways. Thanks to the node-sp-auth package, I was able to write another proxy server that works with several of the different SharePoint authentication mechanisms.

Weiterlesen

Backup to Microsoft OneDrive with Synology’s Hyper Backup

With Microsoft offering 1 TB of OneDrive cloud storage in it’s Office 365 subscription, it would be nice if that storage could be used to backup data from a Synology NAS. Unfortunately, Synology’s own backup solution for DSM, Hyper Backup, does not offer to use OneDrive as a backup destination. So here is my solution to this for those who can run Docker on their Synology NAS.

Weiterlesen

Adding Wi-Fi telemetry to the Pixhawk flight controller with an ESP8266 module

This article is about building a bidirectional MAVLink Wi-Fi telemetry module for the Pixhawk flight controller using an ESP8266 module with the MavESP8266 firmware. The newer Pixracer flight controller has a built-in connector for ESP-01 Wi-Fi modules, which can be flashed with the MavESP8266 firmware. This firmware can also be flashed to other ESP8266 based modules and the modules can also be connected to a Pixhawk. Weiterlesen

Windows 7 mittels Shrew Soft VPN Client per VPN mit FRITZ!Box 7390 (FRITZ!OS 6) verbinden

In FRITZ!OS 6.00 (84.06.00) gibt es neuerdings die Möglichkeit, VPN-Verbindungen direkt in der Benutzeroberfläche und ohne Umweg über das Programm FRITZ!Fernzugang einrichten anzulegen. In der Benutzeroberfläche lassen sich anschließend die VPN-Einstellungen für iPhone, iPad, iPod touch sowie Android ab Version 4.0.4 (Ice Cream Sandwich) anzeigen. Alternativ kann man aber z.B. auch den Shrew Soft VPN Client verwenden, um die per FRITZ!Box-Benutzeroberfläche angelegte VPN-Verbindung vom PC aus zu nutzen. Der Shrew Soft VPN Client ist in der Standard-Edition kostenlos und im Gegensatz zu AVMs FRITZ!Fernzugang unter anderem auch für die 64-Bit Versionen von Windows verfügbar.

Weiterlesen

ThinkPad T61: Vista Setup mit ThinkVantage-Taste aufrufen

ACHTUNG: Eine gelöschte Recovery-Partition kann nur mit den Lenovo Recovery CDs wiederhergestellt werden! Diese also ggf. vorher erstellen.

Wer die Recovery-Lösung von Lenovo nicht benötigt kann alternativ das Vista-Setup auf die Festplatte kopieren und mit der ThinkVantage-Taste aufrufen. Bei mir hat folgendes geklappt: Weiterlesen