OK, UNCLE -
The input od date is:
The Bash script is:
I'm tired, lack of coffee, but converting it to PHP is just not working. Mainly it the "element ^ code" that's got me snowed. Can someone convert this - so I can slap my forehead - ah duh!
Output should be: {"system":{"get_sysinfo":{"sw_ver":"1.0.5 Build 2 ....
Thanks
The input od date is:
Code:
0000000 \0 \0 002 [ 320 362 201 370 213 377 232 367 325 357 224 266
0000020 321 264 300 237 354 225 346 217 341 207 350 312 360 213 251 332
0000040 255 362 204 341 223 261 213 251 230 266 206 250 235 275 377 212
0000060 343 217 353 313 371 313 372 312 370 311 351 273 336 262 234 255
0000100 225 246 222 242 226 264 230 272 322 245 372 214 351 233 271 203
0000120 241 220 276 216 254 200 242 317 240 304 241 315 357 325 367 262
0000140 342 323 343 313 236 315 344 306 352 310 254 311 277 326 265 320
...
Code:
#!/bin/bash
code=171
offset=4
input_num=`od -j $offset -An -t u1 -v | tr "\n" " "`
IFS=' ' read -r -a array <<< "$input_num"
args_for_printf=""
for element in "${array[@]}"
do
output=$(( $element ^ $code ))
args_for_printf="$args_for_printf\x$(printf %x $output)"
code=$element
done
printf "$args_for_printf"
I'm tired, lack of coffee, but converting it to PHP is just not working. Mainly it the "element ^ code" that's got me snowed. Can someone convert this - so I can slap my forehead - ah duh!
Output should be: {"system":{"get_sysinfo":{"sw_ver":"1.0.5 Build 2 ....
Thanks