curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: Authentication fails on a specific website

From: Aleksandar Lazic <al-curlusers_at_none.at>
Date: Tue, 5 Feb 2019 11:30:39 +0100

Hi.

Am 02.02.2019 um 12:33 schrieb SATRIANI Santana:
> Authentication fails on a porkbun.com
> I found out that you only need the valid BUNSESSION2 to work with the website.
> Unfortunately every attempt to get the valid BUNSESSION2 through authentication fails.
> Here is a part of my code:
>
> '''
> _reqjson="{ \
> \"loginUsername\": \"${user}\", \
> \"loginPassword\": \"${pass}\" \
> }"
>
> get_cookie=$(curl \
> --header "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" \
> --data-binary "$_reqjson" \
> --header "Connection: keep-alive" "https://porkbun.com/account/login" \
> -v -L 2>&1)

What do you get when you call this manually?

curl offers cookie handling out of the box.
https://ec.haxx.se/http-cookies.html

> eval $(echo ${get_cookie} | grep -o -P 'BUNSESSION2=.*?;' | sed 's/.$//')
> '''

Just for my curiosity, it looks like you use python, why do you don't use the python urllib for this task??
For example: https://stackoverflow.com/questions/5606083/how-to-set-and-retrieve-cookie-in-http-header-in-python

Regards
aleks

> Thanks for any advice
>
> -----------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-05