最初版本
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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)
|
||||
|
||||
cmd = r"""
|
||||
rm -f /tmp/gc.jar /tmp/g.html
|
||||
curl -s -c /tmp/gc.jar http://127.0.0.1:7777/guest-customer-service -o /tmp/g.html
|
||||
csrf=$(python3 -c "import re; print(re.search(r'\"csrf_token\":\s*\"([^\"]+)\"', open('/tmp/g.html').read()).group(1))")
|
||||
echo csrf=${csrf:0:20}...
|
||||
curl -s -b /tmp/gc.jar -c /tmp/gc.jar -X POST http://127.0.0.1:7777/guest-chat/new \
|
||||
-H "Content-Type: application/json" -H "X-CSRF-Token: $csrf" -d '{}'
|
||||
echo
|
||||
"""
|
||||
|
||||
_, o, e = c.exec_command(cmd, timeout=60)
|
||||
print(o.read().decode())
|
||||
print(e.read().decode())
|
||||
c.close()
|
||||
Reference in New Issue
Block a user