<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Code a network Packet Sniffer in Python for Linux	</title>
	<atom:link href="https://www.binarytides.com/python-packet-sniffer-code-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/python-packet-sniffer-code-linux/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Sat, 30 Oct 2021 12:57:32 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: annnn		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-326646</link>

		<dc:creator><![CDATA[annnn]]></dc:creator>
		<pubDate>Sat, 30 Oct 2021 12:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-326646</guid>

					<description><![CDATA[i am trying to insert this code in a module and pushing the data collected from this data to multiprocessing.queue struct and using another process to do some analysis for the same, but as soon as we start getting data from network interface , i am not able to switch to the second process to do packet anaysis, any pointers on how to resolve this]]></description>
			<content:encoded><![CDATA[<p>i am trying to insert this code in a module and pushing the data collected from this data to multiprocessing.queue struct and using another process to do some analysis for the same, but as soon as we start getting data from network interface , i am not able to switch to the second process to do packet anaysis, any pointers on how to resolve this</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: brijesh.v		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-326645</link>

		<dc:creator><![CDATA[brijesh.v]]></dc:creator>
		<pubDate>Sat, 30 Oct 2021 12:54:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-326645</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-157964&quot;&gt;Srini&lt;/a&gt;.

this is written for ipv4,no check done in l2 header for l3 type and assuming the header is 20 bytes]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-157964">Srini</a>.</p>
<p>this is written for ipv4,no check done in l2 header for l3 type and assuming the header is 20 bytes</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Meltus		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-197552</link>

		<dc:creator><![CDATA[Meltus]]></dc:creator>
		<pubDate>Tue, 21 May 2019 23:29:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-197552</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-136506&quot;&gt;Karim&lt;/a&gt;.

The unpack() function makes sure iph[0] got the first byte of the packet. Looking back in the diagram, you could see that the first byte (8 bit) consists of the first 4 bit which is the version of the ip protocol, and the latter 4 bit which is the internet header length.

By &#062;&#062; or right-shifting the value by 4, it means that you push all the bits in the variable to the right by 4, in order to get the first 4 bit, which is the version section.
Also, if you AND or &#038; the value by 0xF which in binary means 00001111, you get the last 4 bit, which is the internet header length.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-136506">Karim</a>.</p>
<p>The unpack() function makes sure iph[0] got the first byte of the packet. Looking back in the diagram, you could see that the first byte (8 bit) consists of the first 4 bit which is the version of the ip protocol, and the latter 4 bit which is the internet header length.</p>
<p>By &gt;&gt; or right-shifting the value by 4, it means that you push all the bits in the variable to the right by 4, in order to get the first 4 bit, which is the version section.<br />
Also, if you AND or &amp; the value by 0xF which in binary means 00001111, you get the last 4 bit, which is the internet header length.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Anonymoys		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-169221</link>

		<dc:creator><![CDATA[Anonymoys]]></dc:creator>
		<pubDate>Thu, 25 Oct 2018 13:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-169221</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-156225&quot;&gt;Arnie&lt;/a&gt;.

you are using 
etc.recv(65565)

use recvfrom

etc.recvfrom(65565)


cheers!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-156225">Arnie</a>.</p>
<p>you are using<br />
etc.recv(65565)</p>
<p>use recvfrom</p>
<p>etc.recvfrom(65565)</p>
<p>cheers!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Srini		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-157964</link>

		<dc:creator><![CDATA[Srini]]></dc:creator>
		<pubDate>Mon, 07 May 2018 05:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-157964</guid>

					<description><![CDATA[Hi,

Thanks for the detailed explanation. 

Will this script able to capture only ipv4 packets or it will sniff both ipv4 and ipv6?

Thanks in advance]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for the detailed explanation. </p>
<p>Will this script able to capture only ipv4 packets or it will sniff both ipv4 and ipv6?</p>
<p>Thanks in advance</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Arnie		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-156225</link>

		<dc:creator><![CDATA[Arnie]]></dc:creator>
		<pubDate>Tue, 13 Mar 2018 00:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-156225</guid>

					<description><![CDATA[Payload I am getting as below: How to unpack the payload ? 

Data : E �4�@ ��i��i���H�9�&#039;/w���Y�    
�%�J��X���\�?��W������&#039;=L�$�@u�{�=�]ȇa��&quot;�2E��Ŝ��XM��C��pe
��ף�JJ�f�	q�p�7XQk^�/��J7�.¥�l
HG��I$x�5:�{�h���)�L�_&#039;Z�w�q�����v���&#038;�Ñ�\��-���Ɠ��i��-&#124;&quot;k���_0�	�bS��4=/h�е�������h�F!5��C)���V�\̘Ã�\^7�Үۥ&#038;k���W�-p�%�
���]E��W8��hL&#062;�	���쪻Nz�nPBg8!Mj��k4]]></description>
			<content:encoded><![CDATA[<p>Payload I am getting as below: How to unpack the payload ? </p>
<p>Data : E �4�@ ��i��i���H�9�&#8217;/w���Y�<br />
�%�J��X���\�?��W������&#8217;=L�$�@u�{�=�]ȇa��&#8221;�2E��Ŝ��XM��C��pe<br />
��ף�JJ�f�	q�p�7XQk^�/��J7�.¥�l<br />
HG��I$x�5:�{�h���)�L�_&#8217;Z�w�q�����v���&amp;�Ñ�\��-���Ɠ��i��-|&#8221;k���_0�	�bS��4=/h�е�������h�F!5��C)���V�\̘Ã�\^7�Үۥ&amp;k���W�-p�%�<br />
���]E��W8��hL&gt;�	���쪻Nz�nPBg8!Mj��k4</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Larry		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-151004</link>

		<dc:creator><![CDATA[Larry]]></dc:creator>
		<pubDate>Wed, 10 Jan 2018 19:16:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-151004</guid>

					<description><![CDATA[Should s.recvfrom only ever return a single packet?

I’m creating a raw socket using socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0003)).  I’m reading the socket with s.recvfrom(65536) but since this should be layer 2, I don’t ever expect more than 9k read (max jumbo frame) right?  Is it possible I’m getting two packets in one request?  Should this always return 1 packet only, and if so how can it ever be larger than a 9k jumbo frame?  MTU on the interface is set to 9001]]></description>
			<content:encoded><![CDATA[<p>Should s.recvfrom only ever return a single packet?</p>
<p>I’m creating a raw socket using socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0003)).  I’m reading the socket with s.recvfrom(65536) but since this should be layer 2, I don’t ever expect more than 9k read (max jumbo frame) right?  Is it possible I’m getting two packets in one request?  Should this always return 1 packet only, and if so how can it ever be larger than a 9k jumbo frame?  MTU on the interface is set to 9001</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Karim		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-136506</link>

		<dc:creator><![CDATA[Karim]]></dc:creator>
		<pubDate>Sat, 21 Oct 2017 22:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-136506</guid>

					<description><![CDATA[Hi sir ... I’m a beginner on python ... I can&#039;t understand this part!!
version_ihl = iph[0]
  version = version_ihl &#062;&#062; 4
  ihl = version_ihl &#038; 0xF]]></description>
			<content:encoded><![CDATA[<p>Hi sir &#8230; I’m a beginner on python &#8230; I can&#8217;t understand this part!!<br />
version_ihl = iph[0]<br />
  version = version_ihl &gt;&gt; 4<br />
  ihl = version_ihl &amp; 0xF</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Larry		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-131609</link>

		<dc:creator><![CDATA[Larry]]></dc:creator>
		<pubDate>Thu, 21 Sep 2017 19:08:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-131609</guid>

					<description><![CDATA[Is there a way I can sniff a specific interface and/or port #?]]></description>
			<content:encoded><![CDATA[<p>Is there a way I can sniff a specific interface and/or port #?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: abolfazl		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-129555</link>

		<dc:creator><![CDATA[abolfazl]]></dc:creator>
		<pubDate>Thu, 07 Sep 2017 08:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-129555</guid>

					<description><![CDATA[hello mr 

thank you for education 

may you record a video for struct modules and you use from example for more our know]]></description>
			<content:encoded><![CDATA[<p>hello mr </p>
<p>thank you for education </p>
<p>may you record a video for struct modules and you use from example for more our know</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Eugene		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-123596</link>

		<dc:creator><![CDATA[Eugene]]></dc:creator>
		<pubDate>Wed, 12 Jul 2017 06:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-123596</guid>

					<description><![CDATA[Thanks, man!]]></description>
			<content:encoded><![CDATA[<p>Thanks, man!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bonio		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-116404</link>

		<dc:creator><![CDATA[Bonio]]></dc:creator>
		<pubDate>Sun, 30 Apr 2017 15:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-116404</guid>

					<description><![CDATA[I want to Trace only outgoing packets and I have no idea how to sort them out. I want to save them to text file as well, &quot;on the fly&quot; or after I break compiling. Can anyone help?]]></description>
			<content:encoded><![CDATA[<p>I want to Trace only outgoing packets and I have no idea how to sort them out. I want to save them to text file as well, &#8220;on the fly&#8221; or after I break compiling. Can anyone help?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: dega		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-110677</link>

		<dc:creator><![CDATA[dega]]></dc:creator>
		<pubDate>Thu, 16 Mar 2017 17:52:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-110677</guid>

					<description><![CDATA[Thanks for your code SilverMoon. 
I have a fix to propose:
In the second example (&#039;Sniff all data with ethernet header&#039;):
- The Ethernet type is unpacked in line 32. Since it&#039;s BigEndian in the packet, unpack does the appropriate job.
- Line 33 is superfluous.
- In lines 36 and 37, the constant should be 0x800 (https://en.wikipedia.org/wiki/EtherType)]]></description>
			<content:encoded><![CDATA[<p>Thanks for your code SilverMoon.<br />
I have a fix to propose:<br />
In the second example (&#8216;Sniff all data with ethernet header&#8217;):<br />
&#8211; The Ethernet type is unpacked in line 32. Since it&#8217;s BigEndian in the packet, unpack does the appropriate job.<br />
&#8211; Line 33 is superfluous.<br />
&#8211; In lines 36 and 37, the constant should be 0x800 (<a href="https://en.wikipedia.org/wiki/EtherType" rel="nofollow ugc">https://en.wikipedia.org/wiki/EtherType</a>)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Suraj singh Bisht		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-105864</link>

		<dc:creator><![CDATA[Suraj singh Bisht]]></dc:creator>
		<pubDate>Wed, 15 Feb 2017 10:43:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-105864</guid>

					<description><![CDATA[For Latest Example Check This Link http://bitforestinfo.blogspot.com/2017/01/how-to-write-simple-packet-sniffer.html]]></description>
			<content:encoded><![CDATA[<p>For Latest Example Check This Link <a href="http://bitforestinfo.blogspot.com/2017/01/how-to-write-simple-packet-sniffer.html" rel="nofollow ugc">http://bitforestinfo.blogspot.com/2017/01/how-to-write-simple-packet-sniffer.html</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: flyq		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-101245</link>

		<dc:creator><![CDATA[flyq]]></dc:creator>
		<pubDate>Tue, 27 Dec 2016 02:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-101245</guid>

					<description><![CDATA[nice, thank you]]></description>
			<content:encoded><![CDATA[<p>nice, thank you</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: momo		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-94614</link>

		<dc:creator><![CDATA[momo]]></dc:creator>
		<pubDate>Sat, 24 Sep 2016 03:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-94614</guid>

					<description><![CDATA[Can this code sniff SIP message ?
I see it can sniff NBNS packet ( format like SIP msg different only payload )
but can&#039;t sniff SIP

thx for your advie
sorry for my poor english]]></description>
			<content:encoded><![CDATA[<p>Can this code sniff SIP message ?<br />
I see it can sniff NBNS packet ( format like SIP msg different only payload )<br />
but can&#8217;t sniff SIP</p>
<p>thx for your advie<br />
sorry for my poor english</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: momo		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-94560</link>

		<dc:creator><![CDATA[momo]]></dc:creator>
		<pubDate>Fri, 23 Sep 2016 10:07:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-94560</guid>

					<description><![CDATA[I want to sniff SIP. I already check in wireshark, sip is use udp only ( and port 5060 only ).
But Program never sniff SIP. 

Sorry for my poor english
Thx for your advice]]></description>
			<content:encoded><![CDATA[<p>I want to sniff SIP. I already check in wireshark, sip is use udp only ( and port 5060 only ).<br />
But Program never sniff SIP. </p>
<p>Sorry for my poor english<br />
Thx for your advice</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: bread		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-87719</link>

		<dc:creator><![CDATA[bread]]></dc:creator>
		<pubDate>Fri, 08 Jul 2016 10:35:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-87719</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-71163&quot;&gt;ayiis&lt;/a&gt;.

Thank you SilverMoon for your work!
And thank you, ayiis!

I had a problem with empty TCP packets. This program said the TCP data size would be 6, while it was 0.
But I can&#039;t find the problem, since
data_size = len(packet) - eth_length + iph_length + tcph_length * 4
should be equal to
data_size = iph[2] - iph_length - tcph_length * 4]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-71163">ayiis</a>.</p>
<p>Thank you SilverMoon for your work!<br />
And thank you, ayiis!</p>
<p>I had a problem with empty TCP packets. This program said the TCP data size would be 6, while it was 0.<br />
But I can&#8217;t find the problem, since<br />
data_size = len(packet) &#8211; eth_length + iph_length + tcph_length * 4<br />
should be equal to<br />
data_size = iph[2] &#8211; iph_length &#8211; tcph_length * 4</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: MannyH		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-86559</link>

		<dc:creator><![CDATA[MannyH]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 00:39:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-86559</guid>

					<description><![CDATA[Hi - Awesome post - love it! 

Any recommendations on how I can mod it for parsing pcaps?  I&#039;d like to avoid using DPKT or PyShark! 

Thxs!!]]></description>
			<content:encoded><![CDATA[<p>Hi &#8211; Awesome post &#8211; love it! </p>
<p>Any recommendations on how I can mod it for parsing pcaps?  I&#8217;d like to avoid using DPKT or PyShark! </p>
<p>Thxs!!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ankur		</title>
		<link>https://www.binarytides.com/python-packet-sniffer-code-linux/comment-page-1/#comment-74437</link>

		<dc:creator><![CDATA[ankur]]></dc:creator>
		<pubDate>Tue, 19 Apr 2016 05:28:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=1018#comment-74437</guid>

					<description><![CDATA[awesome....just awesome]]></description>
			<content:encoded><![CDATA[<p>awesome&#8230;.just awesome</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
