I have this command:
ssh 111.222.333.444 curl -s -k https://123.456.789.876:4567/mock.crt -o /root/mock.crt
I'd like to include it, or the equivalent of it, in a Python application I'm writing. I think I need to use a combination of requests and paramiko to achieve this. So far I'vew come up with this:
def add_certs(self):
ssh = paramiko.SSHClient()
ssh.connect(111.222.333.444)
url = 'https://123.456.789.876:4567/mock.crt'
res = ssh.requests.get(url, verify=False)
print("Add mock server certs: " + res.json())
I haven't had a chance to run this yet as the server is currently unavailable. I still haven't got the output writing to file, rather than stdout. How do I do this? Also, if there is anything wronw with the way I'm trying to do this I'd appreciate the feedback.