Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed ipv6 conversion to dnsbl format; added gh actions #33

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pydnsbl # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
2 changes: 1 addition & 1 deletion pydnsbl/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def prepare_query(self, request):
return '.'.join(reversed(request.split('.')))
elif address.version == 6:
# according to RFC: https://tools.ietf.org/html/rfc5782#section-2.4
request_stripped = request.replace(':', '')
request_stripped = address.exploded.replace(':', '')
return '.'.join(reversed([x for x in request_stripped]))
else:
raise ValueError('unknown ip version')
Expand Down
1 change: 0 additions & 1 deletion pydnsbl/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def process_response(self, response):
'dnsbl.cyberlogic.net',
'dnsbl.sorbs.net',
'drone.abuse.ch',
'dul.ru',
'images.rbl.msrbl.net',
'ips.backscatterer.org',
'ix.dnsbl.manitu.net',
Expand Down
7 changes: 7 additions & 0 deletions pydnsbl/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ def test():
thr.join()
assert result.blacklisted

# ipv6 tests
def test_ipv6_converting():
# https://datatracker.ietf.org/doc/html/rfc5782#section-2.4
checker = DNSBLIpChecker()
assert checker.prepare_query('2001:db8:1:2:3:4:567:89ab') == "b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2"


## COMPAT TESTS
def test_checker_compat_0_6():
checker = DNSBLChecker()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiodns>=1.1.1,<=2.0
aiodns>=3,<3.1
idna>=2.9,<3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_long_description():

setup(
name='pydnsbl',
version='1.1.5',
version='1.1.6',
description='Async dnsbl lists checker based on asyncio/aiodns.',
long_description=get_long_description(),
long_description_content_type='text/markdown',
Expand Down
Loading