{"id":140,"date":"2008-10-17T11:34:42","date_gmt":"2008-10-17T08:34:42","guid":{"rendered":"http:\/\/brownian.org.ua\/?p=140"},"modified":"2011-07-01T11:32:34","modified_gmt":"2011-07-01T08:32:34","slug":"lang_ukscapy-dlia-polehshennia-zhyttia-lang_uklang_enusing-scapy-for-fun-lang_en","status":"publish","type":"post","link":"https:\/\/brownian.org.ua\/?p=140","title":{"rendered":"Scapy \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0433\u0448\u0435\u043d\u043d\u044f \u0436\u0438\u0442\u0442\u044f :-)"},"content":{"rendered":"<p>\u0422\u0430\u043a\u0430 \u0456\u0441\u0442\u043e\u0440\u0456\u044f.<\/p>\n<p>\u0428\u0443\u043a\u0430\u0432 \u044f\u043a\u043e\u0441\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 OSPF Hello \u043f\u0430\u043a\u0435\u0442\u0456\u0432 \u0434\u043b\u044f \u0431\u043e\u043c\u0431\u0430\u0440\u0434\u0443\u0432\u0430\u043d\u043d\u044f &#171;\u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u043a\u0435\u0442\u0430&#187;. \u0422\u0440\u043e\u0445\u0438 \u043f\u043e\u043c\u0443\u0447\u0438\u0432\u0441\u044f \u0456\u0437 <strong>packEth<\/strong> (\u044f \u043b\u043e\u0432\u0438\u0432\/\u043b\u0456\u043f\u0438\u0432\/\u043f\u0435\u0440\u0435\u0432\u0456\u0440\u044f\u0432 \u043f\u0430\u043a\u0435\u0442\u0438, \u0432\u0456\u043d \u043e\u0433\u0438\u043d\u0430\u0432\u0441\u044f \u0456 \u0437\u0430\u0432\u0438\u0441\u0430\u0432) \u0456 \u0437\u0430\u043a\u0438\u043d\u0443\u0432 \u0446\u044e \u0456\u0434\u0435\u044e&#160;&#8212; \u0432\u0437\u044f\u0432 \u0434\u0432\u0456 \u0446\u0438\u0441\u043a\u0438 \u043d\u0430 \u0434\u0432\u043e\u0445 \u043a\u0456\u043d\u0446\u044f\u0445 \u043a\u0430\u043d\u0430\u043b\u0443 (\u043f\u0430\u043a\u0435\u0442\u0456\u0432 \u043c\u0430\u043b\u043e, \u0430\u043b\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0456 \u0447\u0435\u0441\u043d\u0456, \u043c\u0435\u043d\u0456 \u0446\u044c\u043e\u0433\u043e \u0431\u0443\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043d\u044c\u043e).<\/p>\n<p>\u0412\u0436\u0435 \u043a\u0438\u043d\u0443\u0432\u0448\u0438 \u0446\u044e \u0456\u0434\u0435\u044e, \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0432 \u0456 \u043d\u0430\u0434\u0438\u0431\u0430\u0432 <a href=\"http:\/\/www.secdev.org\/projects\/scapy\/\"><strong>Scapy<\/strong><\/a>.<\/p>\n<p>\u0426\u0435 \u0434\u0438\u0432\u043e\u0432\u0438\u0436\u043d\u0438\u0439 \u0456\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 :-)<\/p>\n<p>\u041f\u043e\u0434\u0438\u0432\u0456\u0442\u044c\u0441\u044f \u043a\u0456\u043b\u044c\u043a\u0430 \u0441\u0442\u0430\u0442\u0435\u0439:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.secdev.org\/projects\/scapy\/demo.html\">Quick demo : an interactive session<\/a><\/li>\n<li><a href=\"http:\/\/trac.secdev.org\/scapy\/wiki\/IdentifyingRogueDHCPServers\">Identifying rogue DHCP servers on your LAN<\/a><\/li>\n<li><a href=\"http:\/\/www.devx.com\/security\/Article\/34741\/1954?pf=true\">Secure Your Wireless Networks with Scapy Packet Manipulation<\/a><a><\/a><\/li>\n<\/ul>\n<p>\u041e\u0442\u0436\u0435, \u0434\u0432\u0456\u0439\u043a\u043e \u0440\u0435\u0446\u0435\u043f\u0442\u0456\u0432. <a href=\"\/?p=140#ospfhello\"><strong>\u0413\u0435\u043d\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f OSPF Hello \u043f\u0430\u043a\u0435\u0442\u0456\u0432<\/strong><\/a> \u0442\u0430 <a href=\"\/?p=140#pongresp\"><strong>\u0413\u0440\u0430\u0444\u0456\u043a \u0447\u0430\u0441\u0443 \u0432\u0456\u0434\u0433\u0443\u043a\u0456\u0432 \u043d\u0430 ping<\/strong><\/a>.<\/p>\n<p><!--more \u00bb \u0427\u0438\u0442\u0430\u0442\u0438 \u0434\u0430\u043b\u0456&#160;&#8212; \u0441\u043a\u0440\u0438\u043f\u0442 \u0456 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u2026 \u00bb--><\/p>\n<h2><a name=\"ospfhello\"><\/a>\u0413\u0435\u043d\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f OSPF Hello \u043f\u0430\u043a\u0435\u0442\u0456\u0432<\/h2>\n<p>\u041f\u043e-\u043f\u0435\u0440\u0448\u0435, \u0442\u0440\u0435\u0431\u0430 \u0432\u0437\u044f\u0442\u0438 <a href=\"http:\/\/trac.secdev.org\/scapy\/wiki\/OSPF\">\u0440\u043e\u0437\u0448\u0438\u0440\u0435\u043d\u043d\u044f <strong>OSPF<\/strong> \u0434\u043b\u044f Scapy<\/a>, \u0430 \u0434\u0430\u043b\u0456 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u041c\u0438 \u0431\u0443\u0434\u0435\u043c\u043e &#171;\u043b\u0456\u043f\u0438\u0442\u0438&#187; \u043f\u0430\u043a\u0435\u0442 &#171;\u0437 \u043d\u0443\u043b\u044f&#187;, \u0445\u043e\u0447\u0430 \u043c\u043e\u0436\u043d\u0430 \u0431\u0443\u043b\u043e \u0431 \u043e\u0431\u0456\u0439\u0442\u0438\u0441\u044f \u043b\u0438\u0448\u0435 \u0440\u0456\u0432\u043d\u044f\u043c\u0438 IP \u0442\u0430 OSPF. \u041a\u0440\u0456\u043c \u0442\u043e\u0433\u043e, \u043c\u0438 \u0431\u0443\u0434\u0435\u043c\u043e \u0431\u0443\u0434\u0443\u0432\u0430\u0442\u0438 \u0440\u0456\u0432\u0435\u043d\u044c \u0437\u0430 \u0440\u0456\u0432\u043d\u0435\u043c, \u0445\u043e\u0447\u0430 \u0432\u0441\u0435 \u043c\u043e\u0436\u043d\u0430 \u0431\u0443\u043b\u043e \u0431 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u0438 \u043b\u0438\u0448\u0435 \u043e\u0434\u043d\u0438\u043c \u0440\u044f\u0434\u043a\u043e\u043c (\u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0456 \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u043d\u043d\u044f \u043f\u0430\u043a\u0435\u0442\u0430).<\/p>\n<p>\u0421\u0442\u0432\u043e\u0440\u044e\u0454\u043c\u043e \u043f\u0430\u043a\u0435\u0442 <strong>Ethernet<\/strong>:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet = Ether(src='00:06:28:b9:85:31',dst='01:00:5e:00:00:05')\r\n\r\n<span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet.show()\r\n###[ <span style=\"font-weight: bold; color: red;\">Ethernet<\/span> ]###\r\n  dst= 01:00:5e:00:00:05\r\n  src= 00:06:28:b9:85:31\r\n  type= 0x0<\/pre>\n<p>\u0411\u0430\u0447\u0438\u043c\u043e, \u0449\u043e \u0443 \u043f\u043e\u043b\u0456 &#171;\u0442\u0438\u043f&#187;&#160;&#8212; \u043d\u0443\u043b\u044c, \u043d\u0456\u044f\u043a\u0438\u0439 \u0442\u0438\u043f. \u041c\u0438 \u0441\u0442\u0432\u043e\u0440\u0438\u043b\u0438 \u043b\u0438\u0448\u0435 &#171;\u0448\u0430\u0431\u043b\u043e\u043d&#187; \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 Ethernet.<\/p>\n<p>\u041a\u043e\u0440\u0438\u0441\u0442\u0443\u044e\u0447\u0438\u0441\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c &#8222;<strong><code>\/<\/code><\/strong>&#8216;, &#171;\u043d\u0430\u0440\u043e\u0449\u0443\u0454\u043c\u043e&#187; \u043c\u0456\u0442\u043a\u0443 <strong>vlan<\/strong>:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet = packet\/Dot1Q(vlan=33)\r\n\r\n<span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet.show()\r\n###[ <span style=\"font-weight: bold; color: red;\">Ethernet<\/span> ]###\r\n  dst= 01:00:5e:00:00:05\r\n  src= 00:06:28:b9:85:31\r\n  type= 0x8100\r\n###[ <span style=\"font-weight: bold; color: red;\">802.1Q<\/span> ]###\r\n     prio= 0\r\n     id= 0\r\n     vlan= 33\r\n     type= 0x0<\/pre>\n<p>\u0411\u0430\u0447\u0438\u043c\u043e?&#160;&#8212; \u043f\u043e\u043c\u0456\u043d\u044f\u0432\u0441\u044f \u0456 \u0442\u0438\u043f \u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 Ethernet.<\/p>\n<p>\u0414\u0430\u043b\u0456 \u0436\u0443\u0436\u043c\u043e\u043c \u0434\u043e\u0434\u0430\u0454\u043c\u043e IP \u0456 \u0434\u0430\u043b\u0456 (\u0442\u0430\u043a, \u0432\u0441\u0435 \u0446\u0435 \u043c\u043e\u0436\u043d\u0430 \u043e\u0434\u043d\u0438\u043c \u0440\u044f\u0434\u043a\u043e\u043c&#160;&#8212; <code>Ether()\/Dot1Q()\/IP()\/OSPF_Hdr()\/...<\/code>):<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet = packet\/IP(src='172.17.2.2',dst='224.0.0.5')\r\n<span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet = packet\/OSPF_Hdr(src='172.17.2.2')\r\n<span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet = packet\/OSPF_Hello(router='172.17.2.2',backup='172.17.2.1',neighbor='172.17.2.1')<\/pre>\n<p>\u041d\u0443, \u0442\u0435\u043f\u0435\u0440 \u043f\u043e\u0434\u0438\u0432\u0438\u043c\u043e\u0441\u044f \u043d\u0430 \u043f\u0430\u043a\u0435\u0442:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> packet.show()\r\n###[ <span style=\"font-weight: bold; color: red;\">Ethernet<\/span> ]###\r\n  dst= 01:00:5e:00:00:05\r\n  src= 00:06:28:b9:85:31\r\n  type= 0x8100\r\n###[ <span style=\"font-weight: bold; color: red;\">802.1Q<\/span> ]###\r\n     prio= 0\r\n     id= 0\r\n     vlan= 33\r\n     type= 0x800\r\n###[ <span style=\"font-weight: bold; color: red;\">IP<\/span> ]###\r\n        version= 4\r\n        ihl= 0\r\n        tos= 0x0\r\n        len= 0\r\n        id= 1\r\n        flags=\r\n        frag= 0\r\n        ttl= 64\r\n        proto= ospf\r\n        chksum= 0x0\r\n        src= 172.17.2.2\r\n        dst= 224.0.0.5\r\n        options= ''\r\n###[ <span style=\"font-weight: bold; color: red;\">OSPF Header<\/span> ]###\r\n           version= 2\r\n           type= Hello\r\n           len= 0\r\n           src= 172.17.2.2\r\n           area= 0.0.0.0\r\n           chksum= 0x0\r\n           authtype= Null\r\n           authdata= 0x0\r\n           reserved= 0x0\r\n           keyid= 1\r\n           authdatalen= 0\r\n           seq= 0x0\r\n###[ <span style=\"font-weight: bold; color: red;\">OSPF Hello<\/span> ]###\r\n              mask= 255.255.255.0\r\n              hellointerval= 10\r\n              options=\r\n              prio= 1\r\n              deadinterval= 40\r\n              router= 172.17.2.2\r\n              backup= 172.17.2.1\r\n              neighbor= 172.17.2.1<\/pre>\n<p>\u042f\u043a \u043d\u0430 \u043c\u0435\u043d\u0435&#160;&#8212; \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0434\u0443\u0440\u0456\u0442\u0438 \u043c\u043e\u0436\u043d\u0430 <img src=\"http:\/\/www.kolobok.us\/smiles\/standart\/yes4.gif\" alt=\"nice smile\" title=\"nice smile \u2014 http:\/\/www.kolobok.us\/smiles\/standart\/yes4.gif\" style=\"vertical-align: middle;\" \/><\/p>\n<p>\u0417\u0430\u043b\u0438\u0448\u0438\u043b\u043e\u0441\u044f \u043b\u0438\u0448\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u0446\u0435\u0439 \u043f\u0430\u043a\u0435\u0442 \u0443 \u043c\u0435\u0440\u0435\u0436\u0443 \u0442\u0430 \u0437\u043b\u043e\u0432\u0438\u0442\u043e \u0439\u043e\u0433\u043e \u0442\u0430\u043c \u044f\u043a\u0438\u0439\u043c\u043e\u0441\u044c \u0430\u043d\u0430\u043b\u0456\u0437\u0430\u0442\u043e\u0440\u043e\u043c&#160;&#8212; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u043a\u0438.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0454\u043c\u043e (\u0443 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u0438\u0439 \u0456\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441):<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> sendp(packet,iface='dlink')\r\n.\r\nSent 1 packets.<\/pre>\n<p>\u0406 \u0432\u0441\u0435. \u041e\u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u043a\u0438&#160;&#8212; <a href=\"\/plain\/scapy\/ospf_hello_by_tshark.txt\" target=\"_blank\">\u0430\u043d\u0430\u043b\u0456\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 \u0430\u043d\u0430\u043b\u0456\u0437\u0430\u0442\u043e\u0440\u043e\u043c <strong>tshark<\/strong><\/a>.<\/p>\n<p>\u0410 \u0449\u043e\u0431 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u0442\u0430\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0442\u0440\u0435\u0431\u0430 \u044f\u043a\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> sendp(packet,iface='dlink',loop=True,inter=0.1)\r\n.......\r\n[etc-etc-etc...]<\/pre>\n<p>\u0410 \u0449\u043e\u0431 \u043d\u0435 \u0431\u0430\u0447\u0438\u0442\u0438 \u0443\u0441\u0456\u0445 \u0446\u0438\u0445 \u0446\u044f\u0442\u043e\u0447\u043e\u043a, \u0434\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0456\u0432 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 <code>verbose=1<\/code>.<\/p>\n<h2><a name=\"pongresp\"><\/a>\u0413\u0440\u0430\u0444\u0456\u043a \u0447\u0430\u0441\u0443 \u0432\u0456\u0434\u0433\u0443\u043a\u0456\u0432 \u043d\u0430 ping<\/h2>\n<p>\u0426\u0435 \u0449\u0435 \u043f\u0440\u043e\u0441\u0442\u0456\u0448\u0435.<\/p>\n<p>\u0421\u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u043f\u0456\u043d\u0433\u0430\u0454\u043c\u043e:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> ans,unans = sr(IP(dst='209.85.139.9')\/ICMP()*5000,inter=1,verbose=1)\r\nBegin emission:\r\nFinished to send 5000 packets.\r\n\r\nReceived 487002 packets, got 5000 answers, remaining 0 packets<\/pre>\n<p><span style=\"font-size:80%\">\u0426\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0454: c\u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u0441\u0442\u0432\u043e\u0440\u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442 ICMP (<code>IP(dst='209.85.139.9')\/ICMP()<\/code>), \u0430 \u0442\u043e\u0447\u043d\u0456\u0448\u0435, \u043e\u0434\u0440\u0430\u0437\u0443 \u0441\u0442\u0432\u043e\u0440\u0438\u043b\u0438 5000 \u0442\u0430\u043a\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u0456\u0432 (<code>*5000<\/code>), \u0456 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 (\u0444\u0443\u043d\u043a\u0446\u0456\u044f <code>sr<\/code>&#160;&#8212; send\/receive) \u043d\u0435 \u0434\u0443\u0436\u0435 \u0431\u0430\u043b\u0430\u043a\u0443\u0447\u0438\u0439 (<code>verbose=1<\/code>) \u043f\u0456\u043d\u0433 \u043d\u0430 \u043e\u0434\u0438\u043d \u0456\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u0456\u0432 Google (<code>dst='209.85.139.9'<\/code>) \u0437 \u0456\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c 1 \u0441\u0435\u043a\u0443\u043d\u0434\u0430 (<code>inter=1<\/code>).<\/span><\/p>\n<p>\u041e\u0442\u0436\u0435, \u043c\u0438 \u043c\u0430\u0454\u043c\u043e <code><strong>ans<\/strong><\/code>&#160;&#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440 ping\/pong, \u0437 \u0443\u0441\u0456\u043c\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u043c\u043e\u0436\u0435\u043c\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u0438:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> ans[0][0].show()\r\n###[ <span style=\"font-weight: bold; color: red;\">IP<\/span> ]###\r\n  version= 4\r\n  ihl= 0\r\n  tos= 0x0\r\n  len= 0\r\n  id= 1\r\n  flags=\r\n  frag= 0\r\n  ttl= 64\r\n  proto= icmp\r\n  chksum= 0x0\r\n  src= 10.0.10.70\r\n  dst= 209.85.139.9\r\n  options= ''\r\n###[ <span style=\"font-weight: bold; color: red;\">ICMP<\/span> ]###\r\n     type= echo-request\r\n     code= 0\r\n     chksum= 0x0\r\n     id= 0x0\r\n     seq= 0x0\r\n\r\n<span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> ans[0][1].show()\r\n###[ <span style=\"font-weight: bold; color: red;\">IP<\/span> ]###\r\n  version= 4L\r\n  ihl= 5L\r\n  tos= 0x0\r\n  len= 28\r\n  id= 1\r\n  flags=\r\n  frag= 0L\r\n  ttl= 239\r\n  proto= icmp\r\n  chksum= 0x5b3b\r\n  src= 209.85.139.9\r\n  dst= 10.0.10.70\r\n  options= ''\r\n###[ <span style=\"font-weight: bold; color: red;\">ICMP<\/span> ]###\r\n     type= echo-reply\r\n     code= 0\r\n     chksum= 0xffff\r\n     id= 0x0\r\n     seq= 0x0\r\n###[ <span style=\"font-weight: bold; color: red;\">Padding<\/span> ]###\r\n        load= '\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'<\/pre>\n<p>\u0414\u043b\u044f \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0433\u0440\u0430\u0444\u0456\u043a\u0430 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>plot<\/code>&#160;&#8212; \u0456\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e <strong>Gnuplot<\/strong>:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> ans.plot(lambda x:(x[1].time-x[0].sent_time))\r\n&lt;Gnuplot._Gnuplot.Gnuplot instance at 0xb74e146c&gt;<\/pre>\n<p>\u041f\u0440\u0438 \u0446\u044c\u043e\u043c\u0443 \u0432\u0438\u0441\u043a\u0430\u043a\u0443\u0454 \u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u043d\u043e \u0442\u0430\u043a\u0438\u0439 \u0433\u0440\u0430\u0444\u0456\u043a:<\/p>\n<p><a href=\"\/wp-content\/uploads\/2008\/10\/scapy_01.png\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-149\" title=\"scapy_01\" src=\"\/wp-content\/uploads\/2008\/10\/scapy_01-300x237.png\" alt=\"\" width=\"300\" height=\"237\" \/><\/a><\/p>\n<p>\u042f\u043a \u0431\u0430\u0447\u0438\u043c\u043e, \u0433\u0440\u0430\u0444\u0456\u043a \u0442\u0440\u043e\u0445\u0438 \u0441\u0445\u043e\u0434\u0438\u043d\u043a\u0430\u043c\u0438&#160;&#8212; \u0446\u0435 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435, \u0449\u043e \u044f\u043a\u0456\u0441\u044c \u043f\u0430\u043a\u0435\u0442\u0438 \u0437\u0430\u043b\u0438\u0448\u0430\u044e\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0456, \u0430\u043b\u0435 \u0436 \u0432\u0441\u0456 \u043f\u0430\u043a\u0435\u0442\u0438 \u043e\u0434\u043d\u0430\u043a\u043e\u0432\u0456, \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u044c \u043d\u0430 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u043d\u0456\u0447\u0438\u043c \u043d\u0435 \u0432\u0456\u0434\u0440\u0456\u0437\u043d\u044f\u0454\u0442\u044c\u0441\u044f \u0432\u0456\u0434 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0456 \u043d\u0430 \u043f\u0430\u043a\u0435\u0442, \u0449\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043b\u0438\u0448\u0438\u0432\u0441\u044f \u0431\u0435\u0437 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0456.<\/p>\n<p>\u0422\u043e\u043c\u0443 \u0442\u0440\u0435\u0431\u0430 \u0432\u0441\u0456 \u043f\u0430\u043a\u0435\u0442\u0438 \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0443\u043d\u0456\u043a\u0430\u043b\u044c\u043d\u0438\u043c\u0438, \u0437\u0430\u043c\u0456\u0441\u0442\u044c <code>ICMP()<\/code> \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438:<\/p>\n<pre>ICMP(id=os.getpid(),seq=RandShort())<\/pre>\n<p>\u0414\u043e \u0440\u0435\u0447\u0456, \u044f\u043a\u0449\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u0456 \u0437\u0430\u043d\u0430\u0434\u0442\u043e \u0432\u0435\u043b\u0438\u043a\u0456 \u0432\u0456\u0434\u0433\u0443\u043a\u0438 (\u0432\u0441\u044f\u043a\u0435 \u0432 \u0436\u0438\u0442\u0442\u0456 \u0431\u0443\u0432\u0430\u0454): \u0457\u0445 \u043c\u043e\u0436\u043d\u0430 &#171;\u0432\u0456\u0434\u0441\u0456\u044f\u0442\u0438&#187; \u0442\u0430\u043a\u0438\u043c \u0447\u0438\u043d\u043e\u043c:<\/p>\n<pre><span style=\"font-weight: bold; color: blue;\">&gt;&gt;&gt;<\/span> ans.plot(lambda x:x[1].time-x[0].sent_time,lfilter=lambda x:x[1].time-x[0].sent_time<0.1)\r\n&lt;Gnuplot._Gnuplot.Gnuplot instance at 0xb79d808c&gt;<\/pre>\n<p>\u0422\u043e\u0431\u0442\u043e, \u0432\u0441\u0456 \u0437\u0430\u0442\u0440\u0438\u043c\u043a\u0438, \u0434\u043e\u0432\u0448\u0456 \u0437\u0430 100 \u043c\u0456\u043b\u0456\u0441\u0435\u043a\u0443\u043d\u0434, \u043c\u0430\u043b\u044e\u0432\u0430\u0442\u0438\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443\u0442\u044c.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0430\u043a\u0430 \u0456\u0441\u0442\u043e\u0440\u0456\u044f. \u0428\u0443\u043a\u0430\u0432 \u044f\u043a\u043e\u0441\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 OSPF Hello \u043f\u0430\u043a\u0435\u0442\u0456\u0432 \u0434\u043b\u044f \u0431\u043e\u043c\u0431\u0430\u0440\u0434\u0443\u0432\u0430\u043d\u043d\u044f &#171;\u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u043a\u0435\u0442\u0430&#187;. \u0422\u0440\u043e\u0445\u0438 \u043f\u043e\u043c\u0443\u0447\u0438\u0432\u0441\u044f \u0456\u0437 packEth (\u044f \u043b\u043e\u0432\u0438\u0432\/\u043b\u0456\u043f\u0438\u0432\/\u043f\u0435\u0440\u0435\u0432\u0456\u0440\u044f\u0432 \u043f\u0430\u043a\u0435\u0442\u0438, \u0432\u0456\u043d \u043e\u0433\u0438\u043d\u0430\u0432\u0441\u044f \u0456 \u0437\u0430\u0432\u0438\u0441\u0430\u0432) \u0456 \u0437\u0430\u043a\u0438\u043d\u0443\u0432 \u0446\u044e \u0456\u0434\u0435\u044e&#160;&#8212; \u0432\u0437\u044f\u0432 \u0434\u0432\u0456 \u0446\u0438\u0441\u043a\u0438 \u043d\u0430 \u0434\u0432\u043e\u0445 \u043a\u0456\u043d\u0446\u044f\u0445 \u043a\u0430\u043d\u0430\u043b\u0443 (\u043f\u0430\u043a\u0435\u0442\u0456\u0432 \u043c\u0430\u043b\u043e, \u0430\u043b\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0456 \u0447\u0435\u0441\u043d\u0456, \u043c\u0435\u043d\u0456 \u0446\u044c\u043e\u0433\u043e \u0431\u0443\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043d\u044c\u043e). \u0412\u0436\u0435 &hellip; <a href=\"https:\/\/brownian.org.ua\/?p=140\" class=\"more-link\"><span>Continue reading<span class=\"screen-reader-text\">Scapy \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0433\u0448\u0435\u043d\u043d\u044f \u0436\u0438\u0442\u0442\u044f :-)<\/span><\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[56,116,57],"_links":{"self":[{"href":"https:\/\/brownian.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/140"}],"collection":[{"href":"https:\/\/brownian.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brownian.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brownian.org.ua\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/brownian.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=140"}],"version-history":[{"count":0,"href":"https:\/\/brownian.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions"}],"wp:attachment":[{"href":"https:\/\/brownian.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brownian.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brownian.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}