Created
April 17, 2014 23:53
-
-
Save zmc/11017829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import base64 | |
import subprocess | |
from teuthology.orchestra.connection import paramiko | |
from teuthology.orchestra.remote import Remote | |
bad_file_name = '/tmp/monmap.bad' | |
hostname = subprocess.Popen('hostname', stdout=subprocess.PIPE)\ | |
.stdout.read().strip() | |
payload_64 = "AwPPAQAAQI2cVYjRQbCFPRWK4PPnBwAAAAADAAAAAQAAAGEAAAAAAAAAAAACGoUK1opHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAGIAAAAAAAAAAAACGoUK1opEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAGMAAAAAAAAAAAACGoYK1opHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfR5QUxiAwAZ9HlBTGIDABg==" # noqa | |
payload = base64.b64decode(payload_64) | |
with file(bad_file_name, 'w') as bad_file: | |
bad_file.write(payload) | |
remote = Remote(hostname) | |
conn = remote.connect() | |
transport = conn.get_transport() | |
sftp = paramiko.SFTPClient.from_transport(transport) | |
print "Using paramiko.SFTPClient to transfer file" | |
with sftp.open(bad_file_name, 'rb') as bad_file_sftp: | |
result = bad_file_sftp.read() | |
print "Got file. Comparing with original..." | |
if result == payload: | |
print "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment