Files
sunnypilot/selfdrive/loggerd/ethernetsniffer.py
George Hotz 6fbcde48e5 Using lgtm.com and fixing found alerts (#1452)
* lgtm in readme, and mac nui fixes

* call super inits in radars

* unused imports, dup lines

* more radars, more unused imports

* pass CP into RadarInterfaceBase

* more fixups

* unused imports

* delete unused lines

* ugh, new unused import

Co-authored-by: George Hotz <geohot@gmail.com>
old-commit-hash: 1295cfe06c
2020-05-02 12:07:34 -07:00

17 lines
372 B
Python
Executable File

#!/usr/bin/env python3
import cereal.messaging as messaging
import pcap
def main():
ethernetData = messaging.pub_sock('ethernetData')
for ts, pkt in pcap.pcap('eth0'):
dat = messaging.new_message('ethernetData', 1)
dat.ethernetData[0].ts = ts
dat.ethernetData[0].pkt = str(pkt)
ethernetData.send(dat.to_bytes())
if __name__ == "__main__":
main()