ip_fields = (pkt.src,pkt.dst)
fields.append(ip_fields)
with open(‘packet_fields.v’,‘w’) as f:
for data in fields:
f.write(str(data))
Now, the issue is generated packet_fields.v file data is dumping like this:
[(‘ca:03:0d:b4:00:1c’, ‘ff:ff:ff:ff:ff:ff’), (‘ca:03:0d:b4:00:1c’, ‘ff:ff:ff:ff:ff:ff’)]
I want this data to be printed like this
48’hca030db4001c
48’hffffffffff like this i want to print in the file
How can i do this in python?
The list of tuples can be unpacked with a nested loop, but I’m not sure what 48’hca030db4001c means. I can see (what looks like) a MAC Address ca:03:0d:b4:00:1c in there, but I don’t know enough about the topic to advise. There are others here that have a far better understanding of this than I, so maybe you’ll get an answer, given time.