FaradayRF / faradayio

FaradayRF TUN/TAP adapter
https://www.faradayrf.com
GNU General Public License v3.0
15 stars 6 forks source link

Catch AttributeError when FaradayIO is Run as Non-Root User #42

Closed kb1lqc closed 6 years ago

kb1lqc commented 6 years ago

When running the faradayio-cli program testing https://github.com/FaradayRF/faradayio-cli/issues/8 it was discovered that there is an AttributeError when the user does not use sudo. This should be caught per the error message below.

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ faradayio-cli KB1LQC 1 -l
Executing faradayio-cli version 0.0.1
[Errno 1] Operation not permitted
Exception ignored in: <bound method TunnelServer.__del__ of <faradayio.faraday.TunnelServer object at 0x7f5c304c3550>>
Traceback (most recent call last):
  File "/home/bryce/Documents/git/faradayio/faradayio/faraday.py", line 112, in __del__
    self._tun.down()
AttributeError: 'TunnelServer' object has no attribute '_tun'
kb1lqc commented 6 years ago

Interesting! It appears that this error doesn't exist anymore. Possibly fixed it with the unit test fixes in #45. When running faradayio-cli as a non-sudo user the program exits as expected printing just error code.

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio$ faradayio-cli KB1LQC 1
Executing faradayio-cli version 0.0.1
[Errno 1] Operation not permitted
TUN brought down...
kb1lqc commented 6 years ago

This is being performed in the faradayio-cli project per https://github.com/FaradayRF/faradayio-cli/issues/15. Closing this ticket.

kb1lqc commented 6 years ago

This still exists. Just caught this when releasing the faradayio-cli==0.0.1 code:

bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ .venv/bin/faradayio-cli KB1LQC 1
Executing faradayio-cli version 0.0.1
Warning! faradayio-cli must be run with sudo privileges!
[Errno 1] Operation not permitted
Exception ignored in: <bound method TunnelServer.__del__ of <faradayio.faraday.TunnelServer object at 0x7f85bc6440b8>>
Traceback (most recent call last):
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 114, in __del__
    self._tun.down()
AttributeError: 'TunnelServer' object has no attribute '_tun'
kb1lqc commented 6 years ago

Hmm odd I can't reproduce this now. Closing until I reproduce it and then I must immediately investigate.