LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-31-2014, 05:50 PM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How to run an script and its commands via proxy?


Hi,

i used this tutorial which tells me to use following example command to proxify traffic from my linux

Code:
export {http,https,ftp}_proxy=122.228.156.126:80
when i do this command from command line it works and then i curl http://site/ipcheck.php i see its proxified, which is what i want to achieve.

BUT, i have bash script in which i execute that command.. but from mentioned bash script im then executing another perl script and I want to ask how to make sure commands in that perl script goes via proxy too, without editting that perl script.

Because i see that the traffic initiated by that perl script not goes via proxy

thank you

Last edited by postcd; 03-31-2014 at 05:53 PM.
 
Old 04-01-2014, 01:41 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
that depends on those commands. Would be nice to show us that script (or a relevant part). Actually those variables {http,https,ftp}_proxy are not understood in general, but used by some apps like curl.
 
Old 04-04-2014, 02:45 PM   #3
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
thx, this is the perl script: http://pastebin.com/FXm4HAgU
 
Old 04-05-2014, 10:38 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
actually it is a perl script, not a bash. it uses direct connection, it will not use those setting. You need to modify this script to handle proxy settings.
 
Old 04-06-2014, 09:25 AM   #5
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
How exactly i can modiffy its main function to run thru proxy? Please can you or anyone link to example, or how to run whole perl script thru proxy?
 
Old 04-07-2014, 12:24 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
looks like you need to rewrite the whole script using LWP or similar (there is no main function).
the other way can be to direct the host to go thru proxy, but I do not know your environment, therefore cannot suggest any solution
 
Old 04-08-2014, 02:51 AM   #7
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
the other way can be to direct the host to go thru proxy, but I do not know your environment, therefore cannot suggest any solution
I have Redhat 5.x , but i can use it on Ubuntu or any other you know solution for. Please if you know any solution you talking about for any OS, please just share it if u can.
 
Old 04-08-2014, 03:00 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
You missed: you need another host to act as proxy and you need to send network traffic to that host
 
Old 04-09-2014, 01:19 PM   #9
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Lightbulb

Yes, i already have another host which i want to use as a proxy (i have open port there for proxy purpose open only to my IP....
 
  


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
[SOLVED] Script to SSHand run some commands getraj.12 Linux - Server 4 11-01-2012 08:20 AM
script needs su commands but is run by user mervclel Solaris / OpenSolaris 4 11-24-2010 09:18 PM
Write a script to run several commands ??? wahaha Linux - Software 1 04-13-2007 08:20 PM
Creating a script to run two commands anjaan Programming 11 06-15-2004 02:51 AM
run 2 commands in a script ddpicard Linux - General 10 06-13-2003 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration