<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=448343&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=448343</link>
		<description><![CDATA[Les sujets les plus récents dans [Utilitaire Freebox] Script pour télécharger sur votre V6.]]></description>
		<lastBuildDate>Thu, 14 Mar 2013 18:56:52 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12906061#p12906061</link>
			<description><![CDATA[<p>De ce que j&#039;ai pu tester avec mon script d&#039;upload sur la Freebox c&#039;est là : <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=638101">http://forum.ubuntu-fr.org/viewtopic.php?id=638101</a>, seul le rajout d&#039;un fichier à télécharger nécessite le CSRF token. Mais il est vrai que je n&#039;ai pas besoin d&#039;accéder à la page &quot;system&quot; !</p><p>Le mieux est de tracer ce qu&#039;il se passe (Wireshark par exemple) et reproduire exactement.</p><p>Cependant, sur la partie que tu montres on ne peut pas dire grand chose. C&#039;est en effet forcément partiel puisque tu ne montres pas les parties où tu te connectes, l&#039;erreur venant peut-être de là.</p>]]></description>
			<author><![CDATA[dummy@example.com (Zakhar)]]></author>
			<pubDate>Thu, 14 Mar 2013 18:56:52 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12906061#p12906061</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12875251#p12875251</link>
			<description><![CDATA[<p>Bonjour, à tous,</p><p>J&#039;ai parcouru tout ce sujet car je n&#039;arrive pas à dialoguer avec la V6 comme vous le faites ci-dessus.</p><p>Pour commencer à comprendre comment tout cela fonctionne, je souhaitrais simplement interroger le numéro de firmware. Je dispose d&#039;un Windows (je sais c&#039;est pas trop l&#039;endroit) et d&#039;un NAS Synology (ouf, je sauve la mise !!). Sur les 2 machines, je reçois un 403 Forbidden. Je suppose que l&#039;erreur se situe dans ce fameux csrf_token à passer, mais ça fait une semaine que je tourne en rond, donc j&#039;en appelle à votre regard expert et externe.</p><p>Voici la ligne de commande que je tente d&#039;envoyer :</p><div class="codebox"><pre><code> curl -v http://mafreebox.free.fr/system.cgi -b cookieFile.txt --header &quot;Content-Type: application/json&quot; --header &quot;X-FBX-CSRF-Token: SlDEEk0wK1jmWD/kUyq/CRKOCV2LppZIoXf3emSqR5br5I+rpevFuI9RJQSODXLN&quot; -d &#039;{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;method&quot;:&quot;system.fw_release_get&quot;,&quot;params&quot;:[true]}&#039;</code></pre></div><p>Kesse kej fait de travers ??</p>]]></description>
			<author><![CDATA[dummy@example.com (mbombo)]]></author>
			<pubDate>Tue, 12 Mar 2013 10:11:40 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12875251#p12875251</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12496441#p12496441</link>
			<description><![CDATA[<p>Sur le sujet WiFi, on passe là : <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=1192391">http://forum.ubuntu-fr.org/viewtopic.php?id=1192391</a> pour ceux qui veulent <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Désolé pour la pollution et merci encore ..</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Thu, 07 Feb 2013 12:56:21 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12496441#p12496441</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12493601#p12493601</link>
			<description><![CDATA[<p>On est en train de polluer ce topic. Faut en créer un autre <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Thu, 07 Feb 2013 07:05:24 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12493601#p12493601</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12491541#p12491541</link>
			<description><![CDATA[<p>Pour ma part, j&#039;ai réutilisé le script ci-dessus et l&#039;ai un peu modifié car au départ j&#039;avais une erreur de droit sur la variable &quot;mktemp&quot; </p><p>j&#039;ai donc ceci : </p><div class="codebox"><pre><code>#!/bin/sh

resultCurl=&quot;/volume1/opt/mktemp&quot;

curl -S -d &quot;login=freebox&amp;passwd=Monmotdepasse&quot; &quot;http://mafreebox.freebox.fr/login.php&quot; -v &gt; /volume1/opt/mktemp
if grep -q &quot;Set-Cookie:&quot; $resultCurl; then
    echo &quot;Login to Freebox succeeded!&quot;
else
    echo &quot;Login to Freebox failed!&quot;
    rm $resultCurl &gt; /dev/null 2&gt;&amp;1
    exit 1
fi

csrfToken=`grep &quot;X-FBX-CSRF-Token&quot; $resultCurl | cut -f 3 -d &#039; &#039; | sed &quot;s/\r//&quot;  `
fbxSid=`grep &quot;FBXSID&quot; $resultCurl | cut -f 3 -d &#039; &#039; | sed &quot;s/FBXSID=//&quot; | sed &quot;s/;//&quot; | sed &quot;s/\r//&quot; `

curl -s -b FBXSID=$fbxSid -D - -o /dev/null -e &quot;http://mafreebox.freebox.fr/settings.php?page=wifi_conf&quot; http://mafreebox.freebox.fr/wifi.cgi --data-urlencode &quot;csrf_to$
if grep -q &quot;HTTP/1.1 200 OK&quot; $resultCurl; then
    echo &quot;Setting Freebox wifi OFF succeeded!&quot;
else
    echo &quot;Setting Freebox wifi OFF failed!&quot;
fi

echo &quot;Logout to Freebox succeeded!&quot;
rm $resultCurl &gt; /dev/null 2&gt;&amp;1

exit 0</code></pre></div><p>Le script va donc plus loin et on voit clairement que ça se connecte mais j&#039;ai ensuite une erreur...</p><p>Pour information je n&#039;utilise pas le port 80 pour la connexion à l&#039;interface depuis l’extérieur mais ici c&#039;est l&#039;URL locale qui est utilisée. Je ne pense donc pas que le problème vienne de là.</p><p>Voici ce que j&#039;ai suite à l’exécution du script</p><br /><div class="codebox"><pre class="vscroll"><code>Homeserver&gt; sh fbwifinew.sh
: not foundh: line 2:
: not foundh: line 4:
* About to connect() to mafreebox.freebox.fr port 80 (#0)
*   Trying 212.27.38.253...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* connected
* Connected to mafreebox.freebox.fr (212.27.38.253) port 80 (#0)
&gt; POST /login.php HTTP/1.1
&gt; User-Agent: curl/7.26.0-DEV
&gt; Host: mafreebox.freebox.fr
&gt; Accept: */*
&gt; Content-Length: 26
&gt; Content-Type: application/x-www-form-urlencoded
&gt;
} [data not shown]
* upload completely sent off: 26 out of 26 bytes
&lt; HTTP/1.1 200 OK
&lt; Server: nginx
&lt; Date: Wed, 06 Feb 2013 20:40:18 GMT
&lt; Content-Type: text/html
&lt; Transfer-Encoding: chunked
&lt; Connection: keep-alive
&lt;
{ [data not shown]
100  1686    0  1660  100    26  51369    804 --:--:-- --:--:-- --:--:-- 57241
* Connection #0 to host mafreebox.freebox.fr left intact
:80etaddrinfo(3) failed for
&#039; Couldn&#039;t resolve host &#039;
* Closing connection #1
&#039;url: (6) Couldn&#039;t resolve host &#039;
* Closing connection #0
fbwifinew.sh: line 28: syntax error: unexpected end of file (expecting &quot;then&quot;)</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (dca77)]]></author>
			<pubDate>Wed, 06 Feb 2013 22:52:16 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12491541#p12491541</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12489971#p12489971</link>
			<description><![CDATA[<p>@Vinky41 J&#039;ai bien le data-urlencode. Comprend pas où je merde <img src="http://forum.ubuntu-fr.org/img/smilies/hmm.png" width="15" height="15" alt="hmm" /> Forcément sur fbxSid / csrfToken ..<br />@dca77 Curieux d&#039;avoir ton retour ..</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Wed, 06 Feb 2013 20:01:53 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12489971#p12489971</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12487251#p12487251</link>
			<description><![CDATA[<p>Bonsoir, </p><p>J&#039;ai également le même problème avec le script wifi et le NAS Synology depuis la mise à jour de la Freebox.</p><p>Je suis un newbie en prog mais je vais essayer de modifier le script pour que cela fonctionne de nouveau ce soir.</p><p>Merci en tous les cas pour ces précieuses informations.;)</p>]]></description>
			<author><![CDATA[dummy@example.com (dca77)]]></author>
			<pubDate>Wed, 06 Feb 2013 16:56:44 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12487251#p12487251</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12486171#p12486171</link>
			<description><![CDATA[<p>Oui oui chez moi ça fonctionne à tous les coups.</p><p>J&#039;avais le même souci avant de mettre le data-urlencode.</p>]]></description>
			<author><![CDATA[dummy@example.com (Vinky41)]]></author>
			<pubDate>Wed, 06 Feb 2013 15:35:51 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12486171#p12486171</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485351#p12485351</link>
			<description><![CDATA[<p>Je suis certain : à la main ça passe pas toujours. Doit y avoir un truc avec les caractères spéciaux <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /><br />Via le script, ça ne passe jamais ..</p><p>Tu n&#039;as jamais ce souci avec ton script là :<br /><a href="https://github.com/valentinconan/scriptDownloadFreebox/blob/master/scriptDownloadFreebox">https://github.com/valentinconan/script … oadFreebox</a> ?</p><p>Merci.</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Wed, 06 Feb 2013 14:36:41 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485351#p12485351</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485101#p12485101</link>
			<description><![CDATA[<p>Salut,</p><p>Tu as bien utilisé --data-urlencode ?</p><p>Pas un souci de c/c pour ton test ?</p>]]></description>
			<author><![CDATA[dummy@example.com (Vinky41)]]></author>
			<pubDate>Wed, 06 Feb 2013 14:14:05 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485101#p12485101</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485021#p12485021</link>
			<description><![CDATA[<p>Bon j&#039;ai réussi à le faire marcher à la main mais c&#039;est pas systématique.<br />Ya un truc qui merde avec fbxSid et csrfToken, caractères spéciaux ou non.</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Wed, 06 Feb 2013 14:10:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12485021#p12485021</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12479631#p12479631</link>
			<description><![CDATA[<div class="quotebox"><cite>Vinky41 a écrit&#160;:</cite><blockquote><div><p>Pour ce qui est de ton script j&#039;ai vu ça : csrf_token=${csrfToken}</p><p>1. t&#039;as pas un souci avec tes accolades ? tu voulais pas plutôt mettre : csrf_token={$csrfToken} ?<br />2. Il ne faut de toute manière ne pas en mettre pour que cela fonctionne <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p></div></blockquote></div><p>Non, ça c&#039;est tout à fait correct et la forme &quot;standard&quot; des variables shell.</p><p>Par contre, en général, pour éviter les &quot;mauvaises surprises&quot; comme par exemple un espace au milieu de la chaîne de caractère qui fait tout planter, on les met en général entre guillemets du genre :</p><div class="codebox"><pre><code>foo=&quot;${bar}&quot;</code></pre></div><p>Tu connais sans doute cette &quot;forme&quot; de variable dans les expressions plus étendues comme :</p><div class="codebox"><pre><code>foo=${#bar}</code></pre></div><p>Là on prend la longueur de la chaîne &#039;bar&#039;, et donc pas de guillemets puisque cela renvoie un nombre entier.</p><p>Ou alors :</p><div class="codebox"><pre><code>foo=&quot;${bar:3:2}&quot;</code></pre></div><p>Celle ça extrait une sous-chaîne, mais il n&#039;est PAS RECOMMANDE de l&#039;utiliser car c&#039;est un &quot;bashism&quot;, voir ici pour plus d&#039;explication : <a href="https://wiki.ubuntu.com/DashAsBinSh">https://wiki.ubuntu.com/DashAsBinSh</a></p><p>En fait, l&#039;écriture de la variable avec les {} est une forme &quot;nue&quot; des autres expansions de variables. C&#039;est la variable brute, non étendue.<br />C&#039;est <strong>une bonne pratique</strong> de l&#039;écrire ainsi, parce que de la sorte tu identifies bien les variables. En outre, dans certains cas tu ne peux pas faire autrement que d&#039;utiliser la variable avec des crochets comme par exemple :</p><div class="codebox"><pre><code>foo=&quot;${bar}blah blah&quot;</code></pre></div><p>Là j&#039;ai concaténé &#039;blah blah&#039; au contenu de la variable &#039;bar&#039;. Sans les crochets ça donnerait :</p><div class="codebox"><pre><code>foo=&quot;$barblah blah&quot;</code></pre></div><p>... et donc le shell va chercher une variable &#039;barblah&#039; qui n&#039;existe pas !</p><p>Donc même si la formulation correcte serait : </p><div class="codebox"><pre><code>csrf_token=&quot;${csrfToken}&quot;</code></pre></div><p>avec des guillemets en plus, le bug ne vient pas de là puisque le CSRF ne contient a priori pas d&#039;espaces ni caractères &quot;piège&quot; qui planteraient un script. C&#039;est cependant aussi <strong>une bonne pratique </strong>de ne pas oublier les guillemets !..</p><br /><p>Désolé, je ne peux pas aider beaucoup plus car la Freebox n&#039;est pas chez moi (elle est loin).</p><p>Par contre de bonnes pistes pour trouver d&#039;où vient le bug :<br />- faire tourner le script en mode &quot;debug&quot; (dash -x ./script params)<br />- rajouter des options -v aux curls (pour voir plus de détail sur ce qu&#039;il se passe)</p>]]></description>
			<author><![CDATA[dummy@example.com (Zakhar)]]></author>
			<pubDate>Tue, 05 Feb 2013 22:24:29 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12479631#p12479631</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12479261#p12479261</link>
			<description><![CDATA[<p>Salut,</p><p>Excuse moi pour le temps de réponse <img src="http://forum.ubuntu-fr.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p><p>Alors oui je viens de tester à l&#039;instant et je confirme que ça fonctionne très bien <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /> (j&#039;ai testé à la main c&#039;est à dire ma ligne de connexion + ta ligne de commande en remplaçant à la main le SID &amp; Token.</p><div class="quotebox"><blockquote><div><p>Connexion : </p><div class="codebox"><pre><code>curl -s -D - -o /dev/null http://mafreebox.freebox.fr/login.php -d &#039;login=freebox&amp;passwd=&lt;Mon_MdP&gt;&#039;</code></pre></div><p>Vous aurez donc un ID et un jeton qui s&#039;afficheront</p><div class="codebox"><pre><code>HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Fri, 18 Jan 2013 16:52:21 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: FBXSID=&quot;&lt;ID&gt;&quot;; Max-Age=86400; HTTPOnly
X-FBX-CSRF-Token: &lt;TOKEN&gt;
Location: /settings.php</code></pre></div><p>Il restera plus qu&#039;à télécharger en utilisant les ID, jeton que vous avez reçu précédemment et bien sûr votre url :</p><div class="codebox"><pre><code>curl -s -b FBXSID=&lt;ID&gt; -D - -o /dev/null -e &quot;http://mafreebox.freebox.fr/settings.php?page=wifi_conf&quot; http://mafreebox.freebox.fr/wifi.cgi --data-urlencode &quot;csrf_token=&lt;Token&gt;&quot; -d &quot;channel=11&amp;ht_mode=disabled&amp;method=wifi.ap_params_set&amp;config=Valider&quot; -H &quot;X-Requested-With: XMLHttpRequest&quot; -H &quot;Accept: application/json, text/javascript, */*&quot;</code></pre></div></div></blockquote></div><p>Pour ce qui est de ton script j&#039;ai vu ça : csrf_token=${csrfToken}</p><p>1. t&#039;as pas un souci avec tes accolades ? tu voulais pas plutôt mettre : csrf_token={$csrfToken} ?<br />2. Il ne faut de toute manière ne pas en mettre pour que cela fonctionne <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>la bonne ligne à mettre doit donc être : </p><div class="codebox"><pre><code>curl -s -b FBXSID=$fbxSid -D - -o /dev/null -e &quot;http://mafreebox.freebox.fr/settings.php?page=wifi_conf&quot; http://mafreebox.freebox.fr/wifi.cgi --data-urlencode &quot;csrf_token=$csrfToken&quot; -d &quot;channel=11&amp;ht_mode=disabled&amp;method=wifi.ap_params_set&amp;config=Valider&quot; -H &quot;X-Requested-With: XMLHttpRequest&quot; -H &quot;Accept: application/json, text/javascript, */*&quot; &gt; $resultCurl 2&gt;&amp;1</code></pre></div><p>Tiens moi au courant <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Vinky41)]]></author>
			<pubDate>Tue, 05 Feb 2013 21:57:47 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12479261#p12479261</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12477281#p12477281</link>
			<description><![CDATA[<p>@Vinky41 T&#039;as testé par hasard ? Merci.</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Tue, 05 Feb 2013 19:11:59 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12477281#p12477281</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  [Utilitaire Freebox] Script pour télécharger sur votre V6]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12463251#p12463251</link>
			<description><![CDATA[<p>Ecoute, je retourne le script dans tous les sens, je vois pas.<br />Alors si tu peux m&#039;apporter un regard neuf, je prend !</p>]]></description>
			<author><![CDATA[dummy@example.com (sebastien4)]]></author>
			<pubDate>Mon, 04 Feb 2013 16:01:29 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12463251#p12463251</guid>
		</item>
	</channel>
</rss>
