Re: [BangPypers] Handling bit sized fields in network headers

2012-05-07 Thread Vishal
On Mon, May 7, 2012 at 1:34 PM, Balachandran Sivakumar wrote: > Hi, > > On Mon, May 7, 2012 at 1:02 PM, Vishal wrote: > > One more thing...once you read the incoming bytes as strings, you'll have > > to convert them to numbers (using struct.unpack or array.tolist() or > > something else) before

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-07 Thread Balachandran Sivakumar
Hi, On Mon, May 7, 2012 at 1:02 PM, Vishal wrote: > One more thing...once you read the incoming bytes as strings, you'll have > to convert them to numbers (using struct.unpack or array.tolist() or > something else) before using the code fragments !! > Yeah, got that part already :) Th

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-07 Thread Vishal
On Mon, May 7, 2012 at 12:31 PM, Balachandran Sivakumar < benignb...@gmail.com> wrote: > Hi, > > On Mon, May 7, 2012 at 12:21 PM, Vishal wrote: > > Hi, > > > > is this some standard protocol, if yes, then use a tool like scapy. If > this > > is non-standard or proprietary packet...I would suggest

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-07 Thread Balachandran Sivakumar
Hi, On Mon, May 7, 2012 at 12:21 PM, Vishal wrote: > Hi, > > is this some standard protocol, if yes, then use a tool like scapy. If this > is non-standard or proprietary packet...I would suggest you to read the > incoming bytes as strings and then use functions like below to extract data

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-07 Thread Balachandran Sivakumar
Hi, On Fri, May 4, 2012 at 5:28 PM, Saager Mhatre wrote: > > Just realized that the PyPi links lead nowhere, so here's the link to some > better resources that I could google up => > http://www.secdev.org/projects/scapy/ > Thanks for the link. Will try it out today. Thanks -- Thank yo

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-06 Thread Vishal
Hi, is this some standard protocol, if yes, then use a tool like scapy. If this is non-standard or proprietary packet...I would suggest you to read the incoming bytes as strings and then use functions like below to extract data from specific bit fields: def field(num, startBit, endBit, val=None):

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-04 Thread Saager Mhatre
On Fri, May 4, 2012 at 5:09 PM, Saager Mhatre wrote: > On Fri, May 4, 2012 at 3:40 PM, Balachandran Sivakumar < > benignb...@gmail.com> wrote: > >> Hi, >> >> What is the best way to handle bit sized fileds in network >> headers, if the data is binary ? The struct module doesn't support >>

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-04 Thread Saager Mhatre
On Fri, May 4, 2012 at 3:40 PM, Balachandran Sivakumar wrote: > Hi, > > What is the best way to handle bit sized fileds in network > headers, if the data is binary ? The struct module doesn't support > sizes in bits, and I have scenarios where there are fields of 2 bits, > 3 bits and 5 b

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-04 Thread Balachandran Sivakumar
Hi, On Fri, May 4, 2012 at 3:38 PM, Noufal Ibrahim wrote: > > I have not used this till now but it came up a while ago when I needed > something like this > > https://en.wikipedia.org/wiki/Construct_(python_library) > I guess I am looking at something like this. I will try it out. Thank

Re: [BangPypers] Handling bit sized fields in network headers

2012-05-04 Thread Noufal Ibrahim
Balachandran Sivakumar writes: > Hi, > > What is the best way to handle bit sized fileds in network > headers, if the data is binary ? The struct module doesn't support > sizes in bits, and I have scenarios where there are fields of 2 bits, > 3 bits and 5 bits in size. Thanks I have no

[BangPypers] Handling bit sized fields in network headers

2012-05-04 Thread Balachandran Sivakumar
Hi, What is the best way to handle bit sized fileds in network headers, if the data is binary ? The struct module doesn't support sizes in bits, and I have scenarios where there are fields of 2 bits, 3 bits and 5 bits in size. Thanks -- Thank you Balachandran Sivakumar Arise Awake and