import paramiko, zipfile HOST="192.168.10.157"; USER="yunhai"; PASS="123456" LOCAL = "D:/SoftProject/yunhai/CasSso/cas-overlay-template-5.3/docker/live_cas.war" ssh=paramiko.SSHClient(); ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(HOST, port=22, username=USER, password=PASS, timeout=20) def run(c): i,o,e=ssh.exec_command(c) return o.read().decode('utf-8','ignore') + (("ERR:"+e.read().decode('utf-8','ignore')) if e.read() else "") print(run("docker cp cas-sso:/app/cas.war /tmp/live_cas.war && echo COPIED_OK")) sftp=ssh.open_sftp() sftp.get('/tmp/live_cas.war', LOCAL) sftp.close() print("local war size:", __import__('os').path.getsize(LOCAL)) z=zipfile.ZipFile(LOCAL) c=z.read('WEB-INF/classes/org/apereo/cas/web/custom/controller/LoginController.class').decode('latin1') print("\n=== RUNNING WAR LoginController features ===") print("has window.location.href (v1.8 success):", 'window.location.href' in c) print("has sendRedirect (error path):", 'sendRedirect' in c) print("has text/html (v1.8 success):", 'text/html' in c) idx=z.read('front/index.html').decode('utf-8','replace') print("\n=== RUNNING WAR index.html ===") print("has action=/api/login:", 'action="/api/login"' in idx) print("has ?v=1.8:", '?v=1.8' in idx) print("has name=username:", 'name="username"' in idx) print("\n=== container filesystem: any default-redirect-url? ===") print(run("grep -rni 'default-redirect-url' /etc/cas 2>/dev/null; grep -rni 'default-redirect-url' /app/*.properties 2>/dev/null; echo '---env---'; docker exec cas-sso env 2>/dev/null | grep -i 'REDIRECT\\|TGC\\|CAS_CUSTOM' ")) print("\n=== effective cas.properties (head) ===") print(run("docker exec cas-sso sh -c 'cat /etc/cas/config/cas.properties 2>/dev/null | head -60'")) print("\n=== JDBC url in container ===") print(run("docker exec cas-sso sh -c 'cat /etc/cas/config/cas.properties 2>/dev/null | grep -i jdbc'")) ssh.close()