LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-23-2010, 07:35 AM   #1
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Rep: Reputation: 33
Python related: How to access a Perl script behind a firewall from Python?


Hello,


I have a Perl script behind a firewall. I want to access this script from Python on Google App Engine.

I have access to the server running the Perl script via the following methods:
  1. SSH
  2. VPN

What are the ways I can do this with Python on GAE? Can I use something like wget, login through ssh and run the script using perl interpreter?

Currently it is a CGI script that I can access through a web browser if I'm inside the firewall.

My only other option is to turn the process around, i.e. have perl send data outside the firewall to google app engine. But I want to know if this is possible as it is now without changing the perl script.


Thanks for any help,

Last edited by vxc69; 11-23-2010 at 07:37 AM.
 
Old 11-24-2010, 08:51 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by vxc69 View Post
Hello,


I have a Perl script behind a firewall. I want to access this script from Python on Google App Engine.

I have access to the server running the Perl script via the following methods:
  1. SSH
  2. VPN

What are the ways I can do this with Python on GAE? Can I use something like wget, login through ssh and run the script using perl interpreter?

Currently it is a CGI script that I can access through a web browser if I'm inside the firewall.

My only other option is to turn the process around, i.e. have perl send data outside the firewall to google app engine. But I want to know if this is possible as it is now without changing the perl script.


Thanks for any help,
I'm not getting how 'wget' is related to 'ssh' in this case and why you need 'wget' in the first place.
 
Old 11-24-2010, 07:24 PM   #3
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Original Poster
Rep: Reputation: 33
I was wondering if it was possible to do it with wget or something similar. Anyway, we're taking the alternative route, make our perl script push data onto GAE from inside the firewall.

Thanks for replying.
 
Old 11-25-2010, 01:29 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by vxc69 View Post
I was wondering if it was possible to do it with wget or something similar. Anyway, we're taking the alternative route, make our perl script push data onto GAE from inside the firewall.

Thanks for replying.

I do not know what GAE is; 'wget' is a utility to get (i.e. download) file/directories over network, so, again, what does 'wget' have to do with remote execution - this what the thread is about - you need to execute a (Perl) program on remote machine.

So, do you know how to execute, say, 'cd /some/remote/dir; /bin/ls -ltr' on your remote machine ? The answer to this question (if we are talking about interactive shell) is in the very first 9 lines of 'man ssh'.

If you know how to execute the above '/bin/ls', you essentially know how to execute the Perl script in question - at the moment a Perl script has 'x' permission and has as its first line

Code:
#!/usr/bin/perl
# make sure the above path is correct
, it can be invoked as any other executable file, i.e. it really doesn't matter that it's originally written in Perl.

...

P.S. I am not a Python guy; so far I do not see anything Perl/Python specific in the question/issue.
 
Old 11-26-2010, 06:24 PM   #5
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Original Poster
Rep: Reputation: 33
I don't think you understood my question. The problem was there is a CGI script on a server behind a firewall. People outside the firewall cannot execute the script. And executing this script from outside the firewall is exactly what I wanted to do from python, using an HTTP post.

Since I have access to this server through SSH and VPN, I was wondering how I could tunnel in and then execute the script and get back the results.

I was giving as an example a tool LIKE wget, whether such a tool can carry out such a task, and if anyone knows of such a tool, not wget exactly. I should have left that bit out from my question.

It doesn't matter now, since we modified the perl script to send data out of the firewall. Of course, solutions to the original problem are still welcome.

GAE is google app engine.


Thanks for your replies.

Last edited by vxc69; 11-26-2010 at 09:13 PM.
 
Old 11-27-2010, 04:01 AM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by vxc69 View Post
...
Since I have access to this server through SSH and VPN, I was wondering how I could tunnel in and then execute the script and get back the results.
...
The "I have access to this server through SSH and VPN" is the answer to your original question - establish a VPN and SSH connection from your Python script and then execute whatever you want. I.e. I do not see a problem in the first place - if you can do something with your fingers and keyboard, you can do the same thing from a program.
 
Old 12-05-2010, 02:05 PM   #7
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 385

Original Poster
Rep: Reputation: 33
That's is the question then. Tips to "establish a VPN or SSH connection" from python.
 
Old 12-05-2010, 03:25 PM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by vxc69 View Post
That's is the question then. Tips to "establish a VPN or SSH connection" from python.
I definitely know there are SSH modules for Perl ( http://search.cpan.org/~turnstep/Net...et/SSH/Perl.pm , http://search.cpan.org/~bnegrao/Net-...SSH/Expect.pod , etc), so most likely there are similar for Python. Even if there is none, 'system' (whatever it's called in Python) still exists.
 
Old 12-14-2010, 07:32 AM   #9
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 230Reputation: 230Reputation: 230
These are friendly suggestions, NOT moderation.

vxc69,

In your OP:

"... Python on Google App Engine (GAE)." instead of "... Python on Google App Engine." would have avoided confusion. I was able to figure out what you meant further down, but only after going back to the beginning.

"something similar to wget" or "something similar to, but necessarily, wget" instead of "something like wget" would have been clearer.

And of course I have the benefit of 20-20 hindsight in making these suggestions.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
[SOLVED] Need Python or Perl script to create a default web page on hosting site chilali Linux - Server 2 08-03-2009 05:41 AM
perl script call python -linux cdd Programming 3 05-04-2007 03:08 PM
perl script call python -linux cdd Linux - Software 1 05-03-2007 03:45 PM


All times are GMT -5. The time now is 06:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration