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

Connector not found inside dockerized app #109

Open
therockf opened this issue Feb 21, 2024 · 4 comments
Open

Connector not found inside dockerized app #109

therockf opened this issue Feb 21, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@therockf
Copy link

therockf commented Feb 21, 2024

Hello,
i am trying to dockerize memflow.
Initially i tried with normal memflow, now i am trying with memflow-py

This is my dockerfile:

FROM python:3.8-slim-bullseye

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        build-essential \
        curl \
        git \
        libbz2-dev \
        libncurses5-dev \
        libncursesw5-dev \
        libreadline-dev \
        libsqlite3-dev \
        libssl-dev \
        llvm \
        make \
        tk-dev \
        wget \
        xz-utils \
        zlib1g-dev \
        gcc \
        locales \
        python3-venv \
        python3-dev \
        procps \
        sudo
        
RUN echo 'vm.overcommit_memory=1' >> /etc/sysctl.conf

RUN sed -i '/it_IT.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen
ENV LANG it_IT.UTF-8  
ENV LANGUAGE it_IT:it  
ENV LC_ALL it_IT.UTF-8

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

RUN cargo install memflowup --force

RUN /root/.cargo/bin/memflowup install memflow-qemu
RUN /root/.cargo/bin/memflowup install memflow-win32

COPY requirements.txt .

RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install wheel
RUN pip3 install -r requirements.txt

WORKDIR /app

COPY main.py .
COPY utils.py .
COPY offsets.py .
COPY config.py .
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh

CMD ["./entrypoint.sh"]

In both cases it looks like the code can't find the connectors. But they are installed correctly.

qemu-readmem-python           |   File "/app/./utils.py", line 50, in read_memory
qemu-readmem-python           |     connector = inventory.create_connector("qemu")
qemu-readmem-python           | Exception: connector: specified (connector) target could not be found

but the connectors are there:

qemuuser@2b9a84bb6e7b:/app$ ls $HOME/.local/lib/memflow/
libmemflow_qemu.stable.so  libmemflow_win32.stable.so

the user is correct:

qemuuser@2b9a84bb6e7b:/app$ ps -u qemuuser | grep uwsgi
      9 ?        00:00:02 uwsgi
     27 ?        00:00:00 uwsgi
     31 ?        00:00:00 uwsgi

This also happens using normal Rust memflow.

Inside a dockerized app, this results in connector not found.:


    let inventory = Inventory::scan();
    let connector = inventory
        .create_connector("qemu", None, connector_args.as_ref())
        .expect("unable to initialize qemu connector");

That doesn't happen if running outside docker! What is wrong there?

I have also tried manually adding the scan dir to the inventory buut nothing changes!

@danielnehrig
Copy link
Contributor

danielnehrig commented Feb 23, 2024

what does the memflow logger output say regarding scanning dirs and found connectors

simple_logger::init_with_level(log::Level::Info).unwrap();

@therockf
Copy link
Author

simple_logger::init_with_level(log::Level::Info).unwrap();

Just nothing, I have also tried that inside docker container, looks like it doesn't find any connector, tried to put in .local and in /usr/local/etc.... and also tried manually adding the directory to the inventory, but nothing worked.

@danielnehrig
Copy link
Contributor

you mean you get no stdout at all ?

@therockf
Copy link
Author

you mean you get no stdout at all ?

Yep. Scanning dirs I see no stdout, then when printing the output from the inventory scan it doesn't print anything too

@ko1N ko1N added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants