{"id":1430,"date":"2015-10-02T01:16:26","date_gmt":"2015-10-02T00:16:26","guid":{"rendered":"http:\/\/quantum-bits.org\/?p=1430"},"modified":"2022-08-12T17:27:52","modified_gmt":"2022-08-12T16:27:52","slug":"e-v-e-sips-orange-juice","status":"publish","type":"post","link":"https:\/\/www.quantum-bits.org\/?p=1430","title":{"rendered":"E.V.E sips Orange juice"},"content":{"rendered":"<p>Since I&#8217;m still waiting for all the audio components I ordered for E.V.E&#8217;s&nbsp;voice recognition functionality, let&#8217;s try in the meantime to interface E.V.E with a first home device.<\/p>\n<p>The very first one that comes to my mind is of course a television set. Let&#8217;s try !<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1297 size-full\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks.jpg\" alt=\"rasbperrypi-hacks\" width=\"985\" height=\"503\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks.jpg 985w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/09\/rasbperrypi-hacks-300x153.jpg 300w\" sizes=\"(max-width: 985px) 100vw, 985px\" \/><\/p>\n<p><strong>Reverse-engineering&nbsp;an Orange Livebox Play set-top box<br \/>\n<\/strong><\/p>\n<p>I rely on <a href=\"http:\/\/www.orange.fr\" target=\"_blank\" rel=\"noopener\">Orange<\/a>&nbsp;quadruple-play offer for xDSL, phone, 4G and television services. Orange provides a set of two boxes:<\/p>\n<ul>\n<li>A <a href=\"https:\/\/fr.wikipedia.org\/wiki\/Sagemcom\" target=\"_blank\" rel=\"noopener\">Sagemcom<\/a>&nbsp;xDSL2 router coupled to a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Wireless_access_point\" target=\"_blank\" rel=\"noopener\">wireless&nbsp;access point<\/a>, an Ethernet hub and a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Digital_Enhanced_Cordless_Telecommunications\" target=\"_blank\" rel=\"noopener\">DECT<\/a> base<\/li>\n<li>An <a href=\"https:\/\/en.wikipedia.org\/wiki\/Intel_Atom_(CPU)\" target=\"_blank\" rel=\"noopener\">atom<\/a> based <a href=\"https:\/\/en.wikipedia.org\/wiki\/Set-top_box\" target=\"_blank\" rel=\"noopener\">set-top box<\/a> (also built by Sagemcom) connected (via Ethernet or WiFi) to the router<\/li>\n<\/ul>\n<p>These devices are completed by a remote control and <a href=\"https:\/\/en.wikipedia.org\/wiki\/IOS\" target=\"_blank\" rel=\"noopener\">iOS<\/a> \/<a href=\"https:\/\/en.wikipedia.org\/wiki\/Android_(operating_system)\" target=\"_blank\" rel=\"noopener\">Android<\/a> applications.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1431\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/photo-livebox-play.jpg\" alt=\"photo-livebox-play\" width=\"1400\" height=\"611\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/photo-livebox-play.jpg 1400w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/photo-livebox-play-300x131.jpg 300w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/photo-livebox-play-1024x447.jpg 1024w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/p>\n<p>Unfortunately, Orange doesn&#8217;t publish any document on its API, or any information at all on how to interface with its devices. Which is&nbsp;a real shame.<\/p>\n<p>But since Orange applications for smartphone and tablets are able to drive these equipment over Wifi (and hopefully HTTP), there is probably a way to reverse-engineer the protocol used.<\/p>\n<p>The first thing is to identify the IP address of the set-top box. One can either use the router web administration interface (via the local URL <code>http:\/\/livebox<\/code>) or use the smartphone \/ tablet application &#8220;Ma Livebox&#8221; (my LiveBox):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1432\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/malivebox.png\" alt=\"malivebox\" width=\"920\" height=\"600\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/malivebox.png 920w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/malivebox-300x196.png 300w\" sizes=\"(max-width: 920px) 100vw, 920px\" \/><\/p>\n<p>Here, the IP address of my set-top box is: <code>192.168.1.10<\/code>.<\/p>\n<p>Then, since a lot of consumer-electronic devices use the&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Universal_Plug_and_Play\" target=\"_blank\" rel=\"noopener\">UPnP<\/a>&nbsp;protocol,&nbsp;I fired up&nbsp;<a href=\"http:\/\/coherence.beebits.net\/wiki\/UPnP-Inspector\" target=\"_blank\" rel=\"noopener\">upnp-inspector<\/a>, which gave this :<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1439\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/upnp-inspector.png\" alt=\"upnp-inspector\" width=\"785\" height=\"693\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/upnp-inspector.png 785w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/upnp-inspector-300x265.png 300w\" sizes=\"(max-width: 785px) 100vw, 785px\" \/><\/p>\n<p>It seems one can actually drive an Orange set-top box via HTTP requests on the&nbsp;8080 port. Indeed the URL showing in the &#8220;Details&#8221; window gave:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1440\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/basicdevicedescription.png\" alt=\"basicdevicedescription\" width=\"652\" height=\"375\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/basicdevicedescription.png 652w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/basicdevicedescription-300x173.png 300w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><\/p>\n<p>Let&#8217;s move on, launch Orange application &#8220;TVcommande&#8221; (which turns a smartphone into remote control), and sniff out with <a href=\"http:\/\/www.kismetwireless.net\/\" target=\"_blank\" rel=\"noopener\">kismet<\/a>&nbsp;the HTTP traffic.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1433\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/tvcommand.png\" alt=\"tvcommand\" width=\"610\" height=\"716\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/tvcommand.png 610w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/tvcommand-256x300.png 256w\" sizes=\"(max-width: 610px) 100vw, 610px\" \/><\/p>\n<p>Testing each functionalities of the &#8220;WiFi remote&#8221;, it appeared it is driving the set-top box via simple HTTP requests of the form:<\/p>\n<ul>\n<li><code>http:\/\/192.168.1.10:8080\/remoteControl\/cmd?operation=01&amp;key=XXX&amp;mode=YY<\/code><\/li>\n<\/ul>\n<p>Where YY stands for:<\/p>\n<p style=\"padding-left: 120px;\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-1444 alignnone\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_modes-300x93.png\" alt=\"orange_modes\" width=\"207\" height=\"64\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_modes-300x93.png 300w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_modes.png 544w\" sizes=\"(max-width: 207px) 100vw, 207px\" \/><\/p>\n<p>And XXX stands for:<\/p>\n<p style=\"padding-left: 120px;\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-1445 alignnone\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_keys.png\" alt=\"orange_keys\" width=\"239\" height=\"468\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_keys.png 640w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_keys-153x300.png 153w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange_keys-523x1024.png 523w\" sizes=\"(max-width: 239px) 100vw, 239px\" \/><\/p>\n<p>Indeed, a simple HTTP request like this:<\/p>\n<ul>\n<li><code>http:\/\/192.168.1.10:8080\/remoteControl\/cmd?operation=01&amp;key=116&amp;mode=0<\/code><\/li>\n<\/ul>\n<p>returns this message:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1447\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange-answer.png\" alt=\"orange-answer\" width=\"198\" height=\"143\"><\/p>\n<p>and powers on the device. Repeating this request will power off the device.<\/p>\n<p>It turned out also that this request:<\/p>\n<ul>\n<li><code>http:\/\/192.168.1.10:8080\/remoteControl\/cmd?operation=10<\/code><\/li>\n<\/ul>\n<p>returns information about the state of the device. When the device is powered on, it returns:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1448\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-on.png\" alt=\"state-on\" width=\"898\" height=\"39\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-on.png 898w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-on-300x13.png 300w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/p>\n<p>When the device is powered off, it returns:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1449\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-off.png\" alt=\"state-off\" width=\"898\" height=\"46\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-off.png 898w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/state-off-300x15.png 300w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/p>\n<p>Now, let&#8217;s explore the &#8220;En direct&#8221; (i.e &#8220;live&#8221;) fonctionnality of the remote.<\/p>\n<p>It first fires this HTTP request:<\/p>\n<ul>\n<li><code>http:\/\/lsm-rendezvous040413.orange.fr\/API\/?api_token=be906750a3cd20d6ddb47ec0b50e7a68&amp;output=json&amp;withChannels=1<\/code><\/li>\n<\/ul>\n<p>which gives back a long <a href=\"https:\/\/en.wikipedia.org\/wiki\/JSON\" target=\"_blank\" rel=\"noopener\">JSON<\/a> answer. The following is an excerpt of it:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1452\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange-live.png\" alt=\"orange-live\" width=\"681\" height=\"303\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange-live.png 681w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/orange-live-300x133.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/p>\n<p>This JSON structure give information on what is broadcasted at the time of the request:<\/p>\n<ul>\n<li><code>diffusions\":{\"diffusion\":[{\"epgId\":\"641641976\",\"startTime\":\"1443718800\",\"duration\":\"3300\",<br \/>\n\"title\":\"Money Drop\",\"imageUrl\":\"http:\\\/\\\/resize.img.ke.voila.fr\\\/MA\\\/649468183_150.jpg\",<br \/>\n\"category\":\"Divertissement\",\"subCategory\":\"jeu\",\"csa\":\"TP\",\"channelId\":\"192\"}, ...<br \/>\n<\/code><\/li>\n<\/ul>\n<p>and information on the available channels:<\/p>\n<ul>\n<li><code>\"channels\":{\"channel\":[{\"id\":\"103\",\"name\":\"TF1\",\"ip\":null,\"tvIndex\":\"1\",<br \/>\n\"imageUrl\":\"http:\\\/\\\/media.programme-tv.orange.fr\\\/Images\\\/Chaines\\\/192.gif\",\"image\":\"tf1.png\",<br \/>\n\"epgId\":\"192\",\"liveThumbnails\":\"0\",\"blendedTV\":\"1\",\"htag\":\"#tf1\",\"kind\":\"G\\u00e9n\\u00e9raliste\"} ...<br \/>\n<\/code><\/li>\n<\/ul>\n<p>In &#8220;live&#8221; mode, pressing a channel button tunes the set-top box to the selected channel. Sniffing the traffic, it showed that it uses this kind of HTTP request:<\/p>\n<ul>\n<li><code>http:\/\/192.168.1.10:8080\/remoteControl\/cmd?operation=09&amp;epg_id=ZZZZZZZZZZ&amp;uui=1<\/code><\/li>\n<\/ul>\n<p>Where ZZZZZZZZZZ is a 10-characters long string. The right part of the string is the &#8220;epgId&#8221; of the channel (which can be obtained from the &#8220;channels&#8221; information from the previous JSON response). The rest of the string is filled with &#8220;*&#8221; characters.<\/p>\n<p>Here are a few of these strings:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1456\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/epgid.png\" alt=\"epgid\" width=\"422\" height=\"390\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/epgid.png 944w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/epgid-300x277.png 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><br \/>\n<strong>Sketching E.V.E&#8217;s interface for Orange TV<\/strong><\/p>\n<p>We now have enough information to implement a TV interface for E.V.E.<\/p>\n<p>Here is a quick sketch for this interface, which should be quite easy to implement from we collected from the reverse-engineering :<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1434\" src=\"http:\/\/quantum-bits.org\/wp-content\/uploads\/2015\/10\/eve-tv-sketch.png\" alt=\"eve-tv-sketch\" width=\"800\" height=\"480\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/eve-tv-sketch.png 800w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2015\/10\/eve-tv-sketch-300x180.png 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Next step is implementing this sketch and see how it behaves in real life. Advanced functionalities could be added later on, such based on the information from the JSON of &#8220;live broadcast&#8221; request (title, preview, duration, &#8230; of shows)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since I&#8217;m still waiting for all the audio components I ordered for E.V.E&#8217;s&nbsp;voice recognition functionality, let&#8217;s try in the meantime to interface E.V.E with a first home device. The very &#8230;<\/p>\n","protected":false},"author":1,"featured_media":3851,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/1430"}],"collection":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1430"}],"version-history":[{"count":0,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/1430\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/media\/3851"}],"wp:attachment":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}