Skip to content

Instantly share code, notes, and snippets.

@djGrrr
djGrrr / multicast_upgrader.py
Last active September 7, 2024 13:51
Python WAS-110 Multicast Upgrader
#!/usr/bin/env python3
__author__ = "Visual Studio"
__credits__ = ["djGrrr", "Visual Studio"]
__license__ = "MIT"
__version__ = "1.0.0.0"
# Credit: https://gist.github.com/djGrrr/4413dacee0df28429306e9fdf4624e02
from signal import *
@djGrrr
djGrrr / multicast_upgrader.php
Created August 5, 2024 01:05
WAS-110 Multicast Upgrader
<?php
$source_ip = '192.168.1.2';
$source_port = 0;
$dest_ip = '192.168.1.1';
$dest_port = 13456;
$block_size = 1436;
###############################################################################
function _err(string $message = '', int $code = 1): void {
if (strlen($message))
# WARNING: DO NOT RUN THIS AS A SCRIPT, RUN THE COMMANDS MANUALLY
# Make rootfs persistent (yes, this command must be run twice)
fw_setenv bootcmd "run ubi_init; run flash_flash"
fw_setenv bootcmd "run ubi_init; run flash_flash"
# Confirm the change:
strings /dev/mtd1 | grep bootcmd
strings /dev/mtd2 | grep bootcmd
<?php
# to get a eeprom dump from the stick:
# ethtool -m pon0 raw on | base64
function dH(int $dec) { $hex = strtoupper(dechex($dec)); $l = strlen($hex); return "0x".str_pad($hex, ceil($l / 2) * 2, "0", STR_PAD_LEFT); }
function sH(string $string) { return strtoupper(bin2hex($string)); }
function cH(string $char) { return dH(ord($char)); }
function dB(int $dec) { $bin = decbin($dec); $l = strlen($bin); return str_pad($bin, ceil($l/8) * 8, "0", STR_PAD_LEFT); }
function bl(bool $bool) { return $bool ? 'true' : 'false'; }
diff -ur /root/dhclient/bpf.c sbin/dhclient/bpf.c
--- /root/dhclient/bpf.c 2023-06-15 11:41:32.749372000 -0230
+++ sbin/dhclient/bpf.c 2023-06-15 16:12:19.135346000 -0230
@@ -365,7 +365,7 @@
if (to.s_addr == INADDR_BROADCAST)
assemble_hw_header(interface, buf, &bufp);
assemble_udp_ip_header(buf, &bufp, from.s_addr, to.s_addr,
- htons(REMOTE_PORT), (unsigned char *)&raw, len);
+ htons(REMOTE_PORT), (unsigned char *)&raw, len, interface);
diff -ur /root/dhclient/clparse.c sbin/dhclient/clparse.c
--- /root/dhclient/clparse.c 2023-06-15 11:41:32.754958000 -0230
+++ sbin/dhclient/clparse.c 2023-06-15 12:23:19.363379000 -0230
@@ -47,6 +47,7 @@
#include "dhcpd.h"
#include "dhctoken.h"
+#include <netinet/ip.h>
struct client_config top_level_config;