Python related: How to access a Perl script behind a firewall from Python?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
SSH
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.
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:
SSH
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.
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.
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.
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.
...
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.
"... 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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.