0
양말 프록시로 구성된 양말 프록시 (SecureCRT 또는 퍼티)가있는 paramiko를 사용하려고합니다. 나는 그것이 모두 에 대한 127.0.0.1을 사용하고 있기 때문에 paramiko을 혼동 내가양말 프록시가있는 paramiko 사용
위의 접근 방식을 얻고 오류를 아래 코드와 여기에
import paramiko,socks
host, port = '127.0.0.1', 1080
# Set up your proxy information for this socket
sock=socks.socksocket()
sock.set_proxy(
proxy_type=socks.SOCKS4,
addr=host,
port=port,
)
# Connect the socket
sock.connect((host, port))
# Create your Paramiko Transport
transport = paramiko.Transport(sock)
transport.connect(
username='username', #<------not sure if it is needed, the socks proxy needs no username/password
password='secret',
)
client = paramiko.client.SSHClient.connect('remotedevice', username='usernameonremotedevice',sock=sock)
stdin, stdout, stderr=client.exec_command("ls -la")
# Do stuff
# Clean up
client.close()
transport.close()
을 보인다되어 사용하고 내 문제는 paramiko 라이브러리에서 유래 나는이 일하는 것이 있는지 확인하기 위해 단순화하고 싶었다 그래서이있는 SecureCRT는 각 시도
[LOCAL] : Starting port forward from 127.0.0.1 on local 127.0.0.1:1080 to remote 127.0.0.1:1080.
[LOCAL] : Could not start port forwarding from local service 127.0.0.1:3106 to 127.0.0.1:1080. Reason: The channel could not be opened because the connection failed. Server error details: Connection refused
,536,913으로 표시하는 로그입니다
.... exscript에 의해 사용 63,210
스크립트는 다음과 같이 실패
Traceback (most recent call last):
File "C:\Users\Username\Documents\Eclipse\ESNetworkDiscovery\ParamikoProxyTest.py", line 24, in <module>
sock.connect((host, port))
File "C:\Utils\WPy2.7-32\python-2.7.13\lib\site-packages\socks.py", line 96, in wrapper
return function(*args, **kwargs)
File "C:\Utils\WPy2.7-32\python-2.7.13\lib\site-packages\socks.py", line 813, in connect
negotiate(self, dest_addr, dest_port)
File "C:\Utils\WPy2.7-32\python-2.7.13\lib\site-packages\socks.py", line 667, in _negotiate_SOCKS4
raise SOCKS4Error("{0:#04x}: {1}".format(status, error))
socks.SOCKS4Error: 0x5b: Request rejected or failed
어떻게'sock'을 얻을 수 있었습니까? –
에 관련 수입이 추가되었으며 sock = socks.socksocket() – MiniMe