-
-
Save Brother-Lal/e8330b64808cebef288aedb3b5407c62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Nodes.json von meshviewer laden (per web unter <meshviewerinstall>/nodes.json) | |
* jq nutzen: | |
* cat nodes.json| jq '.nodes | to_entries | map({key,seen:.value.firstseen}) ' > nodes.firstseen | |
* hopglass server stoppen | |
* Raw.json von hopglass laden (/etc/hopglass/default/raw.json) | |
* php convert.php | |
* scp rawer.json auf /etc/hopglass/default/raw.json | |
* hopglass server starten | |
* Done | |
* | |
*/ | |
$input = json_decode(file_get_contents("nodes.firstseen")); | |
$output = json_decode(file_get_contents("raw.json")); | |
$sa=array(); | |
foreach($input as $d) | |
{ | |
$sa[$d->key] = $d->seen; | |
} | |
foreach($output as $key => &$d) | |
{ | |
if(isset($sa[$key])) | |
{ | |
$d->firstseen = $sa[$key] . ".503Z"; | |
} | |
} | |
file_put_contents("rawer.json",json_encode($output)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment