In Scapy, I want to compare multiple header fields between any two packages a and b . This list of fields is predefined, say:
fieldsToCompare = ['tos', 'id', 'len', 'proto'] #IP header
I usually did this individually:
if a[IP].tos == b[IP].tos: ... do stuff...
Is there a way to access these package fields from a list of strings, including what each of them calls? How:
for field in fieldsToCompare: if a[IP].field == b[IP].field: ... do stuff...
source share