# author: Pim Beune beacon_command_register( "patchlevel", "Get the patch level of a system by querying HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion. Requires an authenticated domain account. Works with hostnames and IP addresses.", "INFO: Get the patch level of a system by querying HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\nRequires an authenticated domain account. Works with hostnames and IP addresses.\n\n" . "EXAMPLES:\npatchlevel dc01.test.local\n" . "patchlevel 172.16.184.130"); alias patchlevel { $bid = $1; $hostname = $2; if ($hostname eq "") { berror($bid, "Please specify a hostname or IP address."); return; } # Read in the right BOF file $handle = openf(script_resource("dist/patchlevel." . barch($bid) . ".o")); $data = readb($handle, -1); closef($handle); # Pack our arguments $args = bof_pack($bid, "z", $hostname); beacon_inline_execute($bid, $data, "go", $args); }