Created
June 3, 2020 18:47
-
-
Save wibisono/e334e42dbc9eccab5061b760f82c3c88 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/local/bin/amm | |
| //Install ammonite.io and run amm checkroa.scala or if you +x you can run it as script. | |
| import $ivy.`net.ripe.rpki:rpki-commons:1.8.0` | |
| import net.ripe.rpki.commons.crypto.cms.roa.RoaCmsParser | |
| import java.nio.file.{Files, Paths} | |
| @main def main(args: String*){ | |
| if(args.length < 1){ | |
| println("Roa file name needed") | |
| System.exit(0) | |
| } | |
| val roaFile = args.toArray.head | |
| val rp = new RoaCmsParser() | |
| val roa = Files.readAllBytes(Paths.get(roaFile)) | |
| rp.parse(roaFile, roa) | |
| val roacms = rp.getRoaCms | |
| println(roacms.getAsn) | |
| roacms.getPrefixes.forEach(println) | |
| println("Not valid before " + roacms.getNotValidBefore) | |
| println("Not valid before " + roacms.getNotValidAfter) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment