Skip to content

Commit

Permalink
Make it possible to lookup abuse-c-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoniaBK committed Apr 4, 2024
1 parent 31ce5e8 commit 3bd670e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions uwhoisd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ def whois(self, query: str) -> str:
zone = 'ipv6'
elif query.lower().startswith('as') and query.lower()[2:].isdigit():
zone = 'asn'
# if query is no ip, asn or fqdn
elif not utils.is_well_formed_fqdn(query):
zone = 'abuse-c' # what would be the correct zone for an abuse-c object
else:
# Domain, strip hostname part if needed
query, zone = self._strip_hostname(query)
Expand Down
9 changes: 5 additions & 4 deletions uwhoisd/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ def on_connect(self):
if self._timed_out:
return
whois_query = self.data.decode().strip().lower()
if not utils.is_well_formed_fqdn(whois_query) and ':' not in whois_query and not whois_query.lower().startswith('as'):
whois_entry = "; Bad request: '{0}'\r\n".format(whois_query)
else:
whois_entry = self.query_fct(whois_query)
#should all the chekcing be removed?
#if not utils.is_well_formed_fqdn(whois_query) and ':' not in whois_query and not whois_query.lower().startswith('as'):
# whois_entry = "; Bad request: '{0}'\r\n".format(whois_query)
#else:
whois_entry = self.query_fct(whois_query)
yield self.stream.write(whois_entry.encode())
except tornado.iostream.StreamClosedError:
logger.warning('Connection closed by %s.', self.client)
Expand Down

0 comments on commit 3bd670e

Please sign in to comment.