Electric vehicle CCS charging investigations with Python
Find a file
2022-10-16 02:57:57 +02:00
.gitignore added gitignore 2022-10-14 18:16:22 +02:00
demo_pcap.py non blocking reception works 2022-10-14 23:36:03 +02:00
PLC_on_Windows_and_raspberry.docx setkey and getkey are working 2022-10-16 02:57:57 +02:00
pyPlc.py added tkinter top level module and submodules 2022-10-14 18:11:01 +02:00
pyPlcHomeplug.py setkey and getkey are working 2022-10-16 02:57:57 +02:00
pyPlcWorker.py setkey and getkey are working 2022-10-16 02:57:57 +02:00
readme.md Added test image in readme.md 2022-10-09 15:47:56 +02:00

Some try-outs with Python and network adaptor low-level communiation

Installation / Preconditions

Tested with windows10

  1. Install python (windows automatically launches the installer if you type „python“ into the search field of the task bar)
  2. Wireshark is already installed, this includes the pcap driver, which is necessary for low-level-network-interaction

Attention: There are (at least) three different python-libs available for pcap:

python -m pip install --upgrade pcap-ct This is fighting against the Libpcap-installation, so we need to deinstall the second: python -m pip uninstall libpcap Then again install pcap-ct, and finally add in the libpcap_platform__init__py the missing is_osx = False.

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)))

Test image

(Just added in the Github web interface while editing the readme.md, by pressing Ctrl-V) image

Further steps

(to be continued)