{{tag>Curl Web Trac Cookies Sécurité}} # Curl cookies trac Voir aussi : * http://httpbin.org `docker run -p 80:80 kennethreitz/httpbin` Enregistrer le cookie ~~~bash curl -k --show-error --verbose -c cookies.txt https://trac.acme.fr/login --anyauth --user USER:PASSWD ~~~ ~~~bash curl -k --show-error --verbose -b cookies.txt https://trac.acme.fr/query | html2text | grep ^# ~~~ `cookies.txt` ~~~ # 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 ~~~bash sqlite3 trac/projet1/db/trac.db ~~~ ~~~sql .header ON SELECT * FROM auth_cookie ORDER BY time DESC LIMIT 1; ~~~ ~~~ cookie|name|ipnr|time ab2cf34d1b293f508218fdea4d5d2abe|jibe|127.0.0.1|1444221567 ~~~ ~~~sql DELETE FROM auth_cookie WHERE cookie='ab2cf34d1b293f508218fdea4d5d2abe'; ~~~ ~~~bash curl -k -b cookies.txt https://trac.acme.fr/query 2>/dev/null | html2text | grep '^#' | awk '{print "\t"$1"\t"$2""}' | sed -e 's/^//' -e 's/$/<\/tr>/' -e '1i\' | sed -e '$a
' | xmllint --format - | sed '1d' | sed -e 's%#\([0-9][0-9]*\)%\1%' ~~~ ## Notes cookies ~~~bash 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' ~~~