Using Curl to Log In

Example: Using Curl to log in

curl -k "https://192.168.2.1/api/login?username=admin&password=admin"

Example: Curl result:

{
    "code" : 200,
    "result" : {
        "adress" : "192.168.2.103",
        "permission" : "admin", 
        "port" : "52222",
        "timestamp" : "14:30:5:957", 	
        "token" : "2442 CB0CB60B2EE9F5A35DF5ED8C33", 
        "user" : "admin"
    },
    "status" : "success"
}

Example: Verbose Curl result:

* About to connect () to 192.168.2.1 port 443 (#0)
*   Trying 192.168.2.1... connected
* successfully set certificate verify locations :
*   CAfile : none
  CApath : / etc / ssl / certs
* SSLv3 , TLS handshake , Client hello (1):
* SSLv3 , TLS handshake , Server hello (2):
* SSLv3 , TLS handshake , CERT (11) :
* SSLv3 , TLS handshake , Server finished (14) :
* SSLv3 , TLS handshake , Client key exchange (16) :
* SSLv3 , TLS change cipher , Client hello (1) :
* SSLv3 , TLS handshake , Finished (20) :
* SSLv3 , TLS change cipher , Client hello (1) :
* SSLv3 , TLS handshake , Finished (20) :
* SSL connection using ECDHE -RSA - AES256 -SHA
* Server certificate :
*    subject : C=US; ST= Minnesota ; L= Minneapolis ; CN= rcell . example . com
*    start date : 2013 -05 -01 16:31:06 GMT
*    expire date : 2014 -05 -01 16:31:06 GMT
*    issuer : C=US; ST= Minnesota ; L= Minneapolis ; CN= rcell . example . com
*    SSL certificate verify result : self signed certificate (18) , continuing anyway .
> GET / api / login ? username = admin & password = admin HTTP /1.1
> User - Agent : curl /7.22.0 (x86_64 -pc -linux - gnu ) libcurl /7.22.0 OpenSSL /1.0.1 zlib /1.2.3.4 libidn /1.23 librtmp /2.3
> Host : 192.168.2.1
> Accept : */*
>
< HTTP /1.1 200 OK
< Set - Cookie : token =5810 A57DF87328951FF1901027A09A74 ; Max - Age =300; Path =/; Secure
< Cache - Control : no - cache
< Content - type : application / json
< Transfer - Encoding : chunked
< Date : Wed , 15 Jan 2014 14:56:09 GMT
< Server : rcell
<
{
    "code" : 200, 
    "result" : {
        "adress" : "192.168.2.103",
        "permission" : "admin", 
        "port" : "52222",
        "timestamp" : "14:30:5:957", 	
        "token" : "2442 CB0CB60B2EE9F5A35DF5ED8C33",
        "user" : "admin"
    },
    "status" : "success"
}
* Connection #0 to host 192.168.2.1 left intact
* Closing connection #0
* SSLv3 , TLS alert , Client hello (1) :