Skip to content
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
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ COPY marine ./marine

ENV PY="/opt/python/cp38-cp38/bin/python"

RUN mkdir marine/.wslibs && \
cp /build/run/libmarine.so /build/run/lib*so.0 marine/.wslibs/ && \
RUN mkdir -p marine/.ws/data && \
rsync -L --exclude idl2wrs --exclude 'lib*.so*' --exclude 'plugins*' --exclude 'marine_*' --exclude tshark --exclude '*.html' --exclude 'lib*.a' /build/run/* marine/.ws/data/ && \
mkdir marine/.ws/libs && \
rsync -L /build/run/libmarine.so /build/run/lib*so.0 marine/.ws/libs/ && \
$PY setup.py bdist_wheel --dist-dir /tmp

WORKDIR /dist
Expand Down
7 changes: 6 additions & 1 deletion marine/marine.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ctypes import *
from pathlib import Path
from typing import Optional, List, Dict, Tuple, NamedTuple
import os

from .exceptions import (
BadBPFException,
Expand All @@ -17,7 +18,9 @@ class MarineResult(Structure):

MARINE_RESULT_POINTER = POINTER(MarineResult)

MARINE_NAME = Path(__file__).parent / ".wslibs" / "libmarine.so"
MARINE_BASE_DIR = Path(__file__).parent / ".ws"
MARINE_NAME = MARINE_BASE_DIR / "libs" / "libmarine.so"
MARINE_DATA_DIR = MARINE_BASE_DIR / "data"


class MarineFieldsValidationResult(NamedTuple):
Expand Down Expand Up @@ -46,6 +49,8 @@ class Marine:
WIFI_RADIO_PROTOCOLS = frozenset(["radiotap", "wlan", "wlan_radio"])

def __init__(self, epan_auto_reset_count: Optional[int] = None):
if not os.getenv("WIRESHARK_DATA_DIR"):
os.putenv("WIRESHARK_DATA_DIR", str(MARINE_DATA_DIR))
try:
cdll.LoadLibrary(MARINE_NAME)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
packages=["marine"],
include_package_data=True,
package_data={
"marine": [".wslibs/*.so*"],
"marine": [".ws/libs/*.so*", ".ws/data/*"],
},
)