修复远程调试脚本语法并补充工具检查限制
This commit is contained in:
1 parent
6b009197bc
commit
6c072fd712
3 files changed
+18
-16
No files matched your search
+14
-14
@@ -7,24 +7,24 @@ connect_remote(ssh)
|
||||
|
||||
def run(cmd):
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
return stdout.read().decode(utf-8, errors=ignore), stderr.read().decode(utf-8, errors=ignore)
|
||||
return stdout.read().decode('utf-8', errors='replace'), stderr.read().decode('utf-8', errors='replace')
|
||||
|
||||
out, _ = run(ls -la /opt/smail/log)
|
||||
print(=== /opt/smail/log ===\n + out)
|
||||
out, _ = run('ls -la /opt/smail/log')
|
||||
print('=== /opt/smail/log ===\n' + out)
|
||||
|
||||
out, _ = run(grep -rn 'qq.com' /opt/smail/log/ 2>/dev/null)
|
||||
print(=== qq.com grep in logs ===\n + out)
|
||||
out, _ = run("grep -rn 'qq.com' /opt/smail/log/ 2>/dev/null")
|
||||
print('=== qq.com grep in logs ===\n' + out)
|
||||
|
||||
out, _ = run(sqlite3 /opt/smail/data/smail.db '.schema email')
|
||||
print(=== schema email ===\n + out)
|
||||
out, _ = run("sqlite3 /opt/smail/data/smail.db '.schema email'")
|
||||
print('=== schema email ===\n' + out)
|
||||
|
||||
out, _ = run(sqlite3 /opt/smail/data/smail.db '.schema user_email')
|
||||
print(=== schema user_email ===\n + out)
|
||||
out, _ = run("sqlite3 /opt/smail/data/smail.db '.schema user_email'")
|
||||
print('=== schema user_email ===\n' + out)
|
||||
|
||||
out, _ = run(sqlite3 /opt/smail/data/smail.db 'SELECT id, subject, send_time FROM email ORDER BY id DESC LIMIT 5;')
|
||||
print(=== latest emails ===\n + out)
|
||||
out, _ = run("sqlite3 /opt/smail/data/smail.db 'SELECT id, subject, send_date FROM email ORDER BY id DESC LIMIT 5;'")
|
||||
print('=== latest emails ===\n' + out)
|
||||
|
||||
out, _ = run(sqlite3 /opt/smail/data/smail.db 'SELECT id, user_id, email_id, is_read FROM user_email ORDER BY id DESC LIMIT 5;')
|
||||
print(=== latest user_emails ===\n + out)
|
||||
out, _ = run("sqlite3 /opt/smail/data/smail.db 'SELECT id, user_id, email_id, is_read FROM user_email ORDER BY id DESC LIMIT 5;'")
|
||||
print('=== latest user_emails ===\n' + out)
|
||||
|
||||
ssh.close()
|
||||
ssh.close()
|
||||
@@ -4,6 +4,6 @@ ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
|
||||
from remote_ssh import connect_remote
|
||||
connect_remote(ssh)
|
||||
stdin, stdout, stderr = ssh.exec_command("echo HELLO")
|
||||
print(stdout:, stdout.read().decode())
|
||||
print(stderr:, stderr.read().decode())
|
||||
print('stdout:', stdout.read().decode('utf-8', errors='replace'))
|
||||
print('stderr:', stderr.read().decode('utf-8', errors='replace'))
|
||||
ssh.close()
|
||||
Reference in new issue
Block a user