title: Scapy get the actual value of a field
body: <p>this question is related to <a href="https://stackoverflow.com/questions/6692411/scapy-bitfield-and-type-question">this other one</a> </p>
  
  <p>I would like to check the value of a Field in scapy:</p>
  
  <pre><code>def compute(fields):
      print fields
      print fields[1].name
      print fields[1].size
      print fields[1].default
      return 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("&gt;b", res)
            return p
  
  if __name__ == "__main__":
       interact(mydict=globals(), mybanner="")
  </code></pre>
  
  <p>The code is not entirly working, but the important parts are. The output is:</p>
  
  <pre><code>[&lt;Field ().foo&gt;, &lt;Field ().foo1&gt;, &lt;Field ().bar&gt;, &lt;Field ().blub&gt;]
  foo1
  2
  0
  </code></pre>
  
  <p>Now, the problem is when I change a value on the commandline:</p>
  
  <pre><code>&gt;&gt;&gt; a=Foo()
  &gt;&gt;&gt; a.foo1=0x23
  &gt;&gt;&gt; a.show2()
  </code></pre>
  
  <p>How can I find out (in my compute method) what value foo1 has? I think this is not really a difficult question, but I cannot figure out what I'm missing here :/ Would be cool if you could give me a hand :)</p>
  
  <p>With best regards</p>