diff --git a/README.md b/README.md index 52f1494..a7caf89 100755 --- a/README.md +++ b/README.md @@ -107,3 +107,41 @@ hcxpcapngtool -o wpa.hccapx wpa*-01.cap && hashcat -m 22000 -a 0 wpa.hccapx \ /usr/share/wordlists/rockyou.txt.gz ``` + +## Running via systemd + +The systemd unit files can be used to automatically start the corresponding +scripts upon system boot. + +This setup assumes the repository to be located in the /root directory. + +Install the systemd unit files. + +```sh +sudo cp -v wpe-mon@.service /etc/systemd/system/wpe-mon@.service +sudo cp -v wpe@.service /etc/systemd/system/wpe@.service +``` + +Apply the changes. + +```sh +sudo systemctl daemon-reload +``` + +To set the mon script to use the wlan1 interface and start automatically. + +```sh +sudo systemctl enable wpe-mon@wlan1.service +``` + +Alternatively with the wlan2 interface. + +```sh +sudo systemctl enable wpe-mon@wlan2.service +``` + +Similarly for the wpe script. + +```sh +sudo systemctl enable wpe@wlan1.service +``` diff --git a/wpe-mon@.service b/wpe-mon@.service new file mode 100644 index 0000000..034c46c --- /dev/null +++ b/wpe-mon@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Run wpe mon for %I +# Tie the service lifecycle to the kernel device for the interface +BindsTo=sys-subsystem-net-devices-%i.device +After=sys-subsystem-net-devices-%i.device + +[Service] +Type=simple +WorkingDirectory=/root/wpe +ExecStart=/root/wpe/mon -i %I +Restart=on-failure +RestartSec=5 + +[Install] +# Make the service start whenever the device unit appears +WantedBy=sys-subsystem-net-devices-%i.device diff --git a/wpe@.service b/wpe@.service new file mode 100644 index 0000000..e295888 --- /dev/null +++ b/wpe@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Run wpe for %I +# Tie the service lifecycle to the kernel device for the interface +BindsTo=sys-subsystem-net-devices-%i.device +After=sys-subsystem-net-devices-%i.device + +[Service] +Type=simple +WorkingDirectory=/root/wpe +ExecStart=/root/wpe/wpe -i %I +Restart=on-failure +RestartSec=5 + +[Install] +# Make the service start whenever the device unit appears +WantedBy=sys-subsystem-net-devices-%i.device