Curl cookies trac

Voir aussi :

http://httpbin.org docker run -p 80:80 kennethreitz/httpbin

Enregistrer le cookie

curl -k --show-error --verbose -c cookies.txt https://trac.acme.fr/login --anyauth --user USER:PASSWD
curl -k --show-error --verbose -b cookies.txt https://trac.acme.fr/query |html2text |grep ^#

# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_trac.acme.fr	FALSE	/	FALSE	0	trac_auth	ab2cf34d1b293f508218fdea4d5d2abe

Sur le serveur

sqlite3 trac/projet1/db/trac.db
.header ON SELECT * FROM auth_cookie ORDER BY TIME DESC LIMIT 1;

cookie|name|ipnr|time
ab2cf34d1b293f508218fdea4d5d2abe|jibe|127.0.0.1|1444221567

DELETE FROM auth_cookie WHERE cookie='ab2cf34d1b293f508218fdea4d5d2abe';
curl -k -b cookies.txt https://trac.acme.fr/query 2>/dev/null |html2text |grep '^#' |awk '{print "\t<td>"$1"</td>\t<td>"$2"</td>"}' |sed -e 's/^/<tr>/' -e 's/$/<\/tr>/' -e '1i\<table>' |sed -e '$a</table>' |xmllint --format - |sed '1d' |sed -e 's%#\([0-9][0-9]*\)%<a href="https://trac.acme.fr/ticket/\1">\1</a>%'

Notes cookies

curl -I -c cookies.txt http://notre-dame-des-rencontres.com curl -b cookies.txt 'http://www.notre-dame-des-rencontres.com/testcookie.php?passwd=Passw0rd&user=Pseudo&css=' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'Referer: http://www.notre-dame-des-rencontres.com/?out=1' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-GPC: 1' curl -b cookies.txt 'http://www.notre-dame-des-rencontres.com/site/securit.php?fgp=1ab3e259a81f5d20d98289aa9ab2764e&cook=1&passwd=Passw0rd&user=Pseudo' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'Referer: http://www.notre-dame-des-rencontres.com/?out=1' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-GPC: 1' curl -b cookies.txt 'http://www.notre-dame-des-rencontres.com/site/delogger.php' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: http://www.notre-dame-des-rencontres.com/?fgp=c3584c3ecbfccd0cc2b2d92a392d3b16' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-GPC: 1'