-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3383ff0
commit def67f8
Showing
15 changed files
with
859 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
- name: Install package | ||
run: poetry install | ||
- name: Insert test data | ||
run: poetry run tests/data/insert.py | ||
run: poetry run python tests/data/insert.py | ||
- name: Run tests | ||
run: poetry run pytest --cov=diamond_miner --cov-report=xml | ||
- uses: codecov/codecov-action@v3 | ||
|
@@ -41,30 +41,13 @@ jobs: | |
|
||
pypi: | ||
needs: [test] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
with: | ||
output-dir: dist | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.whl | ||
- uses: dioptra-io/publish-python-action@v1 | ||
with: | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
upload: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
wheel: false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from ipaddress import IPv6Address | ||
|
||
|
||
def format_probe( | ||
dst_addr_v6: int, src_port: int, dst_port: int, ttl: int, protocol: str | ||
) -> str: | ||
""" | ||
Create a Caracal probe string. | ||
Examples: | ||
>>> from diamond_miner.format import format_probe | ||
>>> format_probe(281470816487432, 24000, 33434, 1, "icmp") | ||
'::ffff:808:808,24000,33434,1,icmp' | ||
""" | ||
return f"{format_ipv6(dst_addr_v6)},{src_port},{dst_port},{ttl},{protocol}" | ||
|
||
|
||
def format_ipv6(addr: int) -> str: | ||
""" | ||
Convert an IPv6 UInt128 to a string. | ||
>>> from diamond_miner.format import format_ipv6 | ||
>>> format_ipv6(281470816487432) | ||
'::ffff:808:808' | ||
""" | ||
return str(IPv6Address(addr)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.