{"id":39078,"date":"2025-05-22T07:13:43","date_gmt":"2025-05-21T23:13:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/39078.html"},"modified":"2025-05-22T07:13:43","modified_gmt":"2025-05-21T23:13:43","slug":"python-paramiko%e4%b8%8a%e4%bc%a0%e6%96%87%e4%bb%b6%e5%88%b0win-ser2022%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%92%8c%e5%8f%8d%e5%90%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/39078.html","title":{"rendered":"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411"},"content":{"rendered":"<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"816\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231340-682e5e2428b73.png\" width=\"1357\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"603\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231340-682e5e24861d3.png\" width=\"1321\" \/><\/p>\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"808\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231340-682e5e24c6b83.png\" width=\"1359\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"979\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231341-682e5e2527de9.png\" width=\"1347\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1084\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231341-682e5e2589fbc.png\" width=\"1372\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1062\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231342-682e5e26012bf.png\" width=\"1384\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"697\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231342-682e5e266b743.png\" width=\"1353\" \/><\/p>\n<p>\u5728\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684powershell\u6587\u4ef6\u7528\u4e8e\u6253\u5f00\u9632\u706b\u5899\u89c4\u5219\u548c\u6253\u5f00ssh\u8fde\u63a5<\/p>\n<\/p>\n<p># \u68c0\u67e5\u662f\u5426\u5b58\u5728\u5141\u8bb8TCP 22\u7aef\u53e3\u7684\u9632\u706b\u5899\u89c4\u5219 $firewallRuleName &#061; &#034;OpenSSH-Server-In-TCP&#034; $rule &#061; Get-NetFirewallRule -Name $firewallRuleName -ErrorAction SilentlyContinue<\/p>\n<p>if ($null -eq $rule) { \u00a0 \u00a0 Write-Output &#034;\u672a\u627e\u5230\u5141\u8bb8SSH\u8fde\u63a5\u7684\u9632\u706b\u5899\u89c4\u5219&#xff0c;\u6b63\u5728\u521b\u5efa&#8230;&#034; \u00a0 \u00a0 # \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5165\u7ad9\u89c4\u5219\u6765\u5141\u8bb8TCP 22\u7aef\u53e3\u7684\u6d41\u91cf \u00a0 \u00a0 New-NetFirewallRule -Name $firewallRuleName &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -DisplayName &#039;OpenSSH Server (sshd)&#039; &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -Enabled True &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -Direction Inbound &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -Protocol TCP &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -Action Allow &#096; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 -LocalPort 22 \u00a0 \u00a0 Write-Output &#034;\u9632\u706b\u5899\u89c4\u5219\u521b\u5efa\u6210\u529f\u3002&#034; } else { \u00a0 \u00a0 Write-Output &#034;\u5df2\u5b58\u5728\u5141\u8bb8SSH\u8fde\u63a5\u7684\u9632\u706b\u5899\u89c4\u5219\u3002&#034; }<\/p>\n<p># \u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5 OpenSSH \u670d\u52a1\u5668 $openSshCapability &#061; Get-WindowsCapability -Online | Where-Object Name -like &#039;OpenSSH.Server*&#039;<\/p>\n<p>if ($null -eq $openSshCapability -or $openSshCapability.State -ne &#039;Installed&#039;) { \u00a0 \u00a0 Write-Output &#034;OpenSSH \u670d\u52a1\u5668\u672a\u5b89\u88c5\u6216\u72b6\u6001\u4e0d\u6b63\u786e&#xff0c;\u6b63\u5728\u5c1d\u8bd5\u5b89\u88c5&#8230;&#034; \u00a0 \u00a0 Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 } else { \u00a0 \u00a0 Write-Output &#034;OpenSSH \u670d\u52a1\u5668\u5df2\u5b89\u88c5&#034; }<\/p>\n<p># \u786e\u4fddOpenSSH\u670d\u52a1\u6b63\u5728\u8fd0\u884c $service &#061; Get-Service -Name sshd if ($service.Status -ne &#039;Running&#039;) { \u00a0 \u00a0 if ($service.Status -eq &#039;Stopped&#039;) { \u00a0 \u00a0 \u00a0 \u00a0 Write-Output &#034;sshd\u670d\u52a1\u672a\u8fd0\u884c&#xff0c;\u6b63\u5728\u542f\u52a8&#8230;&#034; \u00a0 \u00a0 \u00a0 \u00a0 Start-Service sshd \u00a0 \u00a0 \u00a0 \u00a0 Set-Service -Name sshd -StartupType &#039;Automatic&#039; \u00a0 \u00a0 } else { \u00a0 \u00a0 \u00a0 \u00a0 Write-Warning &#034;sshd\u670d\u52a1\u72b6\u6001\u5f02\u5e38&#xff1a;$($service.Status)&#034; \u00a0 \u00a0 } } else { \u00a0 \u00a0 Write-Output &#034;sshd\u670d\u52a1\u6b63\u5728\u8fd0\u884c\u3002&#034; }<\/p>\n<p># \u8f93\u51fa\u5f53\u524dsshd\u670d\u52a1\u72b6\u6001 Write-Output &#034;\u5f53\u524dsshd\u670d\u52a1\u72b6\u6001&#xff1a;&#034; Get-Service sshd<\/p>\n<p>Write-Output &#034;\u914d\u7f6e\u5b8c\u6210\u3002\u4f60\u73b0\u5728\u5e94\u8be5\u53ef\u4ee5\u901a\u8fc7SSH\u8fdc\u7a0b\u8fde\u63a5\u3002&#034;<\/p>\n<\/p>\n<\/p>\n<p>\u5bf9\u5e94\u7684python\u6587\u4ef6<\/p>\n<p># -*- coding: utf-8 -*-<br \/>\nimport paramiko<br \/>\nimport os<br \/>\nimport subprocess<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n# \u914d\u7f6e SSH \u8fde\u63a5\u4fe1\u606f<br \/>\n# &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\nhostname &#061; &#034;&#034;  # \u8fdc\u7a0b\u670d\u52a1\u5668 IP \u5730\u5740<br \/>\nport &#061; 22<br \/>\nusername &#061; &#034;&#034;  # \u8fdc\u7a0b\u7528\u6237\u540d<br \/>\npassword &#061; &#034;&#034;  # \u767b\u5f55\u5bc6\u7801<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n# \u672c\u5730\u548c\u8fdc\u7a0b\u6587\u4ef6\u8def\u5f84<br \/>\n# &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\nremote_base_dir &#061; r&#034;C:\\\\temp\\\\remote_executable_folder&#034;  # \u8fdc\u7a0b\u76ee\u5f55<br \/>\nremote_exe_name &#061; &#034;hide_test_executable.exe&#034;  # \u8fdc\u7a0b .exe \u6587\u4ef6\u540d<br \/>\nlocal_download_path &#061; r&#034;F:\\\\downloaded_hide_test_executable.exe&#034;  # \u4e0b\u8f7d\u5230\u672c\u5730\u7684\u8def\u5f84<\/p>\n<p># \u521b\u5efa SSH \u5ba2\u6237\u7aef<br \/>\nssh &#061; paramiko.SSHClient()<br \/>\nssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())<\/p>\n<p>try:<br \/>\n    # \u5efa\u7acb\u8fde\u63a5<br \/>\n    ssh.connect(hostname&#061;hostname, port&#061;port, username&#061;username, password&#061;password)<br \/>\n    print(&#034;[&#043;] SSH \u8fde\u63a5\u5df2\u6210\u529f\u5efa\u7acb&#034;)<\/p>\n<p>    # \u6784\u5efa\u8fdc\u7a0b exe \u8def\u5f84<br \/>\n    remote_exe_path &#061; os.path.join(remote_base_dir, remote_exe_name)<\/p>\n<p>    # \u4f7f\u7528 SFTP \u4e0b\u8f7d\u6587\u4ef6<br \/>\n    sftp &#061; ssh.open_sftp()<\/p>\n<p>    try:<br \/>\n        sftp.get(remote_exe_path, local_download_path)<br \/>\n        print(f&#034;[&#043;] \u6587\u4ef6\u5df2\u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u81f3: {local_download_path}&#034;)<br \/>\n    except Exception as e:<br \/>\n        raise Exception(f&#034;\u4e0b\u8f7d\u6587\u4ef6\u65f6\u51fa\u9519: {e}&#034;)<\/p>\n<p>    # \u5173\u95ed SFTP<br \/>\n    sftp.close()<\/p>\n<p>    # &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n    # \u5728\u672c\u5730\u8fd0\u884c\u4e0b\u8f7d\u7684 exe \u6587\u4ef6<br \/>\n    # &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n    print(&#034;[&#043;] \u6b63\u5728\u51c6\u5907\u5728\u672c\u5730\u8fd0\u884c\u4e0b\u8f7d\u7684\u7a0b\u5e8f&#8230;&#034;)<\/p>\n<p>    try:<br \/>\n        result &#061; subprocess.run(local_download_path, check&#061;True, stdout&#061;subprocess.PIPE, stderr&#061;subprocess.PIPE)<br \/>\n        print(&#034;[&#043;] \u6807\u51c6\u8f93\u51fa:&#034;)<br \/>\n        print(result.stdout.decode(&#039;gbk&#039;, errors&#061;&#039;ignore&#039;))<br \/>\n        if result.stderr:<br \/>\n            print(&#034;[-] \u9519\u8bef\u8f93\u51fa:&#034;)<br \/>\n            print(result.stderr.decode(&#039;gbk&#039;, errors&#061;&#039;ignore&#039;))<br \/>\n        print(&#034;[&#043;] \u7a0b\u5e8f\u6267\u884c\u7ed3\u675f&#xff0c;\u9000\u51fa\u72b6\u6001\u7801: 0&#034;)<br \/>\n    except subprocess.CalledProcessError as e:<br \/>\n        print(f&#034;[-] \u7a0b\u5e8f\u6267\u884c\u5931\u8d25&#xff0c;\u9000\u51fa\u72b6\u6001\u7801: {e.returncode}&#034;)<br \/>\n        print(&#034;[-] \u9519\u8bef\u8f93\u51fa:&#034;)<br \/>\n        print(e.stderr.decode(&#039;gbk&#039;, errors&#061;&#039;ignore&#039;))<\/p>\n<p>except FileNotFoundError as fnf_error:<br \/>\n    print(f&#034;[!] \u6587\u4ef6\u9519\u8bef: {fnf_error}&#034;)<br \/>\nexcept paramiko.AuthenticationException:<br \/>\n    print(&#034;[-] \u8ba4\u8bc1\u5931\u8d25&#xff0c;\u8bf7\u68c0\u67e5\u7528\u6237\u540d\u6216\u5bc6\u7801&#034;)<br \/>\nexcept paramiko.SSHException as e:<br \/>\n    print(f&#034;[-] SSH \u8fde\u63a5\u5f02\u5e38: {e}&#034;)<br \/>\nexcept Exception as e:<br \/>\n    print(f&#034;[-] \u53d1\u751f\u4e86\u4e00\u4e2a\u672a\u9884\u6599\u7684\u9519\u8bef: {e}&#034;)<br \/>\nfinally:<br \/>\n    try:<br \/>\n        ssh.close()<br \/>\n        print(&#034;[*] SSH \u8fde\u63a5\u5df2\u5173\u95ed&#034;)<br \/>\n    except:<br \/>\n        pass<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb724\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf11\u6b21\u3002local_download_path = r&quot;F:\\\\downloaded_hide_test_executable.exe&quot;  # \u4e0b\u8f7d\u5230\u672c\u5730\u7684\u8def\u5f84\u3002print(f&quot;[+] \u6587\u4ef6\u5df2\u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u81f3: {local_download_path}&quot;)print(f&quot;[-] \u7a0b\u5e8f\u6267\u884c\u5931\u8d25\uff0c\u9000\u51fa\u72b6\u6001\u7801: {e.returncode}&quot;)print(&quot;[+] \u6b63\u5728\u51c6\u5907\u5728\u672c\u5730\u8fd0\u884c\u4e0b\u8f7d\u7684\u7a0b\u5e8f&#8230;&quot;)print(f&quot;[-] \u53d1\u751f\u4e86\u4e00\u4e2a\u672a\u9884\u6599\u7684\u9519\u8bef: {e}&quot;)print(f&quot;[-] SSH \u8fde\u63a5\u5f02\u5e38: {e}&quot;)<\/p>\n","protected":false},"author":2,"featured_media":39071,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43,44],"topic":[],"class_list":["post-39078","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/39078.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb724\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf11\u6b21\u3002local_download_path = r&quot;F:\\downloaded_hide_test_executable.exe&quot; # \u4e0b\u8f7d\u5230\u672c\u5730\u7684\u8def\u5f84\u3002print(f&quot;[+] \u6587\u4ef6\u5df2\u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u81f3: {local_download_path}&quot;)print(f&quot;[-] \u7a0b\u5e8f\u6267\u884c\u5931\u8d25\uff0c\u9000\u51fa\u72b6\u6001\u7801: {e.returncode}&quot;)print(&quot;[+] \u6b63\u5728\u51c6\u5907\u5728\u672c\u5730\u8fd0\u884c\u4e0b\u8f7d\u7684\u7a0b\u5e8f...&quot;)print(f&quot;[-] \u53d1\u751f\u4e86\u4e00\u4e2a\u672a\u9884\u6599\u7684\u9519\u8bef: {e}&quot;)print(f&quot;[-] SSH \u8fde\u63a5\u5f02\u5e38: {e}&quot;)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/39078.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-21T23:13:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231340-682e5e2428b73.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39078.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/39078.html\",\"name\":\"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-21T23:13:43+00:00\",\"dateModified\":\"2025-05-21T23:13:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/39078.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/39078.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39078.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/39078.html","og_locale":"zh_CN","og_type":"article","og_title":"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb724\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf11\u6b21\u3002local_download_path = r&quot;F:\\downloaded_hide_test_executable.exe&quot; # \u4e0b\u8f7d\u5230\u672c\u5730\u7684\u8def\u5f84\u3002print(f&quot;[+] \u6587\u4ef6\u5df2\u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u81f3: {local_download_path}&quot;)print(f&quot;[-] \u7a0b\u5e8f\u6267\u884c\u5931\u8d25\uff0c\u9000\u51fa\u72b6\u6001\u7801: {e.returncode}&quot;)print(&quot;[+] \u6b63\u5728\u51c6\u5907\u5728\u672c\u5730\u8fd0\u884c\u4e0b\u8f7d\u7684\u7a0b\u5e8f...&quot;)print(f&quot;[-] \u53d1\u751f\u4e86\u4e00\u4e2a\u672a\u9884\u6599\u7684\u9519\u8bef: {e}&quot;)print(f&quot;[-] SSH \u8fde\u63a5\u5f02\u5e38: {e}&quot;)","og_url":"https:\/\/www.wsisp.com\/helps\/39078.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-21T23:13:43+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250521231340-682e5e2428b73.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/39078.html","url":"https:\/\/www.wsisp.com\/helps\/39078.html","name":"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-21T23:13:43+00:00","dateModified":"2025-05-21T23:13:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/39078.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/39078.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/39078.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Python Paramiko\u4e0a\u4f20\u6587\u4ef6\u5230win ser2022\u670d\u52a1\u5668\u548c\u53cd\u5411"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=39078"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39078\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/39071"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=39078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=39078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=39078"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=39078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}