+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netpacket/packet.h>
+#include <net/ethernet.h>
+
+typedef struct frame {
+ char header[14];
+ unsigned short datalen;
+ unsigned char cmd;
+ char data[];
+} frame;
+
+int sendsock;
+
+void send_text(char *d, int len)
+{
+ int datalen = sizeof(frame) + len;
+ frame * f = alloca(datalen + 1);
+ struct sockaddr_ll addr;
+
+ memcpy(f->header, "\x00\xb0\xd0\x97\xbc\xac\x00\x03\x93\x87\x84\x8C\x13\x38", 14);
+ f->datalen = len;
+ f->cmd = 0x42;
+ memcpy(f->data, d, len);
+
+ addr.sll_family = AF_PACKET;
+ addr.sll_ifindex = 2;
+ addr.sll_halen = 0;
+
+ if (sendto(sendsock, f, datalen, 0, (struct sockaddr *)&addr, sizeof(addr)) < datalen)
+ perror("sendto");
+}
+
+void send_reboot() {
+ frame f;
+ struct sockaddr_ll addr;
+
+ memcpy(f.header, "\x00\xb0\xd0\x97\xbc\xac\x00\x03\x93\x87\x84\x8C\x13\x38", 14);
+ f.datalen = 0;
+ f.cmd = 0xFE;
+ addr.sll_family = AF_PACKET;
+ addr.sll_ifindex = 2;
+ addr.sll_halen = 0;
+
+ if (sendto(sendsock, &f, sizeof(frame), 0, (struct sockaddr *)&addr, sizeof(addr)) < sizeof(frame))
+ perror("sendto");
+}
+