Execute a shell with cygwin


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute a shell with cygwin
# 1  
Old 01-28-2010
Execute a shell with cygwin

Hi everybody,

I would like to execute a shell in windows. So I installed Cygwin but I got this message :

Code:
$ sh /neuf.sh
start
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify faile
d
More details here: cURL - Details on Server SSL Certificates

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify faile
d
More details here: cURL - Details on Server SSL Certificates

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify faile
d
More details here: cURL - Details on Server SSL Certificates

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
$
 the -k (or --insecure) option.
connection failed

here is my script :

Code:
#!/usr/bin/env bash

url="https://hotspot.neuf.fr/nb4_crypt.php"
okmatch="licitations"
login="holle.jonathan@sfr.fr"
password="biohazard"

echo 'start'

# quel que soit le site visité, on sera redirigé vers le
# portail captif qui génerera un token. L'utilisation du switch
# -L permet de suivre la redirection de type 302
challenge=`curl -L http://www.google.com|grep name=\"challenge|sed -r 's/.*value=\"([0-9a-z]+)\".*/\1/'`

#echo "challenge: ${challenge}"

# la phase 2 renvoie une réponse au token
response=`curl -L -d "username=${login}&password=${password}&cond=on&accessType=neuf&nb4=https://hotspot.neuf.fr/nb4_crypt.php&challenge=${challenge}" ${url}|grep response=|sed -r 's/.*response=([0-9a-z]+).*/\1/'`

#echo "reponse: ${response}"
# enfin, un refresh renvoie sur une page qui attend la
# réponse précedente pour activer la connexion
final=`curl -L "http://192.168.2.1:3990/logon?username=ssowifi.neuf.fr/${login}&response=${response}&uamip=192.168.2.1&userurl=http%3A%2F%2Fwww.fon.com%2Ffr%2Flanding%2Ffoneroneufbox%3Bfon%3B%3B&lang=fr&ARCHI"|grep ${okmatch}`

if [ ! -z "${final}" ];then
        echo "connected"
else
        echo "connection failed"
fi

What's the problem ? Smilie

Thanks for your answers

Last edited by pludi; 01-28-2010 at 07:53 AM.. Reason: code tags, please...
# 2  
Old 01-28-2010
curl is complaining that there is something wrong with SSL. You can probably just disable checking SSL with '-k' switch.

Code:
       -k/--insecure
              (SSL)  This  option explicitly allows curl to perform "insecure"
              SSL connections and transfers. All SSL connections are attempted
              to  be  made secure by using the CA certificate bundle installed
              by default. This makes all connections considered "insecure"  to
              fail unless -k/--insecure is used.

              If this option is used twice, the second time will again disable
              it.

# 3  
Old 01-28-2010
Where have I to put the "-k" ? Sorry I'am a unix dummy ^^
# 4  
Old 01-28-2010
Instead of 'curl' use 'curl -k'. You should read some unix shell tutorial, really.
# 5  
Old 01-28-2010
Thanks a lot, it works !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute a shell script in UNIX server from Cygwin

Hi All, We have shell scripts in UNIX ( Sun OS ) server. Also in my windows machine i have Cygwin installed. Now is there a way to execute Shell script available in UNIX server from Cygwin? (4 Replies)
Discussion started by: Girish19
4 Replies

2. Shell Programming and Scripting

Cygwin shell script

I have a file with below format : 2013-05-20 hello has done 2013-05-20 hi 000abc abc 2013-05-21 thank you I want the out put to be like this : 2013-05-20 hello has done 2013-05-20 hi 000abc abc 2013-05-21 thank you What I could think of is something like this : cat... (7 Replies)
Discussion started by: Sparta
7 Replies

3. Shell Programming and Scripting

cygwin executable shell scripts

Hello, Cygwin will execute a shell script without turning on executable status on the file. I want to force cygwin to be more like linux and not execute scripts directly on the command line unless changing mode to have executable status. Is this possible? Thanks Larry (2 Replies)
Discussion started by: larrye0123
2 Replies

4. Shell Programming and Scripting

Cygwin - cannot execute binary file

Hey all, I am using Cygwin on a machine running windows 7 64bits. I am about to use the following command: $ faToTwoBit in.fa out.2bit In the manual on sourceforge it mentioned: "Download blat and faToTwoBit and set the blat_bin and fatotwobit_bin entries in config.txt to the fully... (4 Replies)
Discussion started by: @man
4 Replies

5. Shell Programming and Scripting

Running shell script in Cygwin terminal

I am new to shell scripting. I tried to run a simple shell script using Cygwin terminal in Win XP env. The script I have written is as follows - #!/bin/bash a=5 ] && echo "true" || echo "false" But when I execute the script, getting some confusing error. The error I am getting are - ... (3 Replies)
Discussion started by: linux_learner
3 Replies

6. UNIX for Dummies Questions & Answers

How to execute a command in Cygwin?

Hi, I have installed CYGWIN software in my system, can anyone suggest me how to run cat command in this software ? when i attempt to execute this command- $ cat /cygdrive/c/Program\Files/hello.txt. Result: No such file or directory. Please let me know how to execute. Regards, Kiran. (1 Reply)
Discussion started by: Kiran S
1 Replies

7. Shell Programming and Scripting

Cygwin-shell script

hi, I am using Cygwin for running the shell script. If i execute the following command at the prompt output is obtained. grep echo * The same i have put in a file and when am trying to execute it is throwing error. IP.sh echo "Starting command..........." grep echo * ... (9 Replies)
Discussion started by: flamingo_l
9 Replies

8. Shell Programming and Scripting

cygwin shell script error

Hi, I have a cywin test script as below but errors, #!/usr/bin/bash while do echo "123" echo "456" done sh-3.2$ ./test.sh ./test.sh: line 7: syntax error: unexpected end of file Please help... Thanks! Victor (3 Replies)
Discussion started by: victorcheung
3 Replies

9. UNIX for Dummies Questions & Answers

Cygwin shell not coming up

Hi, I installed Cygwin y'day on Win XP SP2. The install went fine but when I clicked on Cygwin's shortcut to invoke its shell, it didn't come up.....was just opening for a fraction of second and then closed. Can anyone please advise? Regards er_ashu (6 Replies)
Discussion started by: er_ashu
6 Replies

10. UNIX for Dummies Questions & Answers

Problem with scheduling a shell script on cygwin using cron

Hi, Before I start, I would like to inform that, I went through all FAQs and other threads before posting here. I 'm trying to schedule a shell script on cygwin using cron. No matter what I do I don't seem to get the cron job executing my bash script. My script is temp.sh echo `date` >... (4 Replies)
Discussion started by: shash
4 Replies
Login or Register to Ask a Question