mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
Patching of pcap lib removed
This commit is contained in:
parent
f08bb52403
commit
523ab8c184
1 changed files with 0 additions and 12 deletions
12
readme.md
12
readme.md
|
@ -25,7 +25,6 @@ In this project, we call this mode *ListenMode*.
|
||||||
- Modify the configuration of the PLC adaptor, that it supports HomePlug Green Phy including the SLAC.
|
- Modify the configuration of the PLC adaptor, that it supports HomePlug Green Phy including the SLAC.
|
||||||
- Install wireshark to view the network traffic
|
- Install wireshark to view the network traffic
|
||||||
- Install Pcap-ct python library
|
- Install Pcap-ct python library
|
||||||
- Patch Pcap-ct to support non-blocking operation
|
|
||||||
- Get and compile the exi decoder/encoder from http://github.com/uhi22/OpenV2Gx
|
- Get and compile the exi decoder/encoder from http://github.com/uhi22/OpenV2Gx
|
||||||
- Run `python pyPlc.py` and use keyboard to trigger actions, or
|
- Run `python pyPlc.py` and use keyboard to trigger actions, or
|
||||||
- Run `python pyPlc.py E` for EVSE (charger) mode, or
|
- Run `python pyPlc.py E` for EVSE (charger) mode, or
|
||||||
|
@ -98,17 +97,6 @@ This is fighting against the Libpcap-installation, so we need to deinstall the s
|
||||||
python -m pip uninstall libpcap
|
python -m pip uninstall libpcap
|
||||||
Then again install pcap-ct, and finally add in the libpcap\_platform\__init__py the missing is_osx = False. (Is in the meanwhile fixed in the github repository.)
|
Then again install pcap-ct, and finally add in the libpcap\_platform\__init__py the missing is_osx = False. (Is in the meanwhile fixed in the github repository.)
|
||||||
|
|
||||||
Finally, we need to patch the Pcap-ct, because the python script needs a non-blocking version. This is discussed in https://github.com/karpierz/pcap-ct/issues/9
|
|
||||||
|
|
||||||
Now, in the IDLE shall 3.10.6, the import works:
|
|
||||||
```
|
|
||||||
import pcap
|
|
||||||
sniffer = pcap.pcap(name=None, promisc=True, immediate=True, timeout_ms=50)
|
|
||||||
addr = lambda pkt, offset: '.'.join(str(pkt[i]) for i in range(offset, offset + 4))
|
|
||||||
for ts, pkt in sniffer:
|
|
||||||
print('%d\tSRC %-16s\tDST %-16s' % (ts, addr(pkt, sniffer.dloff + 12), addr(pkt, sniffer.dloff + 16)))
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage on Raspberry
|
### Usage on Raspberry
|
||||||
Pitfall: Pcap-ct does not work with Python 3.4. After update to Python 3.8, it works.
|
Pitfall: Pcap-ct does not work with Python 3.4. After update to Python 3.8, it works.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue