﻿{"id":88,"date":"2016-09-15T09:51:24","date_gmt":"2016-09-15T06:51:24","guid":{"rendered":"http:\/\/fewit.ru\/?p=88"},"modified":"2016-09-15T09:52:59","modified_gmt":"2016-09-15T06:52:59","slug":"python-scapy-%d0%b3%d0%b5%d0%bd%d0%b5%d1%80%d0%b0%d1%82%d0%be%d1%80-mac-%d0%b0%d0%b4%d1%80%d0%b5%d1%81%d0%be%d0%b2","status":"publish","type":"post","link":"https:\/\/fewit.ru\/?p=88","title":{"rendered":"Python. Scapy. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 mac \u0430\u0434\u0440\u0435\u0441\u043e\u0432."},"content":{"rendered":"<p>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043b\u0435\u0437\u0435\u0442 \u043c\u0430\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0430.<br \/>\n\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 scapy.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre>\r\nsudo apt-get install python-scapy python-pyx python-gnuplot texlive\r\n<\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 python, \u043d\u0435 \u043d\u0438\u0436\u0435 \u0447\u0435\u043c 2.5<\/p>\n<p>\u0421\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0430\u043a\u043e\u0432:<\/p>\n<pre>\r\nimport random, time, sys\r\nfrom scapy.all import *\r\n\r\nfor n in xrange(16256) :\r\n oct1 = 0\r\n oct2 = 0\r\n oct3 = 0\r\n if ((n\/\/256 >= 1) and (n\/\/256 < 256)) :\r\n  oct1 = n\/\/256\r\n  srcMAC= \"22:11:19:12:\"+ str(hex(oct1)[2:]) +\":\"+ str(hex(n%256)[2:])\r\n  dstMAC = \"\u041c\u0410\u0421_\u0421\u0412\u0418\u0427\u0410\"\r\n  print srcMAC + \" \" + str(n)\r\n  pkt = Ether(src=srcMAC, dst=dstMAC)\/IP(src=\"\u0412\u0410\u0428_IP\",dst=\"IP_\u0421\u0412\u0418\u0427\u0410\")\/Padding(load=\"X\"*18)\r\n  sendp(pkt, iface=\"\u0421\u0415\u0422\u0415\u0412\u0410\u042f_\u041a\u0410\u0420\u0422\u0410\", verbose=0)\r\n<\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0443\u0442\u043e\u043d\u0430:<\/p>\n<pre>\r\nsudo \/usr\/bin\/python mac_gen2.py\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043b\u0435\u0437\u0435\u0442 \u043c\u0430\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 scapy. \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,13,12,7],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-linux","category-network","category-python","category-scripts"],"_links":{"self":[{"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fewit.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":2,"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":90,"href":"https:\/\/fewit.ru\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions\/90"}],"wp:attachment":[{"href":"https:\/\/fewit.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fewit.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fewit.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}