Help with shell script to test proxy
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I installed an HTTPIE tool on my Linux server to test our proxy for response from sites like google.com and i'm trying to write a script to test if our traffic getting through the proxy or not
For example: I want the script to run the command below and if i get the results including the 200 OK then traffic went through fine and if i don't get response then i want the script to send an email to let me know the command did not return results.
Below is the example and then the first part of the script i wrote and i need help with the rest of the script
# http --proxy=http:http://my_proxy:3128 head www.google.com
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 4622
Content-Type: text/html; charset=ISO-8859-1
Date: Sat, 28 Apr 2018 01:40:13 GMT
Expires: -1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Proxy-Connection: keep-alive
Server: gws
Set-Cookie: 1P_JAR=2018-04-28-01; expires=Mon, 28-May-2018 01:40:13 GMT; path=/; domain=.google.com
Set-Cookie: NID=129=eWFNZlP7mCtJ_zVH7sa6kxTOc9ebMpwLMgUSVnfMA1_bJM2UFfZwly9-BqDSPFI2EaY45t7GhTAte-w783Od3JZ5MGcqmjxT86h8yKdAK1t1qlCm9oexkaYRFgRp64MK; expires=Sun, 28-Oct-2018 01:40:13 GMT; path=/; domain=.google.com; HttpOnly
Via: 1.1 isdsecwsandc2.tch.harvard.edu:3128 (Cisco-WSA/10.5.2-042)
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
So i just want to write a script to run the command above against each proxy IP address and if i get 200 OK back then go to the next one and if it times out then send me an email to let me know
The script is here:
#!/bin/bash
proxy_targets="http://10.5.5.5:3128 http://10.5.5.6:3128 http://10.5.5.7:3128"
failed_hosts=""
for i in $proxy_targets
do
http --proxy=http:$i head www.google.com > /dev/null
ANy help completing the script would be greatly appreciated
linux shell-script scripting rhel
add a comment |Â
up vote
0
down vote
favorite
I installed an HTTPIE tool on my Linux server to test our proxy for response from sites like google.com and i'm trying to write a script to test if our traffic getting through the proxy or not
For example: I want the script to run the command below and if i get the results including the 200 OK then traffic went through fine and if i don't get response then i want the script to send an email to let me know the command did not return results.
Below is the example and then the first part of the script i wrote and i need help with the rest of the script
# http --proxy=http:http://my_proxy:3128 head www.google.com
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 4622
Content-Type: text/html; charset=ISO-8859-1
Date: Sat, 28 Apr 2018 01:40:13 GMT
Expires: -1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Proxy-Connection: keep-alive
Server: gws
Set-Cookie: 1P_JAR=2018-04-28-01; expires=Mon, 28-May-2018 01:40:13 GMT; path=/; domain=.google.com
Set-Cookie: NID=129=eWFNZlP7mCtJ_zVH7sa6kxTOc9ebMpwLMgUSVnfMA1_bJM2UFfZwly9-BqDSPFI2EaY45t7GhTAte-w783Od3JZ5MGcqmjxT86h8yKdAK1t1qlCm9oexkaYRFgRp64MK; expires=Sun, 28-Oct-2018 01:40:13 GMT; path=/; domain=.google.com; HttpOnly
Via: 1.1 isdsecwsandc2.tch.harvard.edu:3128 (Cisco-WSA/10.5.2-042)
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
So i just want to write a script to run the command above against each proxy IP address and if i get 200 OK back then go to the next one and if it times out then send me an email to let me know
The script is here:
#!/bin/bash
proxy_targets="http://10.5.5.5:3128 http://10.5.5.6:3128 http://10.5.5.7:3128"
failed_hosts=""
for i in $proxy_targets
do
http --proxy=http:$i head www.google.com > /dev/null
ANy help completing the script would be greatly appreciated
linux shell-script scripting rhel
man curl
andman wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.
â ivanivan
Apr 28 at 2:34
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
wget
can be redirected to/dev/null
for all output, then check the exit status with$?
being equal to 0 then there are no errors. I don't have a proxy to test against.
â ivanivan
Apr 28 at 3:11
Have you try to exporthttp_proxy
(export http_proxy=10.5.5.5:3128
) variable and test withwget
?
â Romeo Ninov
Apr 28 at 9:04
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I installed an HTTPIE tool on my Linux server to test our proxy for response from sites like google.com and i'm trying to write a script to test if our traffic getting through the proxy or not
For example: I want the script to run the command below and if i get the results including the 200 OK then traffic went through fine and if i don't get response then i want the script to send an email to let me know the command did not return results.
Below is the example and then the first part of the script i wrote and i need help with the rest of the script
# http --proxy=http:http://my_proxy:3128 head www.google.com
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 4622
Content-Type: text/html; charset=ISO-8859-1
Date: Sat, 28 Apr 2018 01:40:13 GMT
Expires: -1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Proxy-Connection: keep-alive
Server: gws
Set-Cookie: 1P_JAR=2018-04-28-01; expires=Mon, 28-May-2018 01:40:13 GMT; path=/; domain=.google.com
Set-Cookie: NID=129=eWFNZlP7mCtJ_zVH7sa6kxTOc9ebMpwLMgUSVnfMA1_bJM2UFfZwly9-BqDSPFI2EaY45t7GhTAte-w783Od3JZ5MGcqmjxT86h8yKdAK1t1qlCm9oexkaYRFgRp64MK; expires=Sun, 28-Oct-2018 01:40:13 GMT; path=/; domain=.google.com; HttpOnly
Via: 1.1 isdsecwsandc2.tch.harvard.edu:3128 (Cisco-WSA/10.5.2-042)
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
So i just want to write a script to run the command above against each proxy IP address and if i get 200 OK back then go to the next one and if it times out then send me an email to let me know
The script is here:
#!/bin/bash
proxy_targets="http://10.5.5.5:3128 http://10.5.5.6:3128 http://10.5.5.7:3128"
failed_hosts=""
for i in $proxy_targets
do
http --proxy=http:$i head www.google.com > /dev/null
ANy help completing the script would be greatly appreciated
linux shell-script scripting rhel
I installed an HTTPIE tool on my Linux server to test our proxy for response from sites like google.com and i'm trying to write a script to test if our traffic getting through the proxy or not
For example: I want the script to run the command below and if i get the results including the 200 OK then traffic went through fine and if i don't get response then i want the script to send an email to let me know the command did not return results.
Below is the example and then the first part of the script i wrote and i need help with the rest of the script
# http --proxy=http:http://my_proxy:3128 head www.google.com
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 4622
Content-Type: text/html; charset=ISO-8859-1
Date: Sat, 28 Apr 2018 01:40:13 GMT
Expires: -1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Proxy-Connection: keep-alive
Server: gws
Set-Cookie: 1P_JAR=2018-04-28-01; expires=Mon, 28-May-2018 01:40:13 GMT; path=/; domain=.google.com
Set-Cookie: NID=129=eWFNZlP7mCtJ_zVH7sa6kxTOc9ebMpwLMgUSVnfMA1_bJM2UFfZwly9-BqDSPFI2EaY45t7GhTAte-w783Od3JZ5MGcqmjxT86h8yKdAK1t1qlCm9oexkaYRFgRp64MK; expires=Sun, 28-Oct-2018 01:40:13 GMT; path=/; domain=.google.com; HttpOnly
Via: 1.1 isdsecwsandc2.tch.harvard.edu:3128 (Cisco-WSA/10.5.2-042)
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
So i just want to write a script to run the command above against each proxy IP address and if i get 200 OK back then go to the next one and if it times out then send me an email to let me know
The script is here:
#!/bin/bash
proxy_targets="http://10.5.5.5:3128 http://10.5.5.6:3128 http://10.5.5.7:3128"
failed_hosts=""
for i in $proxy_targets
do
http --proxy=http:$i head www.google.com > /dev/null
ANy help completing the script would be greatly appreciated
linux shell-script scripting rhel
edited Apr 28 at 3:01
asked Apr 28 at 2:15
Katkota
384
384
man curl
andman wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.
â ivanivan
Apr 28 at 2:34
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
wget
can be redirected to/dev/null
for all output, then check the exit status with$?
being equal to 0 then there are no errors. I don't have a proxy to test against.
â ivanivan
Apr 28 at 3:11
Have you try to exporthttp_proxy
(export http_proxy=10.5.5.5:3128
) variable and test withwget
?
â Romeo Ninov
Apr 28 at 9:04
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59
add a comment |Â
man curl
andman wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.
â ivanivan
Apr 28 at 2:34
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
wget
can be redirected to/dev/null
for all output, then check the exit status with$?
being equal to 0 then there are no errors. I don't have a proxy to test against.
â ivanivan
Apr 28 at 3:11
Have you try to exporthttp_proxy
(export http_proxy=10.5.5.5:3128
) variable and test withwget
?
â Romeo Ninov
Apr 28 at 9:04
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59
man curl
and man wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.â ivanivan
Apr 28 at 2:34
man curl
and man wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.â ivanivan
Apr 28 at 2:34
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
wget
can be redirected to /dev/null
for all output, then check the exit status with $?
being equal to 0 then there are no errors. I don't have a proxy to test against.â ivanivan
Apr 28 at 3:11
wget
can be redirected to /dev/null
for all output, then check the exit status with $?
being equal to 0 then there are no errors. I don't have a proxy to test against.â ivanivan
Apr 28 at 3:11
Have you try to export
http_proxy
(export http_proxy=10.5.5.5:3128
) variable and test with wget
?â Romeo Ninov
Apr 28 at 9:04
Have you try to export
http_proxy
(export http_proxy=10.5.5.5:3128
) variable and test with wget
?â Romeo Ninov
Apr 28 at 9:04
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440524%2fhelp-with-shell-script-to-test-proxy%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
man curl
andman wget
- both have multiple proxy options (how to auth, etc) and which you'll need depends exactly on your setup.â ivanivan
Apr 28 at 2:34
I just want to write a script that would run the command against each proxy IP and if i get 200 OK back then go to the next one and if it times out, then send me an email
â Katkota
Apr 28 at 2:43
wget
can be redirected to/dev/null
for all output, then check the exit status with$?
being equal to 0 then there are no errors. I don't have a proxy to test against.â ivanivan
Apr 28 at 3:11
Have you try to export
http_proxy
(export http_proxy=10.5.5.5:3128
) variable and test withwget
?â Romeo Ninov
Apr 28 at 9:04
Any help folks completing the script i started already or even providing a different script to do it?
â Katkota
May 5 at 2:59