Calling Python function from within function
<p>I am attempting to call two_byte_proc(payload,offset) from within process() but it does not write to the output file out_buf. The output from offset or payload may contain None so those iterations should be skipped and restart the process function with the next packet.</p>

<pre><code>def process():
    pkts = sniff(offline="infile.pcap",filter="tcp")
    out_buf = open("outfile.bin","wb")

    for pkt in pkts:
        offset = hexdump(str(pkt.payload)[:2])
        payload = hexdump(pkt.payload)

        if offset or payload is None:
            pass
        else:
            out_buf.write(two_byte_proc(payload,offset))

process()
</code></pre>
