wraith-wireless / PyRIC

Python wireless library for Linux
http://wraith-wireless.github.io/PyRIC
Other
92 stars 50 forks source link

Question: can't get card info in docker container #39

Open slava-nikulin opened 7 years ago

slava-nikulin commented 7 years ago

My question is: is it possible to get card info in docker container? Here is my Dockerfile:

FROM ubuntu:latest

# RUN echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list

RUN apt-get -y update && apt-get -y dist-upgrade && apt-get clean
RUN apt-get -y install git

RUN git clone https://github.com/wifiphisher/wifiphisher.git
RUN apt-get -y install software-properties-common python-software-properties
RUN apt-get install -y python-setuptools
RUN apt-get install -y hostapd
RUN apt-get install -y dnsmasq
RUN cd wifiphisher && python setup.py install
RUN apt-get install -y python-scapy
RUN apt-get install -y python-dbus
RUN apt-get install -y network-manager
RUN apt-get install -y whoopsie
RUN apt-get install -y nano
RUN apt-get install -y tcpdump

CMD ["/bin/bash"]

Build image: docker build . -t "ubuntu:1"

Start container: docker run -it --privileged ubuntu:1 /bin/bash

Restart dbus: /etc/init.d/dbus restart

Get card:

root@4453a82e7028:# python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyric.pyw as pyw
>>> pyw.getcard('eth0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyRIC-0.1.6.3-py2.7.egg/pyric/pyw.py", line 269, in getcard
    if nlsock is None: return _nlstub_(getcard, dev)
  File "/usr/local/lib/python2.7/dist-packages/PyRIC-0.1.6.3-py2.7.egg/pyric/pyw.py", line 2236, in _nlstub_
    return fct(*argv)
  File "/usr/local/lib/python2.7/dist-packages/PyRIC-0.1.6.3-py2.7.egg/pyric/pyw.py", line 270, in getcard
    return devinfo(dev, nlsock)['card']
  File "/usr/local/lib/python2.7/dist-packages/PyRIC-0.1.6.3-py2.7.egg/pyric/pyw.py", line 1050, in devinfo
    raise pyric.error(e.errno, e.strerror)
pyric.error: [Errno 2] No such file or directory
>>>

Or maybe I'm doing something wrong?

eSoares commented 5 years ago

Hello, I think you need to add "--network host" in our docker run command in order to view the network interfaces of your host.