FaradayRF / faradayio

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

Catch Sliplib Exception In CheckSerial() #62

Closed kb1lqc closed 6 years ago

kb1lqc commented 6 years ago

When testing with initial software/firmware interaction using FaradayRF hardware it was apparent that with enough time and data a sliplib error would occur and crash the faradayio module~

(faradayio-cli) bryce@bryce-ubuntu:~/Documents/virtualenvs/faradayio-cli$ sudo bin/faradayio-cli KB1LQC 1 -p /dev/ttyUSB0
Executing faradayio-cli version 0.0.4
^[[A^[[BException in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/faradayio/faraday.py", line 238, in run
    self.checkSerial()
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/faradayio/faraday.py", line 211, in checkSerial
    for item in self.rxSerial(self._TUN._tun.mtu):
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/faradayio/faraday.py", line 193, in rxSerial
    return(self._faraday.receive(length))
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/faradayio/faraday.py", line 80, in receive
    temp = slipDriver.receive(ret)
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/sliplib/slip.py", line 149, in receive
    return self.flush()
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/sliplib/slip.py", line 167, in flush
    msg = decode(p)
  File "/home/bryce/Documents/virtualenvs/faradayio-cli/lib/python3.5/site-packages/sliplib/slip.py", line 59, in decode
    raise ProtocolError(packet)
sliplib.slip.ProtocolError: b'B\x81\xf2\x9d\x82\x84\xad\x0cf2\x83+\x9a\x1b\xe0^t\x86p\x08\xda\xad\xaeP\xfaR\xbf=\xfb\x07+ &\xd30y\xb3\xe7}2\xb2\xeeh\xcfTz\xfc#d\x86\xba$\xc1\xcc\x18\x89\x9d=\x94\xd4\xbf\x0e\xf3\xbb\x1b}\xfa\x965\x84[\xed\xd5_\xed\xe0m\xcc\xebBD\xaa\x1d:#\xdc\x1b\x9e\x88\xf5n\xe3L\xa9S\xbd\xb0\x8c#\x97\x80a\x07M\x97\xbbi\x0eaDH:\xa7MtQ\x907\xdd\xd3H\xf2)=\xbd\xe3`G\xd8oD]Z\x1d\xdb\xee(v\xbb\x81f\xaa1\x00;1\x11\xa7\xc5d\x8cm\xb4!_\xdaU\xf3'
kb1lqc commented 6 years ago

Fixed per #63