最初版本
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
import paramiko
|
||||
|
||||
pw = os.environ["DEPLOY_PASSWORD"]
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("20.191.152.26", username="wakka", password=pw, timeout=30)
|
||||
|
||||
cmds = [
|
||||
"curl -s -H Metadata:true 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' -d 'grant_type=client_credentials' 2>&1 | head -c 300",
|
||||
"curl -s -H Metadata:true 'http://169.254.169.254/metadata/instance/compute/subscriptionId?api-version=2021-02-01&format=text'",
|
||||
]
|
||||
|
||||
for cmd in cmds:
|
||||
print("===", cmd[:80])
|
||||
_, o, e = c.exec_command(cmd, timeout=20)
|
||||
print(o.read().decode()[:500])
|
||||
print(e.read().decode()[:200])
|
||||
|
||||
c.close()
|
||||
Reference in New Issue
Block a user