Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
SSH using SOCKS ProxyDemonstrates how to connect to an SSH server through a SOCKS4 or SOCKS5 proxy.
CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @sTmp0 nvarchar(4000) DECLARE @ssh int EXEC @hr = sp_OACreate 'Chilkat.Ssh', @ssh OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int -- Unlock the SSH component: EXEC sp_OAMethod @ssh, 'UnlockComponent', @success OUT, 'Anything for 30-day trial.' IF @success <> 1 BEGIN EXEC sp_OAGetProperty @ssh, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END -- To use a SOCKS4 or SOCKS5 proxy, simply set the following -- properties prior to connecting: -- The SOCKS hostname may be a domain name or -- IP address: EXEC sp_OASetProperty @ssh, 'SocksHostname', 'www.mysocksproxyserver.com' EXEC sp_OASetProperty @ssh, 'SocksPort', 1080 EXEC sp_OASetProperty @ssh, 'SocksUsername', 'myProxyLogin' EXEC sp_OASetProperty @ssh, 'SocksPassword', 'myProxyPassword' -- Set the SOCKS version to 4 or 5 based on the version -- of the SOCKS proxy server: EXEC sp_OASetProperty @ssh, 'SocksVersion', 5 -- Note: SOCKS4 servers only support usernames without passwords. -- SOCKS5 servers support full login/password authentication. -- Connect to an SSH server via a SOCKS proxy: DECLARE @hostname nvarchar(4000) DECLARE @port int -- Hostname may be an IP address or hostname: SELECT @hostname = '192.168.1.108' SELECT @port = 22 EXEC sp_OAMethod @ssh, 'Connect', @success OUT, @hostname, @port IF @success <> 1 BEGIN EXEC sp_OAGetProperty @ssh, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END -- Your application is now connected to an SSH server -- through a SOCKS4 or SOCKS5 proxy. -- ... END GO |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.