Skip to content

Commit

Permalink
Merge pull request #9 from blacklanternsecurity/whitelist-blacklist
Browse files Browse the repository at this point in the history
Readme, comments
  • Loading branch information
TheTechromancer authored Oct 30, 2024
2 parents dd864b2 + e8e0b52 commit f2d4af3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RadixTarget is:
- Used by:
- [BBOT](https://github.com/blacklanternsecurity/bbot)
- [cloudcheck](https://github.com/blacklanternsecurity/cloudcheck)
Written in pure python and capable of roughly 100,000 lookups per second regardless of database size, it's perfect for production .

### Installation ([PyPi](https://pypi.org/project/radixtarget/))

Expand Down
1 change: 1 addition & 0 deletions radixtarget/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .radixtarget import RadixTarget
from .helpers import host_size_key # noqa

# alias for convenience
Target = RadixTarget
14 changes: 12 additions & 2 deletions radixtarget/radixtarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,22 @@ def get(self, host, raise_error=False):
return self.dns_tree.search(host, raise_error=raise_error)

def search(self, host, raise_error=False):
"""
Alias for get
"""
return self.get(host, raise_error=raise_error)

def insert(self, t, data=None):
self.add(t, data=data)
"""
Alias for add
"""
return self.add(t, data=data)

def put(self, t, data=None):
self.add(t, data=data)
"""
Alias for add
"""
return self.add(t, data=data)

def add(self, t, data=None):
"""
Expand Down Expand Up @@ -114,6 +123,7 @@ def _add(self, host, data=None):
return self._add_host(host, data=data)

def _add_host(self, host, data=None):
host = make_ip(host)
self._hash = None
self._hosts.add(host)
if is_ip(host):
Expand Down

0 comments on commit f2d4af3

Please sign in to comment.