{"id":340410,"date":"2022-10-28T15:01:20","date_gmt":"2022-10-28T15:01:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=340410"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=340410","title":{"rendered":"<span>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Windows \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell \u0447\u0435\u0440\u0435\u0437 Telegram \u0431\u043e\u0442\u0430 \u043d\u0430 Python<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u0438\u043b\u0438\u0430\u043b\u043e\u0432 \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u041e\u0445\u0440\u0430\u043d\u0430 \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0434\u0435\u0442 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e, \u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u0437\u0430\u0432\u0438\u0441\u0430\u0442\u044c. \u0417\u0432\u043e\u043d\u043a\u0438 \u043e\u0442 \u043e\u0445\u0440\u0430\u043d\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0442\u044b \u0441\u043f\u0438\u0448\u044c \u0438\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u041f\u041a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443   <\/p>\n<p> \u042f \u043d\u0430\u0447\u0430\u043b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram \u0431\u043e\u0442\u0430 \u043d\u0430 Python, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u041f\u041e \u0438\u043b\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u043b\u044e\u0434\u044f\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0445\u0440\u0430\u043d\u0435<\/p>\n<p> \u041f\u0440\u0438 \u0432\u0441\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Telegram \u0431\u043e\u0442\u043e\u0432, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043c\u0430\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0435\u0439 \u0437\u0434\u0435\u0441\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f <\/p>\n<p> \u0422\u0430\u043a \u0436\u0435 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u0438 \u043f\u0440.., \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438 <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445  <\/h3>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u041f\u041a) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0441\u043d\u0430\u0441\u0442\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 <\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c WinRM \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Enable-PSremoting \u2013force<\/code><\/pre>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 PowerShell \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0441\u0435\u0442\u0438   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Enable-PSremoting -skipnetworkprofilecheck \u2013force<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Set-executionpolicy remotesigned<\/code><\/pre>\n<p>\u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c) \u041f\u041a \u0442\u043e\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438   <\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 TrustedHosts \u0438\u043b\u0438 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 *   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Set-item wsman:\\localhost\\client\\trustedhosts *<\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell ISE \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\/\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0442\u0443\u0442 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435    <\/p>\n<pre><code class=\"powershell\">$proc = Get-Process | Where-Object  {$_.Name -eq \"\u0418\u043c\u044f \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\"} $proc.Kill() Start-Process \"C:\\apps\\\u041f\u0443\u0442\u044c \u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \"<\/code><\/pre>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0435\u0437 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0433\u0434\u0435 \u0443\u043a\u0430\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430      <\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/10b\/c49\/ba0\/10bc49ba0e6abab38a419d8d636dc46c.png\" width=\"449\" height=\"270\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/10b\/c49\/ba0\/10bc49ba0e6abab38a419d8d636dc46c.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 <\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0441 Windows 10   <\/p>\n<p> \u0421\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0434\u043e\u043c\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u043e\u0439\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u041f\u041a \u0438 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0438\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e\u0434 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c <\/p>\n<p> \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u041f\u041a \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 <\/p>\n<pre><code class=\"powershell\">Invoke-Command -ComputerName 'IP \u0430\u0434\u0440\u0435\u0441' -ScriptBlock {Start-ScheduledTask '\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f'}<\/code><\/pre>\n<p> \u0427\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0430\u0448 \u0431\u043e\u0442 \u0441\u043c\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 PowerShell \u0434\u043b\u044f \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0431\u043b\u043e\u043a\u043d\u043e\u0442<\/p>\n<p><strong>   \u0421\u043e\u0437\u0434\u0430\u0435\u043c Telegram \u0431\u043e\u0442\u0430<\/strong><\/p>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <strong>@BotFather<\/strong>, \u043f\u0438\u0448\u0435\u043c <strong>\/newbot<\/strong>, \u0434\u0430\u043b\u0435\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0431\u043e\u0442\u0430 <\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7a3\/365\/a78\/7a3365a78b88886b08f00099a3c811b3.png\" width=\"406\" height=\"466\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7a3\/365\/a78\/7a3365a78b88886b08f00099a3c811b3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f token \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <strong>\/mybots<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0435\u043d\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434     <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f9c\/ad8\/fa8\/f9cad8fa859c41eea258e0bd5d1c24e9.png\" width=\"435\" height=\"298\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f9c\/ad8\/fa8\/f9cad8fa859c41eea258e0bd5d1c24e9.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dfb\/5c2\/401\/dfb5c2401c6cb0f13cb33ddfd9145c75.png\" width=\"461\" height=\"253\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dfb\/5c2\/401\/dfb5c2401c6cb0f13cb33ddfd9145c75.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Python   <\/h3>\n<p> \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Python, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Python, \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b PyCharm, Python 3.9.13 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 IDE, \u0441 \u043d\u0438\u043c \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0421\u0441\u044b\u043b\u043a\u0430 https:\/\/www.jetbrains.com\/pycharm\/<\/p>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Cmd \u0438\u043b\u0438 PowerShell \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c   <\/p>\n<pre><code class=\"bash\">py -m pip install telepot<\/code><\/pre>\n<h3>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e Telegram \u0431\u043e\u0442\u0430<\/h3>\n<pre><code class=\"python\">import telepot, time, subprocess  def remote(msg):     content_type, chat_type, chat_id = telepot.glance(msg)      if (content_type == 'text'):         command = msg['text']         print ('Got command: %s' % command)          if  '\/address1' in command: #\u041a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \u0432 Telegram             p = subprocess.Popen(expert1, shell=True) #\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e               p = subprocess.Popen(expert2, shell=True)             bot.sendMessage(chat_id, \"DONE\") #\u0412\u044b\u0432\u043e\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0447\u0430\u0442          if  '\/address2' in command:             p = subprocess.Popen(expert3, shell=True)             p = subprocess.Popen(expert4, shell=True)                         p = subprocess.Popen(expert5, shell=True)             bot.sendMessage(chat_id, \"DONE\")          if  '\/address3' in command:             p = subprocess.Popen(expert6, shell=True)             p = subprocess.Popen(expert7, shell=True)             bot.sendMessage(chat_id, \"DONE\")          bot = telepot.Bot('\u0412\u0430\u0448 token Telegam \u0431\u043e\u0442\u0430') #\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c token Telegam \u0431\u043e\u0442\u0430  expert1 = 'C:\\Telegram\\expert1.ps1' #\u0423\u043a\u0430\u0437\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443  expert2 = 'C:\\Telegram\\expert2.ps1' expert3 = 'C:\\Telegram\\expert3.ps1' expert4 = 'C:\\Telegram\\expert4.ps1' expert5 = 'C:\\Telegram\\expert5.ps1' expert6 = 'C:\\Telegram\\expert6.ps1' expert7 = 'C:\\Telegram\\expert7.ps1'  bot.message_loop(remote)  while 1:     time.sleep(20)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u043e\u0442\u0430<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aee\/3f2\/a55\/aee3f2a55062571e8bbc13efb2795ca3.png\" width=\"327\" height=\"186\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aee\/3f2\/a55\/aee3f2a55062571e8bbc13efb2795ca3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7ea\/942\/46a\/7ea94246af2402b47345a6589810d975.png\" width=\"381\" height=\"147\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ea\/942\/46a\/7ea94246af2402b47345a6589810d975.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u0448 \u0431\u043e\u0442 \u0433\u043e\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/post\/696036\/\"> https:\/\/habr.com\/ru\/post\/696036\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u0438\u043b\u0438\u0430\u043b\u043e\u0432 \u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f. \u041e\u0445\u0440\u0430\u043d\u0430 \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e \u0432\u0435\u0434\u0435\u0442 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e, \u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u0437\u0430\u0432\u0438\u0441\u0430\u0442\u044c. \u0417\u0432\u043e\u043d\u043a\u0438 \u043e\u0442 \u043e\u0445\u0440\u0430\u043d\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0442\u044b \u0441\u043f\u0438\u0448\u044c \u0438\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u041f\u041a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443   <\/p>\n<p> \u042f \u043d\u0430\u0447\u0430\u043b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram \u0431\u043e\u0442\u0430 \u043d\u0430 Python, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u041f\u041e \u0438\u043b\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0442\u043d\u044b\u043c \u043b\u044e\u0434\u044f\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0445\u0440\u0430\u043d\u0435<\/p>\n<p> \u041f\u0440\u0438 \u0432\u0441\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Telegram \u0431\u043e\u0442\u043e\u0432, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043c\u0430\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0435\u0439 \u0437\u0434\u0435\u0441\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f <\/p>\n<p> \u0422\u0430\u043a \u0436\u0435 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u0438 \u043f\u0440.., \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438 <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445  <\/h3>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u041f\u041a) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0441\u043d\u0430\u0441\u0442\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 <\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c WinRM \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Enable-PSremoting \u2013force<\/code><\/pre>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 PowerShell \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0441\u0435\u0442\u0438   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Enable-PSremoting -skipnetworkprofilecheck \u2013force<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Set-executionpolicy remotesigned<\/code><\/pre>\n<p>\u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c) \u041f\u041a \u0442\u043e\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438   <\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0432 TrustedHosts \u0438\u043b\u0438 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 *   <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"powershell\">Set-item wsman:\\localhost\\client\\trustedhosts *<\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell ISE \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\/\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0442\u0443\u0442 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435    <\/p>\n<pre><code class=\"powershell\">$proc = Get-Process | Where-Object  {$_.Name -eq \"\u0418\u043c\u044f \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\"} $proc.Kill() Start-Process \"C:\\apps\\\u041f\u0443\u0442\u044c \u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \"<\/code><\/pre>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0435\u0437 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0433\u0434\u0435 \u0443\u043a\u0430\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430      <\/p>\n<figure class=\"bordered\"><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 <\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0441 Windows 10   <\/p>\n<p> \u0421\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0434\u043e\u043c\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u043e\u0439\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043f\u0430\u0440\u043e\u043b\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u041f\u041a \u0438 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0438\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e\u0434 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c <\/p>\n<p> \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u041f\u041a \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 <\/p>\n<pre><code class=\"powershell\">Invoke-Command -ComputerName 'IP \u0430\u0434\u0440\u0435\u0441' -ScriptBlock {Start-ScheduledTask '\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f'}<\/code><\/pre>\n<p> \u0427\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0430\u0448 \u0431\u043e\u0442 \u0441\u043c\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 PowerShell \u0434\u043b\u044f \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0431\u043b\u043e\u043a\u043d\u043e\u0442<\/p>\n<p><strong>   \u0421\u043e\u0437\u0434\u0430\u0435\u043c Telegram \u0431\u043e\u0442\u0430<\/strong><\/p>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <strong>@BotFather<\/strong>, \u043f\u0438\u0448\u0435\u043c <strong>\/newbot<\/strong>, \u0434\u0430\u043b\u0435\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0431\u043e\u0442\u0430 <\/p>\n<figure class=\"bordered\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f token \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <strong>\/mybots<\/strong> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0435\u043d\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434     <\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Python   <\/h3>\n<p> \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Python, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Python, \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b PyCharm, Python 3.9.13 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 IDE, \u0441 \u043d\u0438\u043c \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0421\u0441\u044b\u043b\u043a\u0430 https:\/\/www.jetbrains.com\/pycharm\/<\/p>\n<p> \u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Cmd \u0438\u043b\u0438 PowerShell \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c   <\/p>\n<pre><code class=\"bash\">py -m pip install telepot<\/code><\/pre>\n<h3>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e Telegram \u0431\u043e\u0442\u0430<\/h3>\n<pre><code class=\"python\">import telepot, time, subprocess  def remote(msg):     content_type, chat_type, chat_id = telepot.glance(msg)      if (content_type == 'text'):         command = msg['text']         print ('Got command: %s' % command)          if  '\/address1' in command: #\u041a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \u0432 Telegram             p = subprocess.Popen(expert1, shell=True) #\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e               p = subprocess.Popen(expert2, shell=True)             bot.sendMessage(chat_id, \"DONE\") #\u0412\u044b\u0432\u043e\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0447\u0430\u0442          if  '\/address2' in command:             p = subprocess.Popen(expert3, shell=True)             p = subprocess.Popen(expert4, shell=True)                         p = subprocess.Popen(expert5, shell=True)             bot.sendMessage(chat_id, \"DONE\")          if  '\/address3' in command:             p = subprocess.Popen(expert6, shell=True)             p = subprocess.Popen(expert7, shell=True)             bot.sendMessage(chat_id, \"DONE\")          bot = telepot.Bot('\u0412\u0430\u0448 token Telegam \u0431\u043e\u0442\u0430') #\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c token Telegam \u0431\u043e\u0442\u0430  expert1 = 'C:\\Telegram\\expert1.ps1' #\u0423\u043a\u0430\u0437\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443  expert2 = 'C:\\Telegram\\expert2.ps1' expert3 = 'C:\\Telegram\\expert3.ps1' expert4 = 'C:\\Telegram\\expert4.ps1' expert5 = 'C:\\Telegram\\expert5.ps1' expert6 = 'C:\\Telegram\\expert6.ps1' expert7 = 'C:\\Telegram\\expert7.ps1'  bot.message_loop(remote)  while 1:     time.sleep(20)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u043e\u0442\u0430<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u0448 \u0431\u043e\u0442 \u0433\u043e\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/post\/696036\/\"> https:\/\/habr.com\/ru\/post\/696036\/<\/a><br \/><\/br><\/br><\/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-340410","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340410","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=340410"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340410\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}