Skip to content

Commit

Permalink
fixed type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ssw committed Jan 10, 2023
1 parent 0dc2241 commit 6081b44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def get_asn_from_as(asn):
# Remove the "AS" from the beginning of the ASN
if asn.startswith("AS") or asn.startswith("as"):
asn = asn[2:]
asn = int(asn)
return asn
def get_more_specifics(data):
"""
Expand Down Expand Up @@ -90,11 +91,10 @@ def is_valid_prefix(prefix):
return False

def is_valid_asn(asn):
# Check if the ASN is a string starting with "AS", followed by numbers
if re.match(r'^[Aa][Ss]\d+$', asn):
# Check if the ASN is a string starting with "AS", followed by numbers or just a number
if type(asn) is int:
return True
# Check if the ASN is just numbers
elif asn.isdigit():
if re.match(r'^[Aa][Ss]\d+$', asn):
return True
else:
return False
Expand Down
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</head>
<body>
<p style="text-align: center">This app queries the stat.ripe.net to determine if a RPKI-ROA created with the following information<br>would likely agree (i.e., not evaluate as invalid) for routes currently seen in the Internet</p>
<form form action="/results" method="get">>
<form form action="/results" method="get">
<label for="ip_prefix">IP Prefix:</label>
<input type="text" id="ip_prefix" name="ip_prefix" placeholder="10.1.0.0/16" required>
<label for="prefix_maxlength">Prefix Maxlength:</label>
Expand Down

0 comments on commit 6081b44

Please sign in to comment.