{"id":309161,"date":"2020-08-28T15:01:02","date_gmt":"2020-08-28T15:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=309161"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=309161","title":{"rendered":"\u042f\u0434\u0435\u0440\u043d\u044b\u0439 \u0448\u0435\u043b\u043b \u043f\u043e\u0432\u0435\u0440\u0445 ICMP"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s4\/y7\/fd\/s4y7fd90yheip6rwahrpc7htjao.png\"><\/div>\n<p><\/a><\/p>\n<p>  <b>TL;DR<\/b>: \u043f\u0438\u0448\u0443 \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u0430 ICMP \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u0430\u0436\u0435 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u043f\u0430\u043b SSH. \u0414\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/asz\/icmpshell\">github<\/a>.<\/p>\n<p>  <b>\u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e!<\/b> \u041e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0430 C \u0440\u0438\u0441\u043a\u0443\u044e\u0442 \u0440\u0430\u0437\u0440\u044b\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u043e\u0432\u0430\u0432\u044b\u043c\u0438 \u0441\u043b\u0435\u0437\u0430\u043c\u0438! \u042f \u043c\u043e\u0433\u0443 \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043d\u043e \u043b\u044e\u0431\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u0441\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 C \u0438 \u0445\u043e\u0447\u0435\u0442 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Linux.<\/p>\n<p>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043c\u043e\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 <a href=\"https:\/\/habr.com\/post\/515758\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 SoftEther VPN, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u043c\u0438\u043c\u0438\u043a\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u043e\u0431\u044b\u0447\u043d\u044b\u0435\u00bb \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, HTTPS, ICMP \u0438 \u0434\u0430\u0436\u0435 DNS. \u042f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0441 HTTP(S), \u0430 \u0442\u0443\u043d\u043d\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0440\u0445 ICMP \u0438 DNS \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c.<a name=\"habracut\"><\/a><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vq\/p5\/g6\/vqp5g6yjzhdf69n-pcwwesv8ipu.png\" alt=\"image\"><\/p>\n<p>  \u0414\u0430, \u044f \u0432 2020 \u0433\u043e\u0434\u0443 \u0443\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0432 ICMP-\u043f\u0430\u043a\u0435\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0439\u043b\u043e\u0430\u0434. \u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0437\u0434\u043d\u043e, \u0447\u0435\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430! \u0418 \u0440\u0430\u0437 \u0443\u0436 \u0441 \u044d\u0442\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0441\u0442\u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044f \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0447\u0435\u0440\u0435\u0437 SSH, \u0438\u0434\u0435\u044f ICMP-\u0448\u0435\u043b\u043b\u0430 \u043f\u0440\u0438\u0448\u043b\u0430 \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c. \u0410 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0431\u0443\u043b\u043b\u0449\u0438\u0442-\u0431\u0438\u043d\u0433\u043e, \u0440\u0435\u0448\u0438\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u043e\u0434\u0443\u043b\u044f Linux \u043d\u0430 \u044f\u0437\u044b\u043a\u0435, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0438\u043c\u0435\u044e \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u0422\u0430\u043a\u043e\u0439 \u0448\u0435\u043b\u043b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u043d \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u044f\u0434\u0440\u043e \u0438 \u043e\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0432\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432. \u041f\u043e \u0441\u0432\u043e\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0440\u0443\u0442\u043a\u0438\u0442, \u043d\u043e \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0435\u043b\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043d\u0430\u0434\u0435\u0436\u0434\u044b, \u043a\u043e\u0433\u0434\u0430 Load Average \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0439\u0442\u0438 \u043f\u043e SSH \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b <code>echo i &gt; \/proc\/sysrq-trigger<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>  \u0411\u0435\u0440\u0451\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440, \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0441\u043a\u0438\u043b\u043b\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Python \u0438 C, \u0433\u0443\u0433\u043b \u0438 <a href=\"https:\/\/ruvds.com\/ru-rub\/pricing#order\">\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0443<\/a> \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435 \u0436\u0430\u043b\u043a\u043e \u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0434 \u043d\u043e\u0436 \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u043e\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u2014 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 VirtualBox\/KVM\/etc) \u0438 \u043f\u043e\u0433\u043d\u0430\u043b\u0438!<\/p>\n<h2><font color=\"#3AC1EF\">\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/font><\/h2>\n<p>  \u041c\u043d\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0442\u0440\u043e\u043a \u044d\u0434\u0430\u043a \u043d\u0430 80, \u043d\u043e \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u0434\u043e\u0431\u0440\u044b\u0435 \u043b\u044e\u0434\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0437\u0430 \u043c\u0435\u043d\u044f <a href=\"https:\/\/scapy.net\/\">\u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443<\/a>. \u041a\u043e\u0434 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 10 \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code class=\"python\">import sys from scapy.all import sr1, IP, ICMP  if len(sys.argv) &lt; 3:     print('Usage: {} IP &quot;command&quot;'.format(sys.argv[0]))     exit(0)  p = sr1(IP(dst=sys.argv[1])\/ICMP()\/&quot;run:{}&quot;.format(sys.argv[2])) if p:     p.show()<\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438 \u043f\u0435\u0439\u043b\u043e\u0430\u0434. \u041f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043f\u0435\u0439\u043b\u043e\u0430\u0434 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u043e\u043c <code>run:<\/code>, \u043e\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u043e\u043c.<\/p>\n<p>  \u042f\u0434\u0440\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u0440\u0430\u0444\u0442\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0430\u043c scapy. \u0412 Debian \u0435\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>python3-scapy<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\"><code>morq@laptop:~\/icmpshell$ sudo .\/send.py 45.11.26.232 &quot;Hello, world!&quot;<br \/>  Begin emission:<br \/>  .Finished sending 1 packets.<br \/>  *<br \/>  Received 2 packets, got 1 answers, remaining 0 packets<br \/>  ###[ IP ]### <br \/>   version = 4<br \/>   ihl = 5<br \/>   tos = 0x0<br \/>   len = 45<br \/>   id = 17218<br \/>   flags = <br \/>   frag = 0<br \/>   ttl = 58<br \/>   proto = icmp<br \/>   chksum = 0x3403<br \/>   src = 45.11.26.232<br \/>   dst = 192.168.0.240<br \/>   \\options \\<br \/>  ###[ ICMP ]### <br \/>   type = echo-reply<br \/>   code = 0<br \/>   chksum = 0xde03<br \/>   id = 0x0<br \/>   seq = 0x0<br \/>  ###[ Raw ]### <br \/>   load = 'run:Hello, world!<\/code>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0441\u043d\u0438\u0444\u0444\u0435\u0440\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><code>morq@laptop:~\/icmpshell$ sudo tshark -i wlp1s0 -O icmp -f &quot;icmp and host 45.11.26.232&quot;<br \/>  Running as user &quot;root&quot; and group &quot;root&quot;. This could be dangerous.<br \/>  Capturing on 'wlp1s0'<br \/>  Frame 1: 59 bytes on wire (472 bits), 59 bytes captured (472 bits) on interface wlp1s0, id 0<br \/>  Internet Protocol Version 4, Src: 192.168.0.240, Dst: 45.11.26.232<br \/>  Internet Control Message Protocol<br \/>   Type: 8 (Echo (ping) request)<br \/>   Code: 0<br \/>   Checksum: 0xd603 [correct]<br \/>   [Checksum Status: Good]<br \/>   Identifier (BE): 0 (0x0000)<br \/>   Identifier (LE): 0 (0x0000)<br \/>   Sequence number (BE): 0 (0x0000)<br \/>   Sequence number (LE): 0 (0x0000)<br \/>   Data (17 bytes)<\/p>\n<p>  0000 72 75 6e 3a 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 run:Hello, world<br \/>  0010 21 !<br \/>   Data: 72756e3a48656c6c6f2c20776f726c6421<br \/>   [Length: 17]<\/p>\n<p>  Frame 2: 59 bytes on wire (472 bits), 59 bytes captured (472 bits) on interface wlp1s0, id 0<br \/>  Internet Protocol Version 4, Src: 45.11.26.232, Dst: 192.168.0.240<br \/>  Internet Control Message Protocol<br \/>   Type: 0 (Echo (ping) reply)<br \/>   Code: 0<br \/>   Checksum: 0xde03 [correct]<br \/>   [Checksum Status: Good]<br \/>   Identifier (BE): 0 (0x0000)<br \/>   Identifier (LE): 0 (0x0000)<br \/>   Sequence number (BE): 0 (0x0000)<br \/>   Sequence number (LE): 0 (0x0000)<br \/>   [Request frame: 1]<br \/>   [Response time: 19.094 ms]<br \/>   Data (17 bytes)<\/p>\n<p>  0000 72 75 6e 3a 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 run:Hello, world<br \/>  0010 21 !<br \/>   Data: 72756e3a48656c6c6f2c20776f726c6421<br \/>   [Length: 17]<\/p>\n<p>  ^C2 packets captured<br \/>  <\/code>  <\/div>\n<\/p><\/div>\n<p>  \u041f\u0435\u0439\u043b\u043e\u0430\u0434 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u041c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0435 \u0441 Debian \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c <code>make<\/code> \u0438 <code>linux-headers-amd64<\/code>, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u044f\u043d\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0432\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0445\u0443\u043a\u0430<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0438 <code>rmmod<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438.<\/p>\n<pre><code class=\"cpp\">#include &lt;linux\/module.h&gt; #include &lt;linux\/netfilter_ipv4.h&gt;  static struct nf_hook_ops nfho;  static int __init startup(void) {   nfho.hook = icmp_cmd_executor;   nfho.hooknum = NF_INET_PRE_ROUTING;   nfho.pf = PF_INET;   nfho.priority = NF_IP_PRI_FIRST;   nf_register_net_hook(&amp;init_net, &amp;nfho);   return 0; }  static void __exit cleanup(void) {   nf_unregister_net_hook(&amp;init_net, &amp;nfho); }  MODULE_LICENSE(&quot;GPL&quot;); module_init(startup); module_exit(cleanup);<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:<\/p>\n<ol>\n<li>\u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0438 \u0441 \u043d\u0435\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c.<\/li>\n<li>\u0412\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0442\u0444\u0438\u043b\u044c\u0442\u0440, \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0445\u0443\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u044f\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0443\u043a \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0421\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u0443\u043a\u0430: <code>nfho.hook = icmp_cmd_executor;<\/code> \u0434\u043e \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f \u0435\u0449\u0451 \u0434\u043e\u0431\u0435\u0440\u0443\u0441\u044c.<br \/>  \u0417\u0430\u0442\u0435\u043c \u044f \u0437\u0430\u0434\u0430\u043b \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430: <code>NF_INET_PRE_ROUTING<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 \u044f\u0434\u0440\u0435. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>NF_INET_POST_ROUTING<\/code> \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u044f\u0434\u0440\u0430.<br \/>  \u0412\u0435\u0448\u0430\u044e \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0430 IPv4: <code>nfho.pf = PF_INET;<\/code>.<br \/>  \u041d\u0430\u0437\u043d\u0430\u0447\u0430\u044e \u0441\u0432\u043e\u0435\u043c\u0443 \u0445\u0443\u043a\u0443 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0435\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442: <code>nfho.priority = NF_IP_PRI_FIRST;<\/code><br \/>  \u0418 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0441\u043e\u0431\u0441\u0432\u0435\u043d\u043d\u043e \u0445\u0443\u043a: <code>nf_register_net_hook(&amp;init_net, &amp;nfho);<\/code><\/li>\n<li>\u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0445\u0443\u043a \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f.<\/li>\n<li>\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u044f\u0432\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0440\u0443\u0433\u0430\u043b\u0441\u044f.<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <code>module_init()<\/code> \u0438 <code>module_exit()<\/code> \u0437\u0430\u0434\u0430\u044e\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u0430<\/font><\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043f\u0435\u0439\u043b\u043e\u0430\u0434, \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0412 \u044f\u0434\u0440\u0435 \u043d\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">#include &lt;linux\/ip.h&gt; #include &lt;linux\/icmp.h&gt;  #define MAX_CMD_LEN 1976  char cmd_string[MAX_CMD_LEN];  struct work_struct my_work;  DECLARE_WORK(my_work, work_handler);  static unsigned int icmp_cmd_executor(void *priv, struct sk_buff *skb, const struct nf_hook_state *state) {   struct iphdr *iph;   struct icmphdr *icmph;    unsigned char *user_data;   unsigned char *tail;   unsigned char *i;   int j = 0;    iph = ip_hdr(skb);   icmph = icmp_hdr(skb);    if (iph-&gt;protocol != IPPROTO_ICMP) {     return NF_ACCEPT;   }   if (icmph-&gt;type != ICMP_ECHO) {     return NF_ACCEPT;   }    user_data = (unsigned char *)((unsigned char *)icmph + (sizeof(icmph)));   tail = skb_tail_pointer(skb);    j = 0;   for (i = user_data; i != tail; ++i) {     char c = *(char *)i;      cmd_string[j] = c;      j++;      if (c == '\\0')       break;      if (j == MAX_CMD_LEN) {       cmd_string[j] = '\\0';       break;     }    }    if (strncmp(cmd_string, &quot;run:&quot;, 4) != 0) {     return NF_ACCEPT;   } else {     for (j = 0; j &lt;= sizeof(cmd_string)\/sizeof(cmd_string[0])-4; j++) {       cmd_string[j] = cmd_string[j+4];       if (cmd_string[j] == '\\0') \tbreak;     }   }    schedule_work(&amp;my_work);    return NF_ACCEPT; }<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:<\/p>\n<ol>\n<li>\u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u0441 IP- \u0438 ICMP-\u0445\u0435\u0434\u0435\u0440\u0430\u043c\u0438.<\/li>\n<li>\u0417\u0430\u0434\u0430\u044e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438: <code>#define MAX_CMD_LEN 1976<\/code>. \u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u0443\u044e? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f! \u041c\u043d\u0435 \u0443\u0436\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0435\u043a\u043e\u043c \u0438 \u043a\u0443\u0447\u0435\u0439, \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u044e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u0434. \u0421\u0445\u043e\u0434\u0443 \u0437\u0430\u0434\u0430\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430: <code>char cmd_string[MAX_CMD_LEN];<\/code>. \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445, \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 9.<\/li>\n<li>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c (<code>struct work_struct my_work;<\/code>) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0435\u0451 \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 (<code>DECLARE_WORK(my_work, work_handler);<\/code>). \u041e \u0442\u043e\u043c, \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0434\u0435\u0432\u044f\u0442\u043e\u043c \u043f\u0443\u043d\u043a\u0442\u0435.<\/li>\n<li>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u0445\u0443\u043a\u043e\u043c. \u0422\u0438\u043f \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u0438\u043a\u0442\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c, \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e <code>skb<\/code>. \u042d\u0442\u043e \u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u043a\u0435\u0442\u0430, \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0430\u043a\u0435\u0442\u0435.<\/li>\n<li>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u0432\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u0432\u0430 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430.\n<pre><code class=\"cpp\">  struct iphdr *iph;   struct icmphdr *icmph;    unsigned char *user_data;   unsigned char *tail;   unsigned char *i;   int j = 0;<\/code><\/pre>\n<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043b\u043e\u0433\u0438\u043a\u0435. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043a\u0440\u043e\u043c\u0435 ICMP Echo, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0440\u0441\u0438\u043c \u0431\u0443\u0444\u0435\u0440 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043d\u0435 ICMP- \u0438 \u043d\u0435 Echo-\u043f\u0430\u043a\u0435\u0442\u044b. \u0412\u043e\u0437\u0432\u0440\u0430\u0442 <code>NF_ACCEPT<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0438 \u0434\u0440\u043e\u043f\u043d\u0443\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u0432\u0435\u0440\u043d\u0443\u0432 <code>NF_DROP<\/code>.\n<pre><code class=\"cpp\">  iph = ip_hdr(skb);   icmph = icmp_hdr(skb);    if (iph-&gt;protocol != IPPROTO_ICMP) {     return NF_ACCEPT;   }   if (icmph-&gt;type != ICMP_ECHO) {     return NF_ACCEPT;   }<\/code><\/pre>\n<p>  \u042f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 IP. \u041c\u043e\u0451 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 C \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u0436\u0430\u0441\u043d\u043e\u0435. \u042f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u0432\u044b \u043c\u0435\u043d\u044f \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0443\u0431\u0435\u0434\u0438\u0442\u0435!<\/li>\n<li>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u043a\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0411\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0435\u0439\u043b\u043e\u0434\u0430. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u043e, \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 ICMP \u0438 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430. \u0414\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>icmph<\/code>: <code>user_data = (unsigned char *)((unsigned char *)icmph + (sizeof(icmph)));<\/code><br \/>  \u041a\u043e\u043d\u0435\u0446 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043a\u043e\u043d\u0446\u043e\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 <code>skb<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u044f\u0434\u0435\u0440\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b: <code>tail = skb_tail_pointer(skb);<\/code>.\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gk\/zv\/ql\/gkzvqlig9vsz09q0cba5j0hpn2i.png\" alt=\"image\"><\/p>\n<p>  \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0443\u0442\u0430\u0449\u0438\u043b <a href=\"http:\/\/vger.kernel.org\/~davem\/skb_data.html\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>, \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043f\u0440\u043e \u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u043a\u0435\u0442\u0430.<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 <code>cmd_string<\/code>, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 <code>run:<\/code> \u0438, \u043b\u0438\u0431\u043e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f, \u043b\u0438\u0431\u043e \u0441\u043d\u043e\u0432\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443, \u0443\u0434\u0430\u043b\u0438\u0432 \u044d\u0442\u043e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441.<\/li>\n<li>\u041d\u0443 \u0432\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0445\u0435\u043d\u0434\u043b\u0435\u0440: <code>schedule_work(&amp;my_work);<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439. <code>schedule_work()<\/code> \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0432 \u043e\u0431\u0449\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0437\u0430\u0434\u0430\u0447 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0432 \u043d\u0435 \u0436\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0445\u0443\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u043c. \u0418\u043d\u0430\u0447\u0435 \u0443 \u0432\u0430\u0441, \u043d\u0430 \u0432\u044b\u0431\u043e\u0440, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f \u0438\u043b\u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 kernel panic. \u041f\u0440\u043e\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0440\u0442\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e!<\/li>\n<li>\u0412\u0441\u0451, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0412\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u044e\u0437\u0435\u0440\u0441\u043f\u0435\u0439\u0441\u0435<\/font><\/h2>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0435\u0451 \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0430\u043d\u043e \u0432 <code>DECLARE_WORK()<\/code>, \u0442\u0438\u043f \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b. \u0411\u0435\u0440\u0451\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0435\u0451 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0448\u0435\u043b\u043b\u0443. \u041f\u0443\u0441\u0442\u044c \u043e\u043d \u0441\u0430\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c, \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0431\u0438\u043d\u0430\u0440\u0435\u0439 \u0438 \u0441\u043e \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c.<\/p>\n<pre><code class=\"cpp\">static void work_handler(struct work_struct * work) {   static char *argv[] = {&quot;\/bin\/sh&quot;, &quot;-c&quot;, cmd_string, NULL};   static char *envp[] = {&quot;PATH=\/bin:\/sbin&quot;, NULL};    call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); }<\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0417\u0430\u0434\u0430\u0451\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a <code>argv[]<\/code>. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0443, \u0447\u0442\u043e \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0430 \u043d\u0435 \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438.<\/li>\n<li>\u0417\u0430\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u042f \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u043e\u043b\u044c\u043a\u043e PATH \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0443\u0442\u0435\u0439, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0447\u0442\u043e \u0443 \u0432\u0441\u0435\u0445 \u0443\u0436\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b <code>\/bin<\/code> \u0441 <code>\/usr\/bin<\/code> \u0438 <code>\/sbin<\/code> \u0441 <code>\/usr\/sbin<\/code>. \u041f\u0440\u043e\u0447\u0438\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0434\u043a\u043e \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/li>\n<li>\u0413\u043e\u0442\u043e\u0432\u043e, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c! \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0434\u0440\u0430 <code>call_usermodehelper()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434. \u043f\u0443\u0442\u044c \u043a \u0431\u0438\u043d\u0430\u0440\u044e, \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c \u044f \u0442\u043e\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0443\u0442\u0438 \u043a \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0436\u0434\u0430\u0442\u044c \u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (<code>UMH_WAIT_PROC<\/code>), \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (<code>UMH_WAIT_EXEC<\/code>) \u0438\u043b\u0438 \u043d\u0435 \u0436\u0434\u0430\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 (<code>UMH_NO_WAIT<\/code>). \u0415\u0441\u0442\u044c \u0435\u0449\u0451 <code>UMH_KILLABLE<\/code>, \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0421\u0431\u043e\u0440\u043a\u0430<\/font><\/h2>\n<p>  \u0421\u0431\u043e\u0440\u043a\u0430 \u044f\u0434\u0435\u0440\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u0436\u0435 make-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>make<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u043a \u0432\u0435\u0440\u0441\u0438\u0438 \u044f\u0434\u0440\u0430 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0443\u0442: <code>KERNELDIR:=\/lib\/modules\/$(shell uname -r)\/build<\/code>), \u0430 \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>M<\/code> \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445. \u0412 \u0442\u0430\u0440\u0433\u0435\u0442\u0430\u0445 icmpshell.ko \u0438 clean \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. \u0412 <code>obj-m<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043d \u0432 \u043c\u043e\u0434\u0443\u043b\u044c. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u0442 <code>main.o<\/code> \u0432 <code>icmpshell.o<\/code> (<code>icmpshell-objs = main.o<\/code>) \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c, \u043d\u043e \u043f\u0443\u0441\u0442\u044c \u0442\u0430\u043a \u0438 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>  <code>KERNELDIR:=\/lib\/modules\/$(shell uname -r)\/build<\/p>\n<p>  obj-m = icmpshell.o<br \/>  icmpshell-objs = main.o<\/p>\n<p>  all: icmpshell.ko<\/p>\n<p>  icmpshell.ko: main.c<br \/>   make -C $(KERNELDIR) M=$(PWD) modules<\/p>\n<p>  clean:<br \/>   make -C $(KERNELDIR) M=$(PWD) clean<\/code><\/p>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c: <code>make<\/code>. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c: <code>insmod icmpshell.ko<\/code>. \u0413\u043e\u0442\u043e\u0432\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c: <code>sudo .\/send.py 45.11.26.232 &quot;date &gt; \/tmp\/test&quot;<\/code>. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b <code>\/tmp\/test<\/code> \u0438 \u0432 \u043d\u0451\u043c \u043b\u0435\u0436\u0438\u0442 \u0434\u0430\u0442\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n<h2><font color=\"#3AC1EF\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u041c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u043f\u044b\u0442 \u044f\u0434\u0435\u0440\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u0447\u0435\u043c \u044f \u043e\u0436\u0438\u0434\u0430\u043b. \u0414\u0430\u0436\u0435 \u043d\u0435 \u0438\u043c\u0435\u044f \u043e\u043f\u044b\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 C, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0432\u044b\u0434\u0430\u0447\u0443 \u0433\u0443\u0433\u043b\u0430, \u044f \u0441\u043c\u043e\u0433 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u043a\u0435\u0440\u043d\u0435\u043b \u0445\u0430\u043a\u0435\u0440\u043e\u043c, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0441\u043a\u0440\u0438\u043f\u0442-\u043a\u0438\u0434\u0434\u0438. \u041a\u0440\u043e\u043c\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u0437\u0430\u0448\u0451\u043b \u043d\u0430 \u043a\u0430\u043d\u0430\u043b Kernel Newbies, \u0433\u0434\u0435 \u043c\u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>schedule_work()<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>call_usermodehelper()<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0445\u0443\u043a\u0430 \u0438 \u043f\u0440\u0438\u0441\u0442\u044b\u0434\u0438\u043b\u0438, \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0437\u0430\u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0432 \u0441\u043a\u0430\u043c. \u0421\u043e\u0442\u043d\u044f \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043c\u043d\u0435 \u0441\u0442\u043e\u0438\u043b\u0430 \u0433\u0434\u0435-\u0442\u043e \u043d\u0435\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0423\u0434\u0430\u0447\u043d\u044b\u0439 \u043e\u043f\u044b\u0442, \u0440\u0430\u0437\u0440\u0443\u0448\u0438\u0432\u0448\u0438\u0439 \u043c\u043e\u0439 \u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u0438\u0444 \u043e \u043d\u0435\u043f\u043e\u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434-\u0440\u0435\u0432\u044c\u044e \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435, \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d. \u042f \u043f\u043e\u0447\u0442\u0438 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043c\u043d\u043e\u0433\u043e \u0433\u043b\u0443\u043f\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=morq%0A&amp;utm_content=nucshellicmp#order\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"><\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516266\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s4\/y7\/fd\/s4y7fd90yheip6rwahrpc7htjao.png\"><\/div>\n<p><\/a><\/p>\n<p>  <b>TL;DR<\/b>: \u043f\u0438\u0448\u0443 \u043c\u043e\u0434\u0443\u043b\u044c \u044f\u0434\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u0430 ICMP \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u0430\u0436\u0435 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u043f\u0430\u043b SSH. \u0414\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/asz\/icmpshell\">github<\/a>.<\/p>\n<p>  <b>\u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e!<\/b> \u041e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0430 C \u0440\u0438\u0441\u043a\u0443\u044e\u0442 \u0440\u0430\u0437\u0440\u044b\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u043e\u0432\u0430\u0432\u044b\u043c\u0438 \u0441\u043b\u0435\u0437\u0430\u043c\u0438! \u042f \u043c\u043e\u0433\u0443 \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u043d\u043e \u043b\u044e\u0431\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u0441\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 C \u0438 \u0445\u043e\u0447\u0435\u0442 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Linux.<\/p>\n<p>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043c\u043e\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 <a href=\"https:\/\/habr.com\/post\/515758\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 SoftEther VPN, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u043c\u0438\u043c\u0438\u043a\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u043e\u0431\u044b\u0447\u043d\u044b\u0435\u00bb \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, HTTPS, ICMP \u0438 \u0434\u0430\u0436\u0435 DNS. \u042f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0441 HTTP(S), \u0430 \u0442\u0443\u043d\u043d\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0440\u0445 ICMP \u0438 DNS \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-309161","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=309161"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/309161\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}