Skip to content

Instantly share code, notes, and snippets.

@wibisono
Created June 3, 2020 18:47
Show Gist options
  • Select an option

  • Save wibisono/e334e42dbc9eccab5061b760f82c3c88 to your computer and use it in GitHub Desktop.

Select an option

Save wibisono/e334e42dbc9eccab5061b760f82c3c88 to your computer and use it in GitHub Desktop.
#!/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