473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

I want to practice by scripting a reverse ssh tunnel in python

3
I've checked out quite a few web tutorials on Python and have bought a few books. I've got a lot of the basics down now but feel very limited because I've got difficulties figuring out how to do things without seeing how a more experienced programmer would get started solving a problem.

I often have to remotely ssh into a friend's ibook but his ISP blocks ssh. This means I've got to talk him through setting up a reverse ssh tunnel from his ibook to mine and this often frustrates both of us.

I'd like to write a Python script that will setup this tunnel when he double clicks it. What do I use to start ssh in a script? Do I use popen? the subprocess module? Trying to figure out how to start is very frustrating and I'd appreciate pointers.

BTW, I'm running OS X and Linux and Python 2.3, 2.4 and 2.5
Mar 4 '07 #1
1 3291
ghostdog74
511 Expert 256MB
I've checked out quite a few web tutorials on Python and have bought a few books. I've got a lot of the basics down now but feel very limited because I've got difficulties figuring out how to do things without seeing how a more experienced programmer would get started solving a problem.

I often have to remotely ssh into a friend's ibook but his ISP blocks ssh. This means I've got to talk him through setting up a reverse ssh tunnel from his ibook to mine and this often frustrates both of us.

I'd like to write a Python script that will setup this tunnel when he double clicks it. What do I use to start ssh in a script? Do I use popen? the subprocess module? Trying to figure out how to start is very frustrating and I'd appreciate pointers.

BTW, I'm running OS X and Linux and Python 2.3, 2.4 and 2.5
i assume you are using ssh command on you linux machines. usually how do you connect? its something like this right?
Expand|Select|Wrap|Line Numbers
  1. $ ssh -nNT -R 1000:local:1000 remote
  2.  
you can either put this command in a shell script (since you are working with linux) or you can do a python script like you have said. but use os.popen() or os.system() or subprocess modules or this.
Mar 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

59
by: Raymond Hettinger | last post by:
Please comment on the new PEP for reverse iteration methods. Basically, the idea looks like this: for i in xrange(10).iter_backwards(): # 9,8,7,6,5,4,3,2,1,0 <do something with i> The...
50
by: Edward K. Ream | last post by:
I would like to say a few (actually more than a few) words here about some recent discoveries I have made concerning the interaction of Leo and Python. If you don't want to hear an inventor enthuse...
41
by: Richard James | last post by:
Are we looking at the scripting world through Python colored glasses? Has Python development been sleeping while the world of scripting languages has passed us Pythonista's by? On Saturday...
33
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting...
6
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database...
0
by: Yves Glodt | last post by:
(I asked about this several times in the twisted list but never got an answer, maybe here I'll more happy...) Hi, I'm new to conch and I wonder if somebody could point me to an example of how...
12
by: Claudio Grondi | last post by:
I have just discovered the existance of Puppy Linux which is a complete operating system with a suite of GUI apps, only about 50 - 60M booting directly off the CDROM ( http://www.puppylinux.org...
3
by: heavydada | last post by:
I'm writing a small game in python and I need to be able to run some scripts inside the game. In the game I have these creatures each with some attributes like name and weight and an action. Right...
41
by: rick | last post by:
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x Ruby: x = 'a_string' # Reverse the string
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.