I am trying to find a way to access the MAC address of a packet, or at the very least how to access the ethernet layer(or if it is possible in the first place??). I know that pyshark has the ethernet layer, but have not found any documentation to tell me how access the information within it. I have been using this documentation so far: https://github.com/johnbumgarner/pyshark_packet_analysis (John if you see this thank you for your fantastic work).
I first tried to access the ethernet layer this way, as I understand from my traffic that the source and destination MAC addresses are included there.
macList = []
for pkt in cap:
if ("ETH Layer" in pkt.layers):
print(pkt.layers.ETH)
print("ETH packet")
After this I would like to append the MAC address to a list:
macList.append(pkt.layers.ETH)