473,785 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting to an SSH account over a HTTP proxy

I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

--
mvh Björn
Jan 22 '07 #1
10 5814
BJörn Lindqvist wrote:
I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?
Is there anything that can do what you want? Last time I checked there is no
such thing as SSH-over-HTTP. Are you sure that is possible?

Diez
Jan 22 '07 #2
Diez B. Roggisch wrote:
BJörn Lindqvist wrote:
>I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

Is there anything that can do what you want? Last time I checked there is no
such thing as SSH-over-HTTP. Are you sure that is possible?
He's referring to the HTTP CONNECT method, which can tunnel arbitrary
TCP connections, not just HTTP. The IETF draft for this is titled
"Tunneling TCP based protocols through Web proxy servers".

AFAIK, there are no Python modules which support that. The protocol
itself is fairly simply though, so it shouldn't be too hard to write
your own wrapper or proxy for the client side. Things get a little more
complicated if you have to authenticate with the proxy first.

Jan 22 '07 #3
On Mon, 22 Jan 2007 14:40:49 +0100, Diez B. Roggisch <de***@nospam.w eb.dewrote:
BJörn Lindqvist wrote:
>I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

Is there anything that can do what you want? Last time I checked there is no
such thing as SSH-over-HTTP. Are you sure that is possible?
I am pretty sure there is. Or at least TCP-over-HTTP, or IP-over-HTTP. An
acquaintance of mine used it to tonnel home through a corporate firewall. I
think -- I didn't want to know the details.

If you implement in the same way as ssh tunnels, the application doesn't
need to know anything about it -- you just talk to a TCP port on localhost.
Good for everyone involved.

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyn dns.org R'lyeh wgah'nagl fhtagn!
Jan 22 '07 #4

BJörn Lindqvist wrote:
I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

--
mvh Björn
Did you take a look at twisted library?
twistedmatrix.c om
http://twistedmatrix.com/projects/co...o/clients.html
I haven't tried to connect over port 80, but its worth a try.

-N

Jan 23 '07 #5
Am Dienstag, 23. Januar 2007 02:16 schrieb Nanjundi:
BJörn Lindqvist wrote:
I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

--
mvh Björn

Did you take a look at twisted library?
twistedmatrix.c om
http://twistedmatrix.com/projects/co...o/clients.html
I haven't tried to connect over port 80, but its worth a try.

-N
If you need it for automation you might want to use pexpect:
http://pexpect.sourceforge.net/

It listens to the tty-stream and simulates a user typing in commands. It is
very useful, e.g. if you want to start processes on many machines over ssh.
If there are gateways/firewalls between - no problem just use a
second "sendline(' ssh user@nextmachin e')"

The only problem is the regular expression: If e.g. you use a custom $PS1
variable for your prompt you have to account for that.

Regards,
wr
Jan 23 '07 #6
Jorgen Grahn <gr********@sni pabacken.dyndns .orgskriver:
I am pretty sure there is. Or at least TCP-over-HTTP, or IP-over-HTTP. An
acquaintance of mine used it to tonnel home through a corporate firewall. I
think -- I didn't want to know the details.
Ypu can tunnel ip over anything. (Even email if you like...) Nu tunnel
out from that company was based on http-proxy. A small program called
connect (the final version I used was by Shun-ichi Goto and under
GPL.) Bascilly it makes a http-proxt connect to an other site (my sshd)
Then using sshd and pppd as program inte other end makes a good way to
tunnel IP also :-)

/ Anders
--
http://anders.arnholm.nu/ Keep on Balping
Jan 23 '07 #7
use pexpect to set the prompt after the login.

class Login(General):
"""Class spawning an ssh expect instance"""
def __init__(self, user, host, pwd, cfg_name=None, log=None):
if cfg_name:
self.testcell = test_config(cfg _name)
self.spawn = pexpect.spawn(" ssh %s@%s" % (user, host), [], 100)
if log:
self.spawn.logf ile = log
sshreply = self.spawn.expe ct(["Last login", "assword", "connecting "])

if sshreply == 1:
self.spawn.send line(pwd)
self.spawn.expe ct("Last login")
elif sshreply == 2:
time.sleep(0.1)
self.spawn.send line("yes")
print self.spawn.afte r
Login(user, host, cfg_name, log)
time.sleep(1)
self.prompt=pro mpt_chg(self.sp awn, "PROMPT:")
self.spawn.send line("uname -a")
self.spawn.expe ct(self.prompt)
On Jan 23, 10:28 am, Willi Richert <w.rich...@gmx. netwrote:
Am Dienstag, 23. Januar 2007 02:16 schrieb Nanjundi:
BJörn Lindqvist wrote:
I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).
Is there some other Python module that can do what I want?
--
mvh Björn
Did you take a look at twisted library?
twistedmatrix.c om
http://twistedmatrix.com/projects/co...o/clients.html
I haven't tried to connect over port 80, but its worth a try.
-NIf you need it for automation you might want to usepexpect:http://pexpect.sourceforge.net/

It listens to the tty-stream and simulates a user typing in commands. It is
very useful, e.g. if you want to start processes on many machines over ssh.
If there are gateways/firewalls between - no problem just use a
second "sendline(' ssh user@nextmachin e')"

The only problem is the regular expression: If e.g. you use a custom $PS1
variable for your prompt you have to account for that.

Regards,
wr
Jan 24 '07 #8
On 22 Jan 2007 17:16:35 -0800, Nanjundi <na******@gmail .comwrote:
BJörn Lindqvist wrote:
I want to use Python to connect to a SSH account over a HTTP proxy to
automate some operations. I thought paramiko would be able to do that,
but it can not (it seems).

Is there some other Python module that can do what I want?

--
mvh Björn

Did you take a look at twisted library?
twistedmatrix.c om
http://twistedmatrix.com/projects/co...o/clients.html
I haven't tried to connect over port 80, but its worth a try.
I looked at Twisted, but I did not understand how it could solve my
problem. I do not want to create my own SSH client and, AFAICT, there
is no SSH client in Twisted. The library also seem to have some
problems with handling HTTP proxies in a transparent way:
http://twistedmatrix.com/trac/ticket/1774

--
mvh Björn
Jan 25 '07 #9
On 1/22/07, Yu-Xi Lim <yu**@ece.gatec h.eduwrote:
He's referring to the HTTP CONNECT method, which can tunnel arbitrary
TCP connections, not just HTTP. The IETF draft for this is titled
"Tunneling TCP based protocols through Web proxy servers".

AFAIK, there are no Python modules which support that. The protocol
itself is fairly simply though, so it shouldn't be too hard to write
your own wrapper or proxy for the client side. Things get a little more
complicated if you have to authenticate with the proxy first.
The proxy in question requires authentication. Do you mean that I
should be able to write something that handles the communication to
the proxy and then run a library like paramiko "over that"? I have no
idea how to do that.

--
mvh Björn
Jan 25 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3358
by: Chris | last post by:
I've been researching this on and off for weeks, and haven't come up with anything useful yet. If anyone knows how to do this, please let me know. From a Java applet running in IE 6.0 using the Sun J2SE 1.4.2_03 plug-in, I need to retrieve the proxy host and port that will be used to access a specific URL. The site with the client machines is using automated proxy settings (i.e., a ".pac" file) to retrieve the proxy server address and...
8
10016
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
2
2122
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string specifies a local SQL Server Express instance using a...
0
4831
by: Paul Hastings | last post by:
Hi All - I am trying to build a Web Service that can be accessed using an Excel spreadsheet. I have been able to do this for relatively simple access to the Web Service. But now I need to add authentication using a client certificate and that is where I am stuck.
5
3912
by: UJ | last post by:
I had already asked how to get the network settings on the machine and was told that I should use the WMI interface. I downloaded programs that will allow me to look at the stuff but I'm not sure which items are the correct ones to get. Can anybody give me a direction on where I look to figure out how to get/set the IP address, gateway, DNS Server and Proxy Server? When I look in one of the dump programs there is lots of stuff about...
0
1108
by: OldMacDonald | last post by:
I have a Web Service which I call ASynchronously. The problem its not getting kicked off. This is how I am calling it over HTTP and after calling the webservice I have a redirect to another page. I don't know if that is allowed. Here is how I call it on a click of a button. COASTWebService.DeployService proxy = new COASTWebService.DeployService(); IAsyncResult result;
1
3499
by: MRamaLakshmi | last post by:
hi, I am developing an application using Java Applet which will be uploading files. Its throwing Null Pointer exception while detecting the proxy when we are trying to load the applet using Java6. It is working fine for Java5. Here i am giving the piece of code where it is throwing me exception protected void autoDetectProxy(URL url) { // Trying Java system variables.
1
4352
by: JohnH | last post by:
Hi, In my application which has two or more threads calling web service or just HttpWebRequest I am seeing some HTTP 400 errors retrun in the response. All the calls are going through the same ISA proxy the connections to which must be authenticated. The 400 error are comming fron the wed server back through the proxy. When I Sniff the connections I can see that the http message that is causing the issue is one that is part of the...
2
2017
dmjpro
by: dmjpro | last post by:
Here is my code import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Proxy;
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.