python - Scapy get the actual value of a field -
python - Scapy get the actual value of a field -
this question related this other one
i check value of field in scapy:
def compute(fields): print fields print fields[1].name print fields[1].size print fields[1].default homecoming 23 class foo(packet): array=[ bitfield("foo",0x0,2), bitfield("foo1",0x0,2), bitfield("bar",0x0,2), bitfield("blub",none,2) ] def post_build(self, p, pay): print dir(self.array[1]) res = compute(self.array) p = struct.pack(">b", res) homecoming p if __name__ == "__main__": interact(mydict=globals(), mybanner="")
the code not entirly working, of import parts are. output is:
[<field ().foo>, <field ().foo1>, <field ().bar>, <field ().blub>] foo1 2 0
now, problem when alter value on commandline:
>>> a=foo() >>> a.foo1=0x23 >>> a.show2()
how can find out (in compute method) value foo1 has? think not hard question, cannot figure out i'm missing here :/ cool if give me hand :)
with best regards
from command line (or in code declare scapy layer) access scapy layer , field so:
>>> a=foo() >>> a[foo].foo1 = 0x23
does reply question? if not, explain purpose of compute() function , edit answer.
python scapy
Comments
Post a Comment