{"id":467615,"date":"2025-07-18T23:25:57","date_gmt":"2025-07-18T23:25:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=467615"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=467615","title":{"rendered":"<span>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 IT-\u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b: \u0441\u043a\u0440\u0438\u043f\u0442 v2.0 \u0434\u043b\u044f \u0421\u043a\u0430\u043d\u0435\u0440-\u0412\u0421 6<\/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<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3d\/df8\/808\/e3ddf880851eb5c6d1e91ebdb7705c61.jpg\" width=\"1190\" height=\"669\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e3d\/df8\/808\/e3ddf880851eb5c6d1e91ebdb7705c61.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3d\/df8\/808\/e3ddf880851eb5c6d1e91ebdb7705c61.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u042d\u0442\u043e \u0410\u043d\u0442\u043e\u043d \u0414\u044f\u0442\u043b\u043e\u0432, \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 <a href=\"https:\/\/selectel.ru\/services\/is\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_scan2_170725_content\" rel=\"noopener noreferrer nofollow\">\u0432 Selectel<\/a>. \u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/892802\/\" rel=\"noopener noreferrer nofollow\">\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b<\/a>, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 API \u00ab\u0421\u043a\u0430\u043d\u0435\u0440-\u0412\u0421 6\u00bb \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043e\u0442\u0447\u0435\u0442\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 Telegram. \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0430\u043d\u0435\u0440 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 cron, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u043e\u0431 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u0445. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445, \u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u0438 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u2014 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0441\u043f\u043b\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f: \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u044d\u0442\u0430\u043f\u0430\u0445, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 (\u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u043a\u0430\u043d \u2192 \u0441\u043a\u0430\u043d \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2192 \u043e\u0442\u0447\u0435\u0442) \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0441\u043a\u0430\u043d\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0430\u0441\u0441\u0435\u0442\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u2014 \u0441 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u043c,  \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (IP \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438), \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u0441\u0441\u0435\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 SQL.<\/p>\n<h2>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u043e\u0434\u0443<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043c\u0435\u043d \u0438 ID, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0444\u043e\u043d\u0435: \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u043e cron \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432, \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"json\">[     {\"id\": \"1\", \"name\": \"zone1\", \"ip\": \"10.1.1.1\"},     {\"id\": \"2\", \"name\": \"zone1\", \"ip\": \"10.1.1.2\"} ]<\/code><\/pre>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">for client in clients:     asset_id = create_asset(client['ip'])     scan_id = add_netscan_task(client['ip'])     run_task(scan_id)      while not is_completed(scan_id):         time.sleep(3600)     vulnscan_id = add_vulnscan_task(asset_id)     run_task(vulnscan_id)      while not is_completed(vulnscan_id):         time.sleep(3600)     report_id = add_report(asset_id)<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0443\u0442 \u0432\u0438\u0434\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432.\u00a0<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c IP (\u043e\u0434\u0438\u043d \u0430\u0434\u0440\u0435\u0441) \u0438 net (\u043f\u043e\u0434\u0441\u0435\u0442\u0438) \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u042d\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430: \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0430\u043f\u0430\u043c\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 cron \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c, \u0437\u0430 \u043a\u0430\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u0435\u0441\u0442\u044c \u0440\u0438\u0441\u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u042d\u0442\u043e \u0447\u0440\u0435\u0432\u0430\u0442\u043e \u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u2014 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0430\u043a\u0442\u0438\u0432\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<\/li>\n<li>\n<p>Cron \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u2014 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u044d\u0442\u0430\u043f, \u0438 \u0441 \u0440\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u00ab\u0432 \u0445\u043e\u043b\u043e\u0441\u0442\u0443\u044e\u00bb \u2014 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 cron \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u043e<\/h4>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438: \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u044d\u0442\u0430\u043f \u0437\u0430\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0436\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 cron.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f: \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043c\u043e\u0436\u0435\u0442 \u00ab\u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c\u00bb, \u043d\u0435 \u0434\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u0441\u0430\u043c\u043e\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: \u0435\u0441\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\/\u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0438\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043e\u043d \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<div class=\"floating-image\">\n<figure class=\"float\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bb6\/10d\/1bb\/bb610d1bb5fca8a608b862ad27a8fe2f.png\" width=\"144\" height=\"144\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/bb6\/10d\/1bb\/bb610d1bb5fca8a608b862ad27a8fe2f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bb6\/10d\/1bb\/bb610d1bb5fca8a608b862ad27a8fe2f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong>\u0418\u0433\u0440\u043e\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043a\u0440\u0438\u043f\u0435\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u0440\u0442\u0430\u043b\u043e\u043c \u0432 \u041d\u0435\u0437\u0435\u0440.\u00a0<\/strong>\u0414\u043e\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u043c\u0438\u0440 Selectel \u0432 Minecraft \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0437\u044b.<\/p>\n<p><a href=\"https:\/\/promo.selectel.ru\/minecraft\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=minecraft_article_scan2_170725_banner_092_02_ord\" rel=\"noopener noreferrer nofollow\"><code><strong>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u2192<\/strong><\/code><\/a><\/p>\n<\/div>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 v2.0<\/h2>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0438\u0434\u0435\u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<ul>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (IP\/net), \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043e\u0442\u0434\u0435\u043b \u0438\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u043e\u0441\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 netscan, vulnscan \u0438 \u043e\u0442\u0447\u0435\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u0439\u043d\u043e\u0441\u0442\u044c: netscan \u2192 vulnscan \u2192 report. \u0412\u0441\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0444\u043b\u0430\u0433\u0430 \u0438 JSON-\u0444\u0430\u0439\u043b\u0430, \u044d\u0442\u0430\u043f\u044b \u0438\u0434\u0443\u0442 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0447\u0435\u0440\u0435\u0437 at, \u0430 \u043d\u0435 cron.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d JSON-\u0444\u0430\u0439\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435: ID, \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441, \u0441\u0442\u0430\u0442\u0443\u0441\u044b. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0424\u043b\u0430\u0433 done \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432: cron \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0445\u043e\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441, \u043d\u043e \u043b\u0438\u0448\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0436\u0435\u0441\u0442\u043a\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 SQL-\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 v2.0 \u2014 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/h4>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u0433\u0438\u0431\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0447\u0435\u0440\u0435\u0437 cron. \u0421\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0440\u0430\u0437, \u043d\u043e \u0446\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0434\u0438\u043d\u043e\u0436\u0434\u044b \u0432 \u043c\u0435\u0441\u044f\u0446 \u2014 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043e\u0442\u0447\u0435\u0442\u044b. \u042d\u0442\u043e \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0438 \u0430\u043a\u0442\u0438\u0432\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u00ab\u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u00bb, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u0430\u0434\u0430\u0447 \u0438 \u0441\u043a\u0430\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">def main():     original_data = load_json(client_list_file)     yyyymm = get_current_yyyymm()     # 1. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0444\u043b\u0430\u0433 done \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c     if isinstance(original_data, dict) and original_data.get(\"done\") and original_data.get(\"month\") == yyyymm:         print(\"Pipeline \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u044f\u0446\u0435. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.\")         return     # 2. \u0421\u0442\u0430\u0434\u0438\u044f (netscan\/vulnscan\/report) \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f     if isinstance(original_data, dict) and \"stage\" in original_data:         stage = original_data[\"stage\"]         orig_clients = original_data.get(\"original_clients\", [])         clients = original_data.get(\"clients\", [])     else:         stage = \"netscan\"         orig_clients = list(original_data)         clients = list(original_data)     # 3. \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0437\u0430\u043f\u0443\u0441\u043a     groups = group_clients_by_name(clients)     auth_cookies = authorization()     base_update(auth_cookies)<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0435\u0442\u0435\u0439 \u0438 IP<\/h4>\n<p>\u0412 \u0432\u0435\u0440\u0441\u0438\u0438 1.0 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u043c\u0435\u043b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c:<\/p>\n<pre><code class=\"python\">for client in clients:     if \"ip\" in client:     # \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c     # \u0415\u0441\u043b\u0438 net \u2014 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438<\/code><\/pre>\n<p>\u0412 \u0432\u0435\u0440\u0441\u0438\u0438 2.0 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439 (net). \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0438\u043d\u0433\u0443\u0435\u0442 \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u00ab\u0436\u0438\u0432\u044b\u0435\u00bb:<\/p>\n<pre><code class=\"python\">def get_alive_ips(network):     net = ipaddress.ip_network(network, strict=False)     alive = []     for ip in net.hosts():         ip_str = str(ip)         try:             result = subprocess.run(['ping', '-c', '1', '-W', '1', ip_str],                                     stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)             if result.returncode == 0:                 alive.append(ip_str)         except Exception:             continue     return alive<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 (name). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">def group_clients_by_name(clients):     groups = {}     for client in clients:         name = client[\"name\"]         if name not in groups:             groups[name] = {\"name\": name, \"ips\": [], \"ids\": [], \"assets\": []}         if \"ip\" in client:             groups[name][\"ips\"].append(client[\"ip\"])             groups[name][\"ids\"].append(client[\"id\"])         elif \"net\" in client:             alive_ips = get_alive_ips(client[\"net\"])             groups[name][\"ips\"].extend(alive_ips)             groups[name][\"ids\"].append(client[\"id\"])     return groups<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u044c (net), \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0430\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0435\u0435 \u043d\u0430 IP, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c ID \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u2014 \u043f\u043e \u0441\u0443\u0442\u0438, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 IP \u0438\u0437 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0447\u0442\u043e \u0438 \u0443 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0435\u0442\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/blockquote>\n<h4>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name<\/h4>\n<p><strong>v1.0<\/strong>: \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e IP. \u041e\u0434\u0438\u043d \u0430\u0434\u0440\u0435\u0441 \u2014 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u0441\u043f\u0430\u043c\u0443 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438: \u0441\u043a\u0430\u043d\u0435\u0440 \u043c\u043e\u0433 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438: \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c \u0434\u0435\u0441\u044f\u0442\u043a\u0438.<\/p>\n<p><strong>v2.0:<\/strong> \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043e\u0442\u0434\u0435\u043b\u0443, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u043a\u0430\u043d\u0435\u0440, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0430\u043d\u043e\u0432:<\/p>\n<pre><code class=\"python\">for name, group in groups.items():     if not group.get(\"id_netscan\"):         task_id = add_netscan_task(auth_cookies, name, group[\"ips\"])         if task_id:             group[\"id_netscan\"] = task_id<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u0447, \u043f\u0440\u043e\u0449\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h4>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0430\u043f\u0430\u043c\u0438<\/h4>\n<p><strong>v1.0:<\/strong> \u0442\u0435\u0441\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u043a\u0430 \u0441 cron, \u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u2014 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e. \u0415\u0441\u043b\u0438 netscan \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u2014 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0437\u0430 10 \u043c\u0438\u043d\u0443\u0442, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0435\u0449\u0435 \u0448\u0435\u0441\u0442\u044c \u0447\u0430\u0441\u043e\u0432.<\/p>\n<p>\u0412 <strong>v2.0<\/strong> \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0441\u0430\u043c \u00ab\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u00bb \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e:<\/p>\n<pre><code class=\"python\">def schedule_next_run(delay_seconds=120):     cmd = f'echo \"python3 {os.path.abspath(__file__)} --clientlist {client_list_file}\" | at now + {delay_seconds\/\/60} minutes'     subprocess.run(cmd, shell=True)<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433:<\/strong> \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<h4>\u0424\u043b\u0430\u0433 done \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432<\/h4>\n<p><strong>v1.0: <\/strong>\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0447\u0430\u044f\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p><strong>v2.0: <\/strong>\u0432 \u0444\u0430\u0439\u043b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0435\u0441\u044f\u0446<em>. <\/em>\u0412\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 cron-\u0437\u0430\u043f\u0443\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0441\u044f\u0446\u0430:<\/p>\n<pre><code class=\"python\">{\"done\": true, \"month\": \"202507\"}<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u0432, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<h4>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h4>\n<p><strong>v1.0: <\/strong>API-\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p><strong>v2.0: <\/strong>\u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f SQL-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u00ab\u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0435\u00bb \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"python\">def force_delete_all_assets_psql():     cmd = [         \"psql\",         \"postgres:\/\/scannervs:scannervs@localhost:5435\/scanner-asset\",         \"-c\",         \"DELETE FROM scanner.assets\"     ]     subprocess.run(cmd, ...)<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u0431\u0430\u0437\u0430 \u043d\u0435 \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442\u0441\u044f, \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0435 \u0432\u0438\u0441\u044f\u0442 \u00ab\u0433\u0440\u0443\u0437\u043e\u043c\u00bb.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430: cron + at<\/h4>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 cron \u0434\u043b\u044f \u00ab\u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u043c\u0435\u0441\u044f\u0446\u0430\u00bb, \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0440\u0442\u043e\u0432 \u0432 \u0441\u0443\u0442\u043a\u0438 (\u043a\u0430\u0436\u0434\u044b\u0435 \u0448\u0435\u0441\u0442\u044c \u0447\u0430\u0441\u043e\u0432) \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0445 \u0434\u043d\u0435\u0439 \u043f\u043e\u0434\u0440\u044f\u0434:<\/p>\n<pre><code class=\"bash\">0 1,9,15,21 2,3,4 7 * python3 \/way\/to\/script.py --clientlist \/way\/to\/clientlist.json &gt;&gt; \/way\/to\/scan1.log 2&gt;&amp;1<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 20 \u0447\u0430\u0441\u043e\u0432, cron \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0445\u043e\u0442\u044c 12 \u0440\u0430\u0437 \u2014 \u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>at<\/code>.<\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438 \u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 v2.0<\/h2>\n<p>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: \u043e\u0434\u0438\u043d JSON \u0438 cron \u2014 \u0432\u0441\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e JSON, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e.<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: IP \u0438 \u0441\u0435\u0442\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u0442\u043e\u0447\u0435\u0447\u043d\u043e, \u0442\u0430\u043a \u0438 \u043c\u0430\u0441\u0441\u043e\u0432\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432. \u0412\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 JSON, \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430. \u041d\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u0435\u0441\u043b\u0438 \u0412\u041c \u0441\u043e \u0441\u043a\u0430\u043d\u0435\u0440\u043e\u043c \u0443\u043f\u0430\u0434\u0435\u0442 \u2014 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f. \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0438 \u043e\u0442\u0447\u0435\u0442\u043e\u0432, \u0440\u0443\u0447\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u0432\u0435\u0434\u0435\u043d\u0430 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 Telegram.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0438\u0436\u0435 \u2014 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430.<\/p>\n<p>1. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0432\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a JSON \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<pre><code class=\"json\">[     {\"id\": \"1\", \"name\": \"\u0438\u043c\u044f \u0441\u0435\u0442\u0438 1\", \"net\": \"X.X.X.X\/X\"},     {\"id\": \"2\", \"name\": \"\u0438\u043c\u044f \u0441\u0435\u0442\u0438 2\", \"ip\": \"Y.Y.Y.Y\"} ]<\/code><\/pre>\n<p>2. \u041f\u0440\u043e\u043f\u0438\u0448\u0438\u0442\u0435 cron \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u2014 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442 6 \u0434\u043e 48 \u0447\u0430\u0441\u043e\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432 \u0434\u043b\u044f IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432.<\/p>\n<p>3. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0439. \u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c Telegram, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044e \u043c\u0435\u0440 \u043f\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e<\/h4>\n<ul>\n<li>\n<p>\u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u0440\u0438\u0441\u043a\u043e\u0432 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043a\u0430\u043d \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0443\u0431\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0434 \u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0449\u0435, \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u0435\u0435 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u0438\u0437 \u0441\u043a\u0430\u043d\u0435\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0412 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0438\u0437\u0443\u0447\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u0432 Telegram \u0438\u043b\u0438 \u043f\u043e\u0447\u0442\u0443, \u0434\u043b\u044f \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u0430\u043d\u0435\u0440\u0430. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c!<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/927806\/\"> https:\/\/habr.com\/ru\/articles\/927806\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u042d\u0442\u043e \u0410\u043d\u0442\u043e\u043d \u0414\u044f\u0442\u043b\u043e\u0432, \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 <a href=\"https:\/\/selectel.ru\/services\/is\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_scan2_170725_content\" rel=\"noopener noreferrer nofollow\">\u0432 Selectel<\/a>. \u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/892802\/\" rel=\"noopener noreferrer nofollow\">\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b<\/a>, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 API \u00ab\u0421\u043a\u0430\u043d\u0435\u0440-\u0412\u0421 6\u00bb \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043e\u0442\u0447\u0435\u0442\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 Telegram. \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0430\u043d\u0435\u0440 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 cron, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u043e\u0431 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u0445. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445, \u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u0438 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u2014 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0441\u043f\u043b\u044b\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f: \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u044d\u0442\u0430\u043f\u0430\u0445, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 (\u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u043a\u0430\u043d \u2192 \u0441\u043a\u0430\u043d \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2192 \u043e\u0442\u0447\u0435\u0442) \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0441\u043a\u0430\u043d\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0430\u0441\u0441\u0435\u0442\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u2014 \u0441 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u043c,  \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (IP \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438), \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u0441\u0441\u0435\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 SQL.<\/p>\n<h2>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u043e\u0434\u0443<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043c\u0435\u043d \u0438 ID, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0444\u043e\u043d\u0435: \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u043e cron \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432, \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"json\">[     {\"id\": \"1\", \"name\": \"zone1\", \"ip\": \"10.1.1.1\"},     {\"id\": \"2\", \"name\": \"zone1\", \"ip\": \"10.1.1.2\"} ]<\/code><\/pre>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">for client in clients:     asset_id = create_asset(client['ip'])     scan_id = add_netscan_task(client['ip'])     run_task(scan_id)      while not is_completed(scan_id):         time.sleep(3600)     vulnscan_id = add_vulnscan_task(asset_id)     run_task(vulnscan_id)      while not is_completed(vulnscan_id):         time.sleep(3600)     report_id = add_report(asset_id)<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0443\u0442 \u0432\u0438\u0434\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432.\u00a0<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c IP (\u043e\u0434\u0438\u043d \u0430\u0434\u0440\u0435\u0441) \u0438 net (\u043f\u043e\u0434\u0441\u0435\u0442\u0438) \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u042d\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430: \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0430\u043f\u0430\u043c\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 cron \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c, \u0437\u0430 \u043a\u0430\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u0435\u0441\u0442\u044c \u0440\u0438\u0441\u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u042d\u0442\u043e \u0447\u0440\u0435\u0432\u0430\u0442\u043e \u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u2014 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0430\u043a\u0442\u0438\u0432\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<\/li>\n<li>\n<p>Cron \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u2014 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u044d\u0442\u0430\u043f, \u0438 \u0441 \u0440\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u00ab\u0432 \u0445\u043e\u043b\u043e\u0441\u0442\u0443\u044e\u00bb \u2014 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 cron \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u043e<\/h4>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438: \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u044d\u0442\u0430\u043f \u0437\u0430\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0436\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 cron.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f: \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043c\u043e\u0436\u0435\u0442 \u00ab\u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c\u00bb, \u043d\u0435 \u0434\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u0441\u0430\u043c\u043e\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f: \u0435\u0441\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\/\u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u0438\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043e\u043d \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<div class=\"floating-image\">\n<figure class=\"float\"><\/figure>\n<p><strong>\u0418\u0433\u0440\u043e\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043a\u0440\u0438\u043f\u0435\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u0440\u0442\u0430\u043b\u043e\u043c \u0432 \u041d\u0435\u0437\u0435\u0440.\u00a0<\/strong>\u0414\u043e\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u043c\u0438\u0440 Selectel \u0432 Minecraft \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0437\u044b.<\/p>\n<p><a href=\"https:\/\/promo.selectel.ru\/minecraft\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=minecraft_article_scan2_170725_banner_092_02_ord\" rel=\"noopener noreferrer nofollow\"><code><strong>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u2192<\/strong><\/code><\/a><\/p>\n<\/div>\n<h2>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 v2.0<\/h2>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0438\u0434\u0435\u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<ul>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (IP\/net), \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043e\u0442\u0434\u0435\u043b \u0438\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u043e\u0441\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 netscan, vulnscan \u0438 \u043e\u0442\u0447\u0435\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u0439\u043d\u043e\u0441\u0442\u044c: netscan \u2192 vulnscan \u2192 report. \u0412\u0441\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0444\u043b\u0430\u0433\u0430 \u0438 JSON-\u0444\u0430\u0439\u043b\u0430, \u044d\u0442\u0430\u043f\u044b \u0438\u0434\u0443\u0442 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0447\u0435\u0440\u0435\u0437 at, \u0430 \u043d\u0435 cron.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d JSON-\u0444\u0430\u0439\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435: ID, \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441, \u0441\u0442\u0430\u0442\u0443\u0441\u044b. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0424\u043b\u0430\u0433 done \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432: cron \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0445\u043e\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441, \u043d\u043e \u043b\u0438\u0448\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0436\u0435\u0441\u0442\u043a\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 SQL-\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 v2.0 \u2014 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/h4>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u0433\u0438\u0431\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0447\u0435\u0440\u0435\u0437 cron. \u0421\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0440\u0430\u0437, \u043d\u043e \u0446\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0434\u0438\u043d\u043e\u0436\u0434\u044b \u0432 \u043c\u0435\u0441\u044f\u0446 \u2014 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043e\u0442\u0447\u0435\u0442\u044b. \u042d\u0442\u043e \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0438 \u0430\u043a\u0442\u0438\u0432\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u00ab\u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u00bb, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u0430\u0434\u0430\u0447 \u0438 \u0441\u043a\u0430\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">def main():     original_data = load_json(client_list_file)     yyyymm = get_current_yyyymm()     # 1. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0444\u043b\u0430\u0433 done \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c     if isinstance(original_data, dict) and original_data.get(\"done\") and original_data.get(\"month\") == yyyymm:         print(\"Pipeline \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u044f\u0446\u0435. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.\")         return     # 2. \u0421\u0442\u0430\u0434\u0438\u044f (netscan\/vulnscan\/report) \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f     if isinstance(original_data, dict) and \"stage\" in original_data:         stage = original_data[\"stage\"]         orig_clients = original_data.get(\"original_clients\", [])         clients = original_data.get(\"clients\", [])     else:         stage = \"netscan\"         orig_clients = list(original_data)         clients = list(original_data)     # 3. \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0437\u0430\u043f\u0443\u0441\u043a     groups = group_clients_by_name(clients)     auth_cookies = authorization()     base_update(auth_cookies)<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0435\u0442\u0435\u0439 \u0438 IP<\/h4>\n<p>\u0412 \u0432\u0435\u0440\u0441\u0438\u0438 1.0 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u043c\u0435\u043b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c:<\/p>\n<pre><code class=\"python\">for client in clients:     if \"ip\" in client:     # \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c     # \u0415\u0441\u043b\u0438 net \u2014 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438<\/code><\/pre>\n<p>\u0412 \u0432\u0435\u0440\u0441\u0438\u0438 2.0 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439 (net). \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0438\u043d\u0433\u0443\u0435\u0442 \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u00ab\u0436\u0438\u0432\u044b\u0435\u00bb:<\/p>\n<pre><code class=\"python\">def get_alive_ips(network):     net = ipaddress.ip_network(network, strict=False)     alive = []     for ip in net.hosts():         ip_str = str(ip)         try:             result = subprocess.run(['ping', '-c', '1', '-W', '1', ip_str],                                     stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)             if result.returncode == 0:                 alive.append(ip_str)         except Exception:             continue     return alive<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 (name). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">def group_clients_by_name(clients):     groups = {}     for client in clients:         name = client[\"name\"]         if name not in groups:             groups[name] = {\"name\": name, \"ips\": [], \"ids\": [], \"assets\": []}         if \"ip\" in client:             groups[name][\"ips\"].append(client[\"ip\"])             groups[name][\"ids\"].append(client[\"id\"])         elif \"net\" in client:             alive_ips = get_alive_ips(client[\"net\"])             groups[name][\"ips\"].extend(alive_ips)             groups[name][\"ids\"].append(client[\"id\"])     return groups<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043f\u043e\u0434\u0441\u0435\u0442\u044c (net), \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0430\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0435\u0435 \u043d\u0430 IP, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c ID \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u2014 \u043f\u043e \u0441\u0443\u0442\u0438, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 IP \u0438\u0437 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0447\u0442\u043e \u0438 \u0443 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0435\u0442\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/blockquote>\n<h4>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e name<\/h4>\n<p><strong>v1.0<\/strong>: \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e IP. \u041e\u0434\u0438\u043d \u0430\u0434\u0440\u0435\u0441 \u2014 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u0441\u043f\u0430\u043c\u0443 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438: \u0441\u043a\u0430\u043d\u0435\u0440 \u043c\u043e\u0433 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438: \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c \u0434\u0435\u0441\u044f\u0442\u043a\u0438.<\/p>\n<p><strong>v2.0:<\/strong> \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043e\u0442\u0434\u0435\u043b\u0443, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u043a\u0430\u043d\u0435\u0440, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0430\u043d\u043e\u0432:<\/p>\n<pre><code class=\"python\">for name, group in groups.items():     if not group.get(\"id_netscan\"):         task_id = add_netscan_task(auth_cookies, name, group[\"ips\"])         if task_id:             group[\"id_netscan\"] = task_id<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u0447, \u043f\u0440\u043e\u0449\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h4>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0430\u043f\u0430\u043c\u0438<\/h4>\n<p><strong>v1.0:<\/strong> \u0442\u0435\u0441\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u043a\u0430 \u0441 cron, \u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u2014 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e. \u0415\u0441\u043b\u0438 netscan \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u2014 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0437\u0430 10 \u043c\u0438\u043d\u0443\u0442, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0435\u0449\u0435 \u0448\u0435\u0441\u0442\u044c \u0447\u0430\u0441\u043e\u0432.<\/p>\n<p>\u0412 <strong>v2.0<\/strong> \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0441\u0430\u043c \u00ab\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u00bb \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e:<\/p>\n<pre><code class=\"python\">def schedule_next_run(delay_seconds=120):     cmd = f'echo \"python3 {os.path.abspath(__file__)} --clientlist {client_list_file}\" | at now + {delay_seconds\/\/60} minutes'     subprocess.run(cmd, shell=True)<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433:<\/strong> \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<h4>\u0424\u043b\u0430\u0433 done \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432<\/h4>\n<p><strong>v1.0: <\/strong>\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0447\u0430\u044f\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p><strong>v2.0: <\/strong>\u0432 \u0444\u0430\u0439\u043b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0435\u0441\u044f\u0446<em>. <\/em>\u0412\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 cron-\u0437\u0430\u043f\u0443\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0441\u044f\u0446\u0430:<\/p>\n<pre><code class=\"python\">{\"done\": true, \"month\": \"202507\"}<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u0432, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<h4>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h4>\n<p><strong>v1.0: <\/strong>API-\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p><strong>v2.0: <\/strong>\u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f SQL-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u00ab\u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0435\u00bb \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"python\">def force_delete_all_assets_psql():     cmd = [         \"psql\",         \"postgres:\/\/scannervs:scannervs@localhost:5435\/scanner-asset\",         \"-c\",         \"DELETE FROM scanner.assets\"     ]     subprocess.run(cmd, ...)<\/code><\/pre>\n<p><strong>\u0418\u0442\u043e\u0433<\/strong>: \u0431\u0430\u0437\u0430 \u043d\u0435 \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442\u0441\u044f, \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0435 \u0432\u0438\u0441\u044f\u0442 \u00ab\u0433\u0440\u0443\u0437\u043e\u043c\u00bb.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430: cron + at<\/h4>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 cron \u0434\u043b\u044f \u00ab\u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u043c\u0435\u0441\u044f\u0446\u0430\u00bb, \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0441\u0442\u0430\u0440\u0442\u043e\u0432 \u0432 \u0441\u0443\u0442\u043a\u0438 (\u043a\u0430\u0436\u0434\u044b\u0435 \u0448\u0435\u0441\u0442\u044c \u0447\u0430\u0441\u043e\u0432) \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0445 \u0434\u043d\u0435\u0439 \u043f\u043e\u0434\u0440\u044f\u0434:<\/p>\n<pre><code class=\"bash\">0 1,9,15,21 2,3,4 7 * python3 \/way\/to\/script.py --clientlist \/way\/to\/clientlist.json &gt;&gt; \/way\/to\/scan1.log 2&gt;&amp;1<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 20 \u0447\u0430\u0441\u043e\u0432, cron \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0445\u043e\u0442\u044c 12 \u0440\u0430\u0437 \u2014 \u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 <code>at<\/code>.<\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438 \u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 v2.0<\/h2>\n<p>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0440\u0443\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: \u043e\u0434\u0438\u043d JSON \u0438 cron \u2014 \u0432\u0441\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e JSON, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e.<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: IP \u0438 \u0441\u0435\u0442\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u0442\u043e\u0447\u0435\u0447\u043d\u043e, \u0442\u0430\u043a \u0438 \u043c\u0430\u0441\u0441\u043e\u0432\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432. \u0412\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 JSON, \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f <\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-467615","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467615","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=467615"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467615\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=467615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=467615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=467615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}