Hi &#39;Learning Python&#39;:<div><br></div><div>It&#39;d be much better you appeared to have a usual name :-) ... people like responding to human beings with names.</div><div><br></div><div>You would need 2 things:--</div>
<div><br></div><div>1) way to sniff packets off the network. one (common) way to do it is to use LibPCAP (Wireshark, Ethereal, Tcpdump... all of those FOSS sniffers use it). LibPCAP has what looks like a fairly robust Pythonic API exists).</div>
<div><a href="http://www.darknet.org.uk/2007/12/pcapy-python-interface-to-libpcap/">http://www.darknet.org.uk/2007/12/pcapy-python-interface-to-libpcap/</a></div><div><a href="http://pylibpcap.sourceforge.net/">http://pylibpcap.sourceforge.net/</a></div>
<div><br></div><div>2) ASN.1 codec. Here you have 2 choices (and I guess hard ones) --</div><div>  a) Use Python ASN.1 codec APIs</div><div>  b) Use C/C++ (native) ASN.1 codec&#39;s with Python wrapper.</div><div><br></div>
<div>I don&#39;t know of very robust open-source ASN.1 codecs (either implemented in C/C++ or Python) that are actively developed, so any problem you face, you are completely on your own. They generally work, but with a limited scope of ASN.1 specs. There are ones which work fine for PER, there are others which work fine for BER, and few which work only for DER/CER. One Python option is:-</div>
<div><a href="http://pyasn1.sourceforge.net/">http://pyasn1.sourceforge.net/</a></div><div><br></div><div>HTH<br><br><div class="gmail_quote">On Mon, Mar 9, 2009 at 3:50 PM, Radhakrishna Rao <span dir="ltr">&lt;<a href="mailto:radrao@gmail.com">radrao@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">i dont know about ASN.1 but there is a very good network tool<br>
available in python called scapy. you can check it out at<br>
<a href="http://www.secdev.org/projects/scapy/" target="_blank">http://www.secdev.org/projects/scapy/</a><br>
<br>
On Mon, Mar 9, 2009 at 2:08 PM, learningpython &lt;<a href="mailto:learningpython@aol.com">learningpython@aol.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hello<br>
&gt; I am very new to Python and looking forward to implement in Python the ASN.1<br>
&gt; protocol sniffer.<br>
&gt; I need two helps here.<br>
&gt; 1. Functions to extract the bytes and bits from received from network in a<br>
&gt; serial input and performing decoding based on the input.<br>
&gt; 2. How to define the structure, like ASN.1 where further messages are based<br>
&gt; on the No which is processed dynamically ex length of messages definer<br>
&gt; further Calling IDs, etc.<br>
&gt;<br>
&gt; Can someone help me..<br>
&gt;<br>
&gt; learning python<br></blockquote></div><br clear="all"><br>-- <br>regards,<br>Banibrata<br><a href="http://www.linkedin.com/in/bdutta">http://www.linkedin.com/in/bdutta</a><br>
</div>