From acf0c5b84650fc6c1c862e250f0f71991185e231 Mon Sep 17 00:00:00 2001 From: Junior Date: Sun, 23 Feb 2025 15:53:38 -0500 Subject: [PATCH] Add a CLI version of setcolor.php --- setcolor_cli.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 setcolor_cli.php diff --git a/setcolor_cli.php b/setcolor_cli.php new file mode 100755 index 0000000..bb0f660 --- /dev/null +++ b/setcolor_cli.php @@ -0,0 +1,43 @@ +#!/usr/bin/php + \n\n"; + exit(); +} +$hex = $argv[1]; +if ( !ctype_xdigit($hex) || (strlen($hex) != 6) ) { + echo "Invalid six character hex color patter in ARG[1]\n"; + exit(); +} +$targets = explode(",", $argv[2]); +foreach ( $targets as $target ) { + if ( !is_numeric($target) ) { + echo "Invalid targetd id: {$target}\n"; + exit(); + } +} + +$command = 0x01; +$unique = mt_rand(1, 2000000000); +$red = hexdec(substr($hex, 0, 2)); +$green = hexdec(substr($hex, 2, 2)); +$blue = hexdec(substr($hex, 4, 2)); + +var_dump($targets); +foreach ( $targets as $target ) { + $target = intval($target); + $unique = mt_rand(1, 2000000000); + $data = pack("LLLCLLCCC", PACKETFILTER[0], PACKETFILTER[1], $unique, $command, $target, 1, $red, $green, $blue); + transmitMessage($data); +} + + +?>