diff --git a/lib/functions.php b/lib/functions.php index 6d6bd99..f6730af 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -119,6 +119,13 @@ function writeRoutinatorExceptionFile ($roas) function writeExportJSON ($roas) { + $n = 0; + foreach ($roas['roas'] as $object) + { + $roas['roas'][$n]['asn'] = "AS" . $roas['roas'][$n]['asn']; + $n++; + } + $json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); $fp = fopen ('roa/export_dn42.json', 'w'); diff --git a/roagen.php b/roagen.php index cf90721..e680c2b 100755 --- a/roagen.php +++ b/roagen.php @@ -97,7 +97,7 @@ foreach ($raw_array as $sub_array) // Extract ASxxxxx from string. preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); - $roas["roas"][$k]["asn"] = $_asn[0]; + $roas["roas"][$k]["asn"] = trim ($_asn[0], "AS"); $roas["roas"][$k]["prefix"] = $_prefix; $roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV6_AS0); $roas["roas"][$k]["ta"] = $_ta; @@ -187,7 +187,7 @@ foreach ($raw_array as $sub_array) // Extract ASxxxxx from string. preg_match ("/AS[0-9]+/", explode (":", $asn)[1], $_asn); - $roas["roas"][$k]["asn"] = $_asn[0]; + $roas["roas"][$k]["asn"] = trim ($_asn[0], "AS"); $roas["roas"][$k]["prefix"] = $_prefix; $roas["roas"][$k]["maxLength"] = ($_asn[0] != "AS0" ? $_maxlength : MAX_LEN_IPV4_AS0); $roas["roas"][$k]["ta"] = $_ta;