From 7e422fd3768d6481e95f9417e1d96e63821c2bc9 Mon Sep 17 00:00:00 2001 From: bradd Date: Thu, 28 Sep 2023 17:16:41 +0000 Subject: [PATCH] check if asn is a string and if it starts with "AS" --- cron_scripts/rpki/rpki_validator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cron_scripts/rpki/rpki_validator.py b/cron_scripts/rpki/rpki_validator.py index f134b2e..4de35a0 100755 --- a/cron_scripts/rpki/rpki_validator.py +++ b/cron_scripts/rpki/rpki_validator.py @@ -55,7 +55,8 @@ def load_export(db, server, rpkiuser, rpkipassword): asn, prefix_full, max_length = line['asn'], line['prefix'], line['maxLength'] # remove the characters "AS", some RPKI vendors include this in their data - asn = asn.replace('AS','') + if isinstance(asn, str) and asn.startswith('AS'): + asn = asn.replace('AS','') prefix, prefix_len = prefix_full.split('/')[0], prefix_full.split('/')[1]